FEATURE: Add last visit indication to topic view page. (#13471)

This PR also removes grey old unread bubble from the topic badges by
dropping `TopicUser#highest_seen_post_number`.
This commit is contained in:
Alan Guo Xiang Tan
2021-07-05 14:17:31 +08:00
committed by GitHub
parent 0f688f45bd
commit 37b8ce79c9
64 changed files with 306 additions and 312 deletions

View File

@ -57,8 +57,8 @@ def insert_topic_users
log "Inserting topic users..."
DB.exec <<-SQL
INSERT INTO topic_users (user_id, topic_id, posted, last_read_post_number, highest_seen_post_number, first_visited_at, last_visited_at, total_msecs_viewed)
SELECT user_id, topic_id, 't' , MAX(post_number), MAX(post_number), MIN(created_at), MAX(created_at), COUNT(id) * #{MS_SPEND_CREATING_POST}
INSERT INTO topic_users (user_id, topic_id, posted, last_read_post_number, first_visited_at, last_visited_at, total_msecs_viewed)
SELECT user_id, topic_id, 't' , MAX(post_number), MIN(created_at), MAX(created_at), COUNT(id) * #{MS_SPEND_CREATING_POST}
FROM posts
WHERE user_id > 0
GROUP BY user_id, topic_id

View File

@ -346,7 +346,6 @@ task 'posts:reorder_posts', [:topic_id] => [:environment] do |_, args|
["post_timings", "post_number"],
["posts", "reply_to_post_number"],
["topic_users", "last_read_post_number"],
["topic_users", "highest_seen_post_number"],
["topic_users", "last_emailed_post_number"],
].each do |table, column|
builder = DB.build <<~SQL