Skip to content

Add post_actions.disable_notifications (fixes #3042) #5826

Merged
Nutomic merged 15 commits intomainfrom
disable_reply_notifications_2
Jun 30, 2025
Merged

Add post_actions.disable_notifications (fixes #3042) #5826
Nutomic merged 15 commits intomainfrom
disable_reply_notifications_2

Conversation

@Nutomic
Copy link
Copy Markdown
Member

@Nutomic Nutomic commented Jun 24, 2025

Replaces #5602 by adding post_actions.disable_notifications which can be set via /api/v4/post/disable_notifications. If this is true the user wont be notified about any replies or mentions in the post. Also cleaned up the logic for send_local_notifs().

}

Ok(recipient_ids)
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split this spaghetti code into separate functions with only very minor logic changes. You can see the changes by checking the individual commits.

@Nutomic Nutomic marked this pull request as ready for review June 26, 2025 09:18
@Nutomic Nutomic force-pushed the disable_reply_notifications_2 branch from 8be0de6 to 3c6bbe1 Compare June 26, 2025 09:21
context,
)
.await
.is_err();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check was previously missing so it sent mentions even in communities that were blocked by the user (and for blocked users, instances).

local_instance_id,
)
.await?;
let updated_comment_id = updated_comment.id;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this was only called to get recipient_ids, so I changed it to empty vec.

@Nutomic Nutomic changed the title Disable reply notifications 2 Add post_actions.disable_notifications (fixes #3042) Jun 26, 2025
@Nutomic Nutomic force-pushed the disable_reply_notifications_2 branch from cbe1e0f to 9a0dc85 Compare June 26, 2025 10:01
@Nutomic
Copy link
Copy Markdown
Member Author

Nutomic commented Jun 26, 2025

Question, is the field CommentResponse.recipient_ids: Vec<LocalUserId> useful for anything? A search in lemmy-ui source shows that it isnt used at all.

@Nutomic Nutomic force-pushed the disable_reply_notifications_2 branch from 38a9667 to 5929494 Compare June 26, 2025 12:45
@dessalines
Copy link
Copy Markdown
Member

Question, is the field CommentResponse.recipient_ids: Vec useful for anything? A search in lemmy-ui source shows that it isnt used at all.

That might be a relic of websockets needing to update the recipients live, or before we added the comment_reply or comment_mention tables. You can probably remove it.

Comment on lines +1 to +2
ALTER TABLE post_actions
ADD COLUMN disable_notifications bool DEFAULT FALSE;
Copy link
Copy Markdown
Member

@dessalines dessalines Jun 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have the case, where either a post creator, or any bystander, might want to be notified about all new comments within a post.

Since these are exclusive, I think we should probably create a notifications enum column, and a PostNotifications type with :

  • RepliesAndMentions (default)
  • AllComments
  • Mute

Otherwise, we'd have a disable(or mute)_notifications bool, and a follow_all_comments bool, but those could conflict.

use lemmy_db_views_site::api::SuccessResponse;
use lemmy_utils::error::LemmyResult;

pub async fn disable_post_notifications(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be changed to update_post_notifications , since there should be several options.

@Nutomic
Copy link
Copy Markdown
Member Author

Nutomic commented Jun 27, 2025

Removed recipient_ids from api and changed post_actions field to enum. Will add the logic for post following in #5604. So this PR can be merged already.

@Nutomic
Copy link
Copy Markdown
Member Author

Nutomic commented Jun 30, 2025

Gonna merge this, use #5604 for any additional feedback.

@Nutomic Nutomic merged commit 76fbb29 into main Jun 30, 2025
2 checks passed
Nutomic added a commit that referenced this pull request Jul 2, 2025
Nutomic added a commit that referenced this pull request Jul 2, 2025
Nutomic added a commit that referenced this pull request Jul 2, 2025
@Nothing4You Nothing4You deleted the disable_reply_notifications_2 branch September 11, 2025 17:30
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.

3 participants