News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Quote link in a merged topic

Started by lntit, February 12, 2016, 04:53:49 PM

Previous topic - Next topic

lntit

I am not really sure if this issue has ever been reported before, please forgive me if it has already been reported. :S

I know that when topic A is beeing merged with topic B, one of the topic ID goes byebye by being replaced with one of the both topic IDs. However, a quote link from the old topic still have the old topic ID and clicking at it cause the error "The topic or board you are looking for appears to be either missing or off limits to you."
Example:
[quote author=blah link=topic=8.msg21#msg21 date=1455306393]
The issue is that a topic with the ID 8 doesn't exist anymore since the old ID went away by merging.

JBlaze

This brings up an interesting problem, and one I've never encountered. However, there isn't really an easy fix.

For now, it would be easier to just edit the post manually (if you have permission to), and change the topic id.

In the future, this problem could possibly be solved by converting the old topic into a redirect rather than removing it entirely. The other option would be to parse the posts of the old topic searching for any reference to the old topic id, and then changing it as part of the merge function.
Jason Clemons
Former Team Member 2009 - 2012

lntit

I already solving that issue by editing the posts, but in a community with over 600k posts it is not easy to find them. Admins and/or mods could use the moderation log to check quotes in merged topics, but not all forums keep the whole log and not to mention those forums who upgraded from SMF 1.1.x.
(actually, I can find them by "ironically" an error caused by the anonymous post mod that generates an undefined index error when a member, guest or bot follows a quote link to a non-existing topic, lol)

lntit

Addendum:

Quote links of splitted topics are weird, too. The opposite thing happen here: splitted posts get a new topic ID while the topic ID of a quote link refers to the original/previous thread.

-----
Perhaps, one could use the message/post ID for quote linking rather than topic IDs?

Kindred

but the URL uses the topic ID AND the post ID...   so the quote must as well.

We can definitely see what is happening, and why...   but having the system CHANGE the links in a split or merged set of posts would be difficult (if even possible at all)

It is almost definitely not going to be addressed in the 2.0.x branch...   and probably not in 2.1 either
... especially given the fact that this is the first report of the issue in over 10 years...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Illori

in SMF 2.1 the quote has changed...

in SMF 2.0 here you get

[quote author=Kindred link=topic=543388.msg3860242#msg3860242 date=1455367647]

in SMF 2.1 you get

[quote author=illori link=msg=207 date=1451778605]

which links to http://localhost:8080/github2.1/index.php?msg=207 instead of including the topic id.
so this will no longer be an issue in SMF 2.1.

lntit

I guess, this is not something easy or almost impossible to backport, right?

Steve

DO NOT pm me for support!

Illori

Quote from: Steve on February 13, 2016, 09:40:00 AM
Correct, as Kindred said. :)

he did not say anything about this.

it may be possible to backport but you would have to find the change on github and examine it to be sure.

Kindred

good catch Illori....  I forgot it had been changed in 2.1

I doubt that it would be a simple backport, gven the major changes that went into the bbc stuff for 2.1  but someone (not our developers - they are busy working on 2.1) could look at it
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Steve

Quote from: Illori on February 13, 2016, 09:43:30 AM
Quote from: Steve on February 13, 2016, 09:40:00 AM
Correct, as Kindred said. :)

he did not say anything about this.

it may be possible to backport but you would have to find the change on github and examine it to be sure.

I read this as saying just that:

Quote from: Kindred on February 13, 2016, 07:47:27 AM... having the system CHANGE the links in a split or merged set of posts would be difficult (if even possible at all)

It is almost definitely not going to be addressed in the 2.0.x branch...
DO NOT pm me for support!

Kindred

That meant that I see it as unlikely that WE will backport it (unless it is simpler than I think)

but someone ELSE could...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

lntit

#12
Ok, I took a look at the Github one and just copy-pasted the quote functions into SMF2.0.x:
What I did:
Sources/Subs.php:
Code (find) Select
'link' => array('match' => '(?:board=\d+;)?((?:topic|threadid)=[\dmsg#\./]{1,40}(?:;start=[\dmsg#\./]{1,40})?|action=profile;u=\d+)'),
Code (replace with) Select
'link' => array('match' => '(?:board=\d+;)?((?:topic|threadid)=[\dmsg#\./]{1,40}(?:;start=[\dmsg#\./]{1,40})?|msg=\d+?|action=profile;u=\d+)'),

Sources/Post.php:
Code (find) Select
$form_message = '[quote author=' . $mname . ' link=topic=' . $topic . '.msg' . (int) $_REQUEST['quote'] . '#msg' . (int) $_REQUEST['quote'] . ' date=' . $mdate . ']' . "\n" . rtrim($form_message) . "\n" . '[/quote]';
Code (replace with) Select
$form_message = '[quote author=' . $mname . ' link=msg=' . (int) $_REQUEST['quote'] . ' date=' . $mdate . ']' . "\n" . rtrim($form_message) . "\n" . '[/quote]';
and
Code (find) Select
$context['quote']['xml'] = '[quote author=' . $row['poster_name'] . ' link=topic=' . $row['id_topic'] . '.msg' . (int) $_REQUEST['quote'] . '#msg' . (int) $_REQUEST['quote'] . ' date=' . $row['poster_time'] . ']' . $lb . $row['body'] . $lb . '[/quote]';
Code (replace with) Select
$context['quote']['xml'] = '[quote author=' . $row['poster_name'] . ' link=msg=' . (int) $_REQUEST['quote'] . ' date=' . $row['poster_time'] . ']' . $lb . $row['body'] . $lb . '[/quote]';
This works NICE on my test installation.

Quelle surprise ;D


Only one thing, old quote links will be not changed by that.

EDIT: Darn, merging topics still cause off limits... I'll look deeper into it. DOUBLE EDIT: Nevermind.However, I'll play more with it.
TRIPLE EDIT: It does work! :D :D
Test:
http://www.simplemachines.org/community/index.php?topic=543388.msg3860193#msg3860193
http://www.simplemachines.org/community/index.php?msg=3860193
^link to the second post of this topic. ;D

lntit

I did some more tests...

Tested on SMF 2.0.11 with the backported quoting code (see my previous post) and SMF 2.1 Beta 3 (that from Github).

Test one: merging posts with quotes
  • created a topic that will be the target topic - Topic X, msg1
  • created a topic to will be merged - Topic Y, msg2

    • reply #1 quoted the first post of topic Y (msg2 > msg3)
    • reply #2 quoted reply #1 of topic Y (msg2 > msg3 > msg4)
  • merging Topic Y with Topic X
  • after merging has been done, one have following msgs in the new topic:

    • msg1 (of Topic X)
    • msg2 (of topic Y)
    • msg3 (with quote link=msg=2)
    • msg4 (with quote link=msg=3)

Test two: splitting a topic with posts containing quotes
  • created a topic that will be splitted later - Topic Z, msg1

    • reply #1 quoted the first post of topic Z (msg1 > msg2)
    • reply #2 quoted reply #1 of topic Z (msg2 > msg3)
  • splitting Topic Z and created Topic New
  • after splitting has been done, Topic New has following msgs:

    • msg2 (with quote link=msg=1)
    • msg3 (with quote link=msg=2)

Stuff work pretty well on SMF 2.0.11 and obviously SMF 2.1 :)
NOTE: If caching level is setted up, it will take a short time to update the links of performed merge/split on SMF 2.0.11 as well as on SMF 2.1 beta 3.

Quote from: Kindred on February 13, 2016, 04:26:49 PM
That meant that I see it as unlikely that WE will backport it (unless it is simpler than I think)

but someone ELSE could...
As you see, it is really simple since a quote tag just converts post/topic IDs into a link and SMF 2.0.x does have posts IDs. :)

Kindred

hmmm....however...   wouldn't that break all of the previously quoted links?

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Illori

nope, SMF 2.1 still supports the old format for quoting that SMF 2.0 uses.

this would be considered a feature right? SMF 2.0 is feature locked so we cant add this to SMF 2.0.

lntit

Quote from: Illori on February 15, 2016, 02:04:42 PM
this would be considered a feature right? SMF 2.0 is feature locked so we cant add this to SMF 2.0.
Not sure if one would call that a feature that fix an issue mentioned in the OP...

Advertisement: