Currently a post is marked back to unread on any action.
Requirements:
Do not mark a post unread for these actions:
follow
endorse
mark as answer
vote
edit
delete
report
Dev Detail:
We keep track of 'read' status based on thread update date and 'read' date. Hence, implicitly mark a post read on any of above actions.
We need to change the implementation design in order to keep post as 'read' in case of 'Edit Post/Response/Comment'.
Currently;
is_read = read_date_of_user_against_thread (from user.read_states) >= thread.updated_at
'updated_at' is changed and hence thread becomes unread to everyone. We cannot and would not want to add entry in 'read_states' for all users to make thread 'read' for them.
Is "updated_at" used for anything other than read status? It would probably be better named "mark_unread_at", and we would simply set it only for those things that are changing read status. Because the name "updated_at" is so generic, it feels odd deciding what should count as an update or not.
I know that a name change would be a bigger deal, and we may not want to do that, but we may just want to document it more properly. Depending on what we decide, it may make sense to pull this out as a separate story.
The found usage of 'updated_at' are:
sorting in elastic search
sorting user active threads api
Rebuild the content index from MongoDB and already-indexed data where we have criteria to get contents where updated_at <= current timespan
Updating the target indices with records added since max created_at or updated since max updated_at
to calculate is_read
is_read = read_dates[thread_key] >= t.updated_at
to calculate unread_comment_count
unread_comment_count = Comment.collection.find(
 :comment_thread_id => t._id,
 :author_id => {"$ne" => user.id},
 :updated_at => {"$gte" => read_dates[thread_key]}
 ).count
If we rename 'updated_at' for posts to 'mark_unread_at' then are we not deviating from common practice we follow in edx. Keeping in mind we have 'updated_at' for comments and responses too.
Should not we add a new field 'mark_unread_at' in post for this purpose and update that only when we want to mark a post unread and let 'updated_at' as is? Are we sure we would not have any use of update log at all?
Agreed. We definitely want the equivalent of a modified date, which I guess is updated_at. I wasn't clear on what it was used for and your list is great.
It seems we need at least one more time stamp, and we need to determine which should be used for some of your list (like sorts).
FYI:
Verified.