Show just-posted replies above OP replies #4901
Merged
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.
Follow-up to #4882.
Normally we show OP replies above all so that threads work. However, if you have just posted a reply, it is confusing to have it appear offscreen. Twitter handles this by prioritizing just-posted own replies above the OP's (but showing them below the OP's if you navigate away and back to the post). This accomplishes the same thing.
We can do this now because #4898 consolidated the logic for "after post" callback in the post thread component.
Test Plan
Normal mode:
1111.mov
Thread mode:
222.mov
Note that we only do this when we're sure we won't completely displace the OP post out of view:
333.mov
Concretely, this means that we only do this in threaded more or directly under the highlighted post. Otherwise, it feels too confusing to have the OP post disappear.