Fixed Post Move Alert: Link to Post instead of Thread

Steffen

Well-known member
Affected version
2.0.7
The post move alert ("Your post in the thread {title} was moved to {target}", phrase "your_post_in_thread_x_was_moved_to_y") links to the target thread. If the target thread has many pages then a link to the first page of the thread isn't that helpful for the user. What do you think about linking to the post instead?

Diff:
diff --git a/src/XF/Service/Post/Mover.php b/src/XF/Service/Post/Mover.php
index 75b19f6ee..ef7c3e3c0 100644
--- a/src/XF/Service/Post/Mover.php
+++ b/src/XF/Service/Post/Mover.php
@@ -330,11 +330,6 @@ class Mover extends \XF\Service\AbstractService
         /** @var \XF\Repository\Post $postRepo */
         $postRepo = $this->repository('XF:Post');
 
-        $alertExtras = [
-            'targetTitle' => $target->title,
-            'targetLink' => $this->app->router('public')->buildLink('nopath:threads', $target)
-        ];
-
         foreach ($this->sourcePosts AS $sourcePost)
         {
             if ($sourcePost->Thread->discussion_state == 'visible'
@@ -342,6 +337,11 @@ class Mover extends \XF\Service\AbstractService
                 && $sourcePost->user_id != \XF::visitor()->user_id
             )
             {
+                $alertExtras = [
+                    'targetTitle' => $target->title,
+                    'targetLink' => $this->app->router('public')->buildLink('nopath:posts', $sourcePost)
+                ];
+
                 $postRepo->sendModeratorActionAlert($sourcePost, 'move', $this->alertReason, $alertExtras);
             }
         }

The "Post/Copier" service could be adjusted accordingly.
 
Top Bottom