From 2145678c2d20991cdb5ecb05b8b6aa70f0f910eb Mon Sep 17 00:00:00 2001 From: nishizoe Date: Fri, 2 Dec 2016 14:13:50 +0900 Subject: [PATCH 1/3] =?UTF-8?q?(fixed=20#4064)=20#4055=20=E3=81=AE?= =?UTF-8?q?=E5=95=8F=E9=A1=8C=E3=81=AB=E5=AF=BE=E3=81=99=E3=82=8B=20opLike?= =?UTF-8?q?Plugin=20=E3=81=AE=E7=8B=AC=E8=87=AA=E4=BF=AE=E6=AD=A3=E3=82=92?= =?UTF-8?q?=E5=8F=96=E3=82=8A=E9=99=A4=E3=81=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/modules/like/actions/actions.class.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/api/modules/like/actions/actions.class.php b/apps/api/modules/like/actions/actions.class.php index 85b9198..8c654a3 100644 --- a/apps/api/modules/like/actions/actions.class.php +++ b/apps/api/modules/like/actions/actions.class.php @@ -55,31 +55,30 @@ public function executePost(sfWebRequest $request) $this->forward400If($alreadyLike, 'It has already been registered'); $fromMember = $this->getUser()->getMember(); - $baseUrl = $request->getRelativeUrlRoot(); switch ($foreignTable) { case 'A': $this->forward400Unless($activity = Doctrine::getTable('ActivityData')->find($foreignId)); $timelineId = $activity->in_reply_to_activity_id ? $activity->in_reply_to_activity_id : $activity->id; - $url = $baseUrl.'/timeline/show/id/'.$timelineId; + $url = '/timeline/show/id/'.$timelineId; break; case 'D': - $url = $baseUrl.'/diary/'.$foreignId; + $url = '/diary/'.$foreignId; break; case 'd': $diaryComment = Doctrine::getTable('DiaryComment')->findOneById($foreignId); $this->forward400Unless($diaryComment, 'diary comment does not exist.'); - $url = $baseUrl.'/diary/'.$diaryComment->getDiaryId(); + $url = '/diary/'.$diaryComment->getDiaryId(); break; case 'e': $eventComment = Doctrine::getTable('CommunityEventComment')->findOneById($foreignId); $this->forward400Unless($eventComment, 'event comment does not exist.'); - $url = $baseUrl.'/communityEvent/'.$eventComment->getCommunityEventId(); + $url = '/communityEvent/'.$eventComment->getCommunityEventId(); break; case 't': $topicComment = Doctrine::getTable('CommunityTopicComment')->findOneById($foreignId); $this->forward400Unless($topicComment, 'topic comment does not exist.'); - $url = $baseUrl.'/communityTopic/'.$topicComment->getCommunityTopicId(); + $url = '/communityTopic/'.$topicComment->getCommunityTopicId(); break; default : $url = '#'; From 50de6a8bce3171dba3593f529d6548fb012e0a8a Mon Sep 17 00:00:00 2001 From: nishizoe Date: Fri, 2 Dec 2016 17:09:45 +0900 Subject: [PATCH 2/3] =?UTF-8?q?(fixed=20#4064)=20#4064=20=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E5=89=8D=E3=81=AB=E6=8A=95=E7=A8=BF=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=9F=E3=83=87=E3=83=BC=E3=82=BF=E3=81=AEURL=E3=81=8B?= =?UTF-8?q?=E3=82=89=20$baseUrl=20=E3=81=A8=E3=81=97=E3=81=A6=E8=A8=AD?= =?UTF-8?q?=E5=AE=9A=E3=81=95=E3=82=8C=E3=81=9F=E6=96=87=E5=AD=97=E5=88=97?= =?UTF-8?q?=E3=82=92=E5=8F=96=E3=82=8A=E9=99=A4=E3=81=8F=20migration=20?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/fixtures/000_revision.yml | 2 +- .../004_change_notification_url.php | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 data/migrations/004_change_notification_url.php diff --git a/data/fixtures/000_revision.yml b/data/fixtures/000_revision.yml index 1b108c6..e0c27ff 100644 --- a/data/fixtures/000_revision.yml +++ b/data/fixtures/000_revision.yml @@ -1,4 +1,4 @@ SnsConfig: op_like_plugin_current_revision: name: "opLikePlugin_revision" - value: 3 + value: 4 diff --git a/data/migrations/004_change_notification_url.php b/data/migrations/004_change_notification_url.php new file mode 100644 index 0000000..697a7d9 --- /dev/null +++ b/data/migrations/004_change_notification_url.php @@ -0,0 +1,46 @@ + + */ +class opLikePluginMigrationVersion4 extends opMigration +{ + /* + * 下記の条件に一致する通知URLを一括で変更: + * * url に '/timeline/', '/diary/', '/communityEvent/', '/communityTopic/' が含まれ、 + * 且つ、これらの前に'/'で始まる何らかの文字列が含まれているもの + */ + public function postUp() + { + $notificationObject = Doctrine::getTable('MemberConfig') + ->findByName('notification_center'); + + if ($notificationObject) + { + foreach ($notificationObject as $object) + { + $notifications = unserialize($object->getValue()); + + $newNotifications = array(); + foreach ($notifications as $notificationItem) + { + $url = $notificationItem['url']; + if ($url) + { + preg_match('/(\/timeline\/show\/id|\/diary|\/communityEvent|\/communityTopic)\/[0-9]+/', $url, $m); + $url = $m[0]; + $notificationItem['url'] = $url; + } + array_push($newNotifications, $notificationItem); + } + + $object->setValue(serialize($newNotifications)); + $object->save(); + $object->free(true); + } + } + + } +} From 563268dee3df40e9e375666c28d3f2080f78a983 Mon Sep 17 00:00:00 2001 From: nishizoe Date: Mon, 5 Dec 2016 14:19:00 +0900 Subject: [PATCH 3/3] =?UTF-8?q?(fixed=20#4064)=20=E3=83=9E=E3=83=83?= =?UTF-8?q?=E3=83=81=E3=81=97=E3=81=AA=E3=81=84=E5=A0=B4=E5=90=88=E3=81=AB?= =?UTF-8?q?=20url=20=E3=82=92=E5=A4=89=E6=9B=B4=E3=81=97=E3=81=AA=E3=81=84?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E5=88=86=E5=B2=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/migrations/004_change_notification_url.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/data/migrations/004_change_notification_url.php b/data/migrations/004_change_notification_url.php index 697a7d9..39fb242 100644 --- a/data/migrations/004_change_notification_url.php +++ b/data/migrations/004_change_notification_url.php @@ -29,9 +29,11 @@ public function postUp() $url = $notificationItem['url']; if ($url) { - preg_match('/(\/timeline\/show\/id|\/diary|\/communityEvent|\/communityTopic)\/[0-9]+/', $url, $m); - $url = $m[0]; - $notificationItem['url'] = $url; + if (preg_match('/(\/timeline\/show\/id|\/diary|\/communityEvent|\/communityTopic)\/[0-9]+/', $url, $m)) + { + $url = $m[0]; + $notificationItem['url'] = $url; + } } array_push($newNotifications, $notificationItem); }