Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/api/i18n/messages.ja.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@
<source>Self Introduction</source>
<target>自己紹介</target>
</trans-unit>
<trans-unit id="">
<source>Can not post same message</source>
<target>既に送信済みです。</target>
</trans-unit>
</body>
</file>
</xliff>
8 changes: 8 additions & 0 deletions apps/api/modules/activity/actions/actions.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ public function executePost(sfWebRequest $request)
$this->forward400If('' === $body, 'body parameter not specified.');

$memberId = $this->getUser()->getMemberId();

$lastactivity = Doctrine::getTable('ActivityData')->getActivityList($memberId, null, 1);
if ($request['body'] == $lastactivity[0]['body'])
{
sfContext::getInstance()->getConfiguration()->loadHelpers('I18N');
return $this->renderJSON(array('status' => 'error', 'message' => __('Can not post same message')));
}

$options = array();

if (isset($request['public_flag']))
Expand Down
4 changes: 4 additions & 0 deletions apps/mobile_frontend/i18n/messages.ja.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,10 @@
<source>SNS Member's %activity%</source>
<target>SNSメンバーの%activity%</target>
</trans-unit>
<trans-unit id="">
<source>Can not post same message</source>
<target>既に送信済みです。</target>
</trans-unit>
<trans-unit id="">
<source>Link outside URL</source>
<target>外部URLへのリンク</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
</center>
<?php include_partial('default/activityBox', array(
'title' => '',
'activities' => $pager->getResults())
'activities' => $pager->getResults(),
'activityMessage' => $activityMessage,
)
) ?>
<?php op_include_pager_navigation($pager, 'member/showActivity?page=%d&id='.$id) ?>
<?php else: ?>
Expand Down
4 changes: 4 additions & 0 deletions apps/pc_frontend/i18n/messages.ja.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,10 @@
<source>SNS Member's %activity%</source>
<target>SNSメンバーの%activity%</target>
</trans-unit>
<trans-unit id="">
<source>Can not post same message</source>
<target>既に送信済みです。</target>
</trans-unit>
<trans-unit id="">
<source>Remember me</source>
<target>次回から自動的にログイン</target>
Expand Down
2 changes: 2 additions & 0 deletions apps/pc_frontend/modules/default/templates/_activityBox.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php $id = 'activityBox' ?>
<?php $id .= isset($gadget) ? '_'.$gadget->getId() : '' ?>
<?php $activityMessage = isset($activityMessage) ? $activityMessage : '' ?>

<?php slot('activities') ?>
<?php if (isset($form)): ?>
Expand All @@ -15,6 +16,7 @@
</div>
<div class="box_body">
<span class="inputForm"><?php echo $form['body']->render(array('id' => $id.'_activity_data_body')) ?></span>
<span class="box_errormessage"><?php echo $activityMessage;?></span>
<span class="submit"><input id="<?php echo $id ?>_submit" type="submit" value="<?php echo __('%post_activity%', array('%post_activity%' => $op_term['post_activity']->titleize())) ?>" class="submit" /></span>
</div>
</div></form>
Expand Down
1 change: 1 addition & 0 deletions apps/pc_frontend/modules/friend/templates/_activityBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<?php $params = array(
'activities' => $activities,
'gadget' => $gadget,
'activityMessage' => $activityMessage,
) ?>
<?php if (isset($form)): ?>
<?php $params['form'] = $form ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<?php $params = array(
'title' => $title,
'activities' => $pager->getResults(),
'activityMessage' => $activityMessage,
) ?>
<?php if (isset($form)): ?>
<?php $params['form'] = $form; ?>
Expand Down
1 change: 1 addition & 0 deletions apps/pc_frontend/modules/member/templates/_activityBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
'%activity%' => $op_term['activity']->titleize()->pluralize()
)),
'moreUrl' => 'member/showActivity?id='.$member->getId(),
'activityMessage' => $activityMessage,
) ?>
<?php include_partial('default/activityBox', $params) ?>
<?php endif; ?>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
'title' => __("SNS Member's %activity%", array(
'%activity%' => $op_term['activity']->titleize()->pluralize()
)),
'moreUrl' => 'member/showAllMemberActivity'
'moreUrl' => 'member/showAllMemberActivity',
'activityMessage' => isset($activityMessage) ? $activityMessage : '',
) ?>
<?php if (isset($form)): ?>
<?php $params['form'] = $form ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
<?php include_slot('pager') ?>
<?php include_partial('default/activityBox', array(
'title' => $title,
'activities' => $pager->getResults())
'activities' => $pager->getResults(),
'activityMessage' => $activityMessage,
)
) ?>
<?php include_slot('pager') ?>
<?php else: ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
'title' => __("SNS Member's %activity%", array(
'%activity%' => $op_term['activity']->titleize()->pluralize()
)),
'activities' => $pager->getResults()
'activities' => $pager->getResults(),
'activityMessage' => $activityMessage,
) ?>
<?php if (isset($form)): ?>
<?php $params['form'] = $form ?>
Expand Down
12 changes: 12 additions & 0 deletions lib/action/opMemberAction.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,18 @@ public function executeUpdateActivity($request)
$this->form->bind($params);
if ($this->form->isValid())
{
$lastactivity = Doctrine::getTable('ActivityData')->getActivityList($this->getUser()->getMemberId(), null, 1);
if ($params['body'] == $lastactivity[0]['body'])
{
if ($request->isMobile())
{
$this->getUser()->setFlash('error', 'Can not post same message');
$this->redirect($params['next_uri']);
}
sfContext::getInstance()->getConfiguration()->loadHelpers('I18N');
return $this->renderText('same-message|'.__('Can not post same message'));
}

$this->form->save();
if ($request->isXmlHttpRequest())
{
Expand Down
9 changes: 1 addition & 8 deletions web/js/op_activity.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion web/js/op_activity.js.src
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,15 @@ var opActivity = function(id, posturl){
data = data.length > 1 ? data.substring(1) : "";
req.onreadystatechange = function (e) {
if (req.readyState == 4 && req.status == 200) {
t.timeline.innerHTML = req.responseText + t.timeline.innerHTML;
if (0 == req.responseText.indexOf('same-message'))
{
var message = req.responseText.split('|')[1];
alert(message);
}
else
{
t.timeline.innerHTML = req.responseText + t.timeline.innerHTML;
}
}
}

Expand Down