-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: move subscription to merged discussion #50
Closed
SychO9
wants to merge
1
commit into
FriendsOfFlarum:master
from
SychO9:sm/move-subcription-to-merged-discussion
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean the new merged discussion will be marked completely as read if any of the merged ones was being followed by the user? Even if the user hadn't read any of the posts involved in the merge?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, it only applies if they've never read the target discussion though, setting the number to 1 might be better in retrospect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think i'd rather set it to the last post number where the user has read all previous posts - but that requires either checking old & new post numbers or created times. More complicated. And not limited to flarum/subscriptions either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that it's doable, post numbers change when merging from discussion A, B, C to discussion Y. Which post number to pick from A B C and how to pick it with its new value seems like a lot of complexity.
Also, since they haven't read discussion Y at all, setting a post number other than 1 means original posts they haven't read gets marked as read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, so what I described was keeping the original "last read post" references of each discussion and comparing their new post numbers, picking the smallest one as the one to save in the new discussion. This way it'd resume them at the point where new posts appear that they may have not read, with the ones they definitely had before them.
Eg.
We know they must've read posts #1-3 at least in the merged discussion, so we can set last post read number to 3. This doesn't necessarily mean the next post will not have been read, but it guarantees the ones beforehand were.
Of course, this could be also done by calculating which post is first encountered in the new numbering that wasn't read, but that seems more consuming.
Or we can do none of this cause It's not worth it 🤷. Not in the scope of this PR anyways.
I did start second guessing myself while I wrote this 😅 but I think what I wrote is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, thinking back again maybe it's too much to introduce this PR logic in the extension, might be better to keep it simple. How about just a
MergingDiscussions
event dispatched instead. That way it can be used for custom behavior without burdening current extension.