Skip to content
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
merged 4 commits into from
Aug 4, 2023

Conversation

milandamen
Copy link
Contributor

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.

Copy link
Member

@dessalines dessalines left a 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({
Copy link
Member

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 dessalines merged commit afafb77 into LemmyNet:main Aug 4, 2023
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 <abias1122@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Profile option to mark post as read on preview
3 participants