File tree Expand file tree Collapse file tree
XFRM/Service/ResourceUpdate Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,14 +16,15 @@ protected function onApprove()
1616 protected function approveDiscussionThreadPost ($ update )
1717 {
1818 // TODO: find more solid way of finding the update's post in discussion thread
19+ $ updateUrl = '%resources/ ' . strtolower ($ update ->title ) .'. ' . $ update ->Resource ->resource_id .'/update/ ' . $ update ->resource_update_id .'/% ' ;
1920 $ post = \XF ::finder ('XF:Post ' )->where ([
2021 'thread_id ' => $ update ->Resource ->discussion_thread_id ,
21- 'post_date ' => $ update ->post_date ,
22- ' user_id ' => $ update -> Resource -> user_id
22+ 'user_id ' => $ update ->Resource -> user_id ,
23+ [ ' message ' , ' LIKE ' , $ updateUrl ]
2324 ])->fetchOne ();
2425
2526 // Approve resource update's associated post if unapproved
26- if ($ post ->message_state == 'moderated ' ){
27+ if ($ post AND $ post ->message_state == 'moderated ' ){
2728 /** @var \XF\Service\Post\Approver $postApprover */
2829 $ postApprover = \XF ::service ('XF:Post\Approver ' , $ post );
2930 $ postApprover ->approve ();
You can’t perform that action at this time.
0 commit comments