-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark post as read when clicking "Expand here" on the preview image on the post listing page (#1600) #1978
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… the post listing page (LemmyNet#1600)
dessalines
reviewed
Jul 25, 2023
…tly using HttpService
SleeplessOne1917
approved these changes
Jul 30, 2023
dessalines
approved these changes
Aug 4, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -1728,12 +1728,11 @@ export class PostListing extends Component<PostListingProps, PostListingState> { | |||
|
|||
const auth = myAuth(); | |||
if (auth && !i.props.post_view.read) { | |||
const form: MarkPostAsRead = { | |||
i.props.onMarkPostAsRead({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for catching this one.
dessalines
pushed a commit
that referenced
this pull request
Aug 7, 2023
… the post listing page (#1600) (#1978) * Mark post as read when clicking "Expand here" on the preview image on the post listing page (#1600) * Simplified check for mark post as read * Implemented mark post as read as a property callback instead of directly using HttpService --------- Co-authored-by: SleeplessOne1917 <[email protected]>
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes #1600
When the image preview is clicked, and the post has not been "read" before, a request is made to the lemmy server API to mark the post as read. If the user is not logged in, no attempt is made to mark the post as read. This uses functionality that has already been implemented in lemmy-js-client and lemmy server.
The reason for this change is explained in #1600, but basically it would be logical for a post to have been "read" if you have previewed the image. This is useful in combination with turning off "Show Read Posts" in the user profile settings, so that you only see posts in your feed that you have not viewed before. This already works well with non-image posts, but for image posts you don't want to open the whole post to check out the image.
I have not worked with modern javascript development before, so any feedback is appreciated. I looked at #1135 / #384 for inspiration for the code.
Screenshots
Graphics did not change.
Before
When the image preview is clicked, the post was not marked as "read". It was only marked as "read" if you opened the post, or liked the post.
After
When the image preview is clicked, the post is marked as read. The other ways of marking as read remain unchanged.