FEATURE: when entering a topic scroll to last visited line marker (#18440)

When a user enters a topic they have already visited they are navigated
to that post that is newest for them (post_number_last_read + 1). Above
that post there is a "last visited" line marker which is visible when
the user scrolls a bit above the post they landed on. This commit makes
sure that the "last visited" line marker is visible as soon as user is
landed in the topic.
This commit is contained in:
Arpit Jalan 2022-09-30 21:27:41 +05:30 committed by GitHub
parent b615201b88
commit 136174e0ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -117,6 +117,15 @@ const DiscourseURL = EmberObject.extend({
if (!holder) {
selector = holderId;
if (
document.getElementsByClassName(
`topic-post-visited-line post-${postNumber - 1}`
)?.length === 1
) {
selector = ".small-action.topic-post-visited";
}
holder = document.querySelector(selector);
}