FIX: do not close the merged topic if the first post wasn't merged (PR #13564)

When a topic is fully merged into another topic we close it and schedule it for deleting. But last time I changed this place I added a bug – when merging all posts in topic except the first one the topic was closing too.

If the OP is not merged into another topic, the original topic should neither close nor be marked for deletion. This PR fixes this.

GitHub

I am curious about the second part of the condition, where you skip split_topic small actions. I understand you do this to skip the small action that is generated right before this method is called. I think there is an edge case here if you move some posts two times in a row. First time you do not select all posts, do the action and a small action post is created. Then you do it again, without selecting the small action created previously. The system will think you selected all posts, but no, because you did not select the small action from the first move.

I might be wrong and even if I am not, I do not think it makes sense fixing it, unless you find something more serious.

Looks good to me. :+1:

I am curious about the second part of the condition

Yeah, it’s a pretty tricky place :), I myself spent some time today trying to remember what does it mean. And it was me who introduced this condition a month ago :), I think it’s worth adding the comment here.

I’ve added a comment. Could you please take a look at it and confirm if it makes sense?

And here is the PR that introduced a change that we support with this condition - FIX: when posts are moved to a message then small action post should not be publicly visible by techAPJ · Pull Request #7085 · discourse/discourse · GitHub.

Speaking of this:

I understand you do this to skip the small action that is generated right before this method is called.

We shouldn’t have such problems here no matter when a small action was added, we just always ignore small actions when moving posts.

:+1: