Do not mark post unread for any action other than creation

Description

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.

Steps to Reproduce

None

Reason for Variance

None

Release Notes

None

Activity

Show:
Wajeeha Khalid
August 1, 2016, 10:27 AM


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.

Robert Raposa
August 1, 2016, 1:53 PM

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.

Wajeeha Khalid
August 2, 2016, 1:01 PM

The found usage of 'updated_at' are:

  1. sorting in elastic search

  2. sorting user active threads api

  3. Rebuild the content index from MongoDB and already-indexed data where we have criteria to get contents where updated_at <= current timespan

  4. Updating the target indices with records added since max created_at or updated since max updated_at

  5. to calculate is_read

  6. is_read = read_dates[thread_key] >= t.updated_at

  7. to calculate unread_comment_count

  8. 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?

Robert Raposa
August 2, 2016, 1:18 PM

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:

Mirza Mubashar Baig
September 22, 2016, 6:56 AM

Verified.

Done

Assignee

Wajeeha Khalid

Reporter

Wajeeha Khalid

Labels

None

Customer

None

URL

None

Groups with Read-Only Access

None

Actual Points

None

Reach

None

Impact

None

Open edX Discourse Thread

None

Platform Map Area (Levels 1 &amp; 2)

None

Platform Map Area (Levels 3 &amp; 4)

None

Contributor Name

None

Blended Project Status Page

None

edX Squad

None

Product Rollout Framework

None

Content &amp; Partner Success Lead

None

Marketing Lead

None

Learning Lead

None

Support Lead

None

Story Points

1.5

Epic Link

Sprint

None

Priority

CAT-3
Configure