Fixed Moderator log: Content URL of "post move" entries points to the current thread instead of source/target post

Affected version
2.1.9

Steffen

Well-known member
Moving a post to another thread creates an entry "Posts from thread moved to {title}" ("mod_log.thread_post_move_source") in the moderator log of the source thread. But the "View" link of such an entry does not point to the target post (in its new thread) but to the source thread. So clicking this link just reloads the current page. This doesn't seem to make sense or is there something we don't understand?

The moderator log in the target thread has the same issue: The "View" link of the moderator log doesn't point to the source thread (which would be useful) but to the currently viewed target thread (which doesn't make sense for us).
 

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.1.10).

Change log:
Support URLs being used in moderator log action params.
There may be a delay before changes are rolled out to the XenForo Community.
 

Chris D

XenForo developer
Staff member
Some changes have been made but there are some caveats...

1) We have made changes so that move/copy source moderator logs now look like this:

localhost_21x_threads_thread-source.66_.png

2) We link the destination thread title to the destination thread URL.

3) To support this we're now explicitly handling the base pathing of any moderator log action param that ends in url (generally we store URLs with nopath)

4) We were already storing the url for these moderator logs but unfortunately it was pointing still to the source rather than the destination, we've fixed this now. So, essentially, the change isn't retroactive and older logs may appear to be pointing to the wrong thread.

5) Generally it is correct and expected that the "View" link and anywhere else we link to the content points to the content which the log was created for. i.e. the destination log will always link to the destination thread and the source log will always link to the source thread. There's no getting around that because those moderator logs are assigned to the specific content and any links should link to that content.

6) Unfortunately we're unable to make a similar change for the destination moderator log because the posts being copied or moved into a thread may have come from multiple sources.
 

Steffen

Well-known member
Thank you for the fix!

A small change is required to make it work (otherwise the url is relative and the link doesn't work):

Diff:
--- a/src/XF/ModeratorLog/AbstractHandler.php
+++ b/src/XF/ModeratorLog/AbstractHandler.php
@@ -109,7 +109,7 @@ abstract class AbstractHandler
 
         foreach ($params AS $key => $param)
         {
-            if (preg_match('/url$/i', $param))
+            if (preg_match('/url$/i', $key))
             {
                 $params[$key] = $pather($param, 'base');
             }
 
Top