File tree Expand file tree Collapse file tree 12 files changed +32
-5
lines changed
migrations/2025-04-07-130702_disable-post-creator-notifications Expand file tree Collapse file tree 12 files changed +32
-5
lines changed Original file line number Diff line number Diff line change @@ -228,7 +228,10 @@ pub async fn send_local_notifs(
228
228
. is_err ( ) ;
229
229
230
230
// Don't send a notif to yourself
231
- if parent_comment. creator_id != person. id && !check_blocks {
231
+ if parent_comment. creator_id != person. id
232
+ && !check_blocks
233
+ && !parent_comment. disable_reply_notifications
234
+ {
232
235
let user_view = LocalUserView :: read_person ( & mut context. pool ( ) , parent_creator_id) . await ;
233
236
if let Ok ( parent_user_view) = user_view {
234
237
// Don't duplicate notif if already mentioned by checking recipient ids
Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ pub struct CreateComment {
18
18
pub parent_id : Option < CommentId > ,
19
19
#[ cfg_attr( feature = "full" , ts( optional) ) ]
20
20
pub language_id : Option < LanguageId > ,
21
+ /// If false the author doesnt get notified about new replies
22
+ #[ cfg_attr( feature = "full" , ts( optional) ) ]
23
+ pub disable_reply_notifications : Option < bool > ,
21
24
}
22
25
23
26
#[ skip_serializing_none]
@@ -40,6 +43,8 @@ pub struct EditComment {
40
43
pub content : Option < String > ,
41
44
#[ cfg_attr( feature = "full" , ts( optional) ) ]
42
45
pub language_id : Option < LanguageId > ,
46
+ #[ cfg_attr( feature = "full" , ts( optional) ) ]
47
+ pub disable_reply_notifications : Option < bool > ,
43
48
}
44
49
45
50
#[ skip_serializing_none]
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ pub struct CreatePost {
40
40
/// Time when this post should be scheduled. Null means publish immediately.
41
41
#[ cfg_attr( feature = "full" , ts( optional) ) ]
42
42
pub scheduled_publish_time : Option < i64 > ,
43
- /// True if the post creator gets notified about new top-level comments
43
+ /// If false the post creator doesnt get notified about new top-level comments
44
44
#[ cfg_attr( feature = "full" , ts( optional) ) ]
45
45
pub disable_reply_notifications : Option < bool > ,
46
46
}
Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ pub async fn create_comment(
100
100
let mut comment_form = CommentInsertForm {
101
101
language_id : Some ( language_id) ,
102
102
federation_pending : Some ( community_use_pending ( & post_view. community , & context) . await ) ,
103
+ disable_reply_notifications : data. disable_reply_notifications ,
103
104
..CommentInsertForm :: new ( local_user_view. person . id , data. post_id , content. clone ( ) )
104
105
} ;
105
106
comment_form = plugin_hook_before ( "before_create_local_comment" , comment_form) . await ?;
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ pub async fn update_comment(
67
67
let mut form = CommentUpdateForm {
68
68
content,
69
69
language_id : Some ( language_id) ,
70
+ disable_reply_notifications : data. disable_reply_notifications ,
70
71
updated : Some ( Some ( Utc :: now ( ) ) ) ,
71
72
..Default :: default ( )
72
73
} ;
Original file line number Diff line number Diff line change @@ -212,6 +212,7 @@ impl Object for ApubComment {
212
212
local : Some ( false ) ,
213
213
language_id,
214
214
federation_pending : Some ( false ) ,
215
+ disable_reply_notifications : None ,
215
216
} ;
216
217
form = plugin_hook_before ( "before_receive_federated_comment" , form) . await ?;
217
218
let parent_comment_path = parent_comment. map ( |t| t. 0 . path ) ;
Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ pub struct Comment {
63
63
/// If a local user comments in a remote community, the comment is hidden until it is confirmed
64
64
/// accepted by the community (by receiving it back via federation).
65
65
pub federation_pending : bool ,
66
+ /// If false the author doesnt get notified about new replies
67
+ pub disable_reply_notifications : bool ,
66
68
}
67
69
68
70
#[ derive( Debug , Clone , derive_new:: new) ]
@@ -93,6 +95,8 @@ pub struct CommentInsertForm {
93
95
pub language_id : Option < LanguageId > ,
94
96
#[ new( default ) ]
95
97
pub federation_pending : Option < bool > ,
98
+ #[ new( default ) ]
99
+ pub disable_reply_notifications : Option < bool > ,
96
100
}
97
101
98
102
#[ derive( Debug , Clone , Default ) ]
@@ -109,6 +113,7 @@ pub struct CommentUpdateForm {
109
113
pub distinguished : Option < bool > ,
110
114
pub language_id : Option < LanguageId > ,
111
115
pub federation_pending : Option < bool > ,
116
+ pub disable_reply_notifications : Option < bool > ,
112
117
}
113
118
114
119
#[ skip_serializing_none]
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ pub struct Post {
94
94
/// If a local user posts in a remote community, the comment is hidden until it is confirmed
95
95
/// accepted by the community (by receiving it back via federation).
96
96
pub federation_pending : bool ,
97
- /// True if the post creator gets notified about new top-level comments
97
+ /// If false the post creator doesnt get notified about new top-level comments
98
98
pub disable_reply_notifications : bool ,
99
99
}
100
100
Original file line number Diff line number Diff line change @@ -139,6 +139,7 @@ diesel::table! {
139
139
report_count -> Int2 ,
140
140
unresolved_report_count -> Int2 ,
141
141
federation_pending -> Bool ,
142
+ disable_reply_notifications -> Bool
142
143
}
143
144
}
144
145
Original file line number Diff line number Diff line change @@ -180,6 +180,7 @@ pub(crate) fn comment_select_remove_deletes() -> _ {
180
180
comment:: report_count,
181
181
comment:: unresolved_report_count,
182
182
comment:: federation_pending,
183
+ comment:: disable_reply_notifications,
183
184
)
184
185
}
185
186
Original file line number Diff line number Diff line change 1
- alter table post drop column disable_reply_notifications;
1
+ ALTER TABLE post
2
+ DROP COLUMN disable_reply_notifications;
3
+
4
+ ALTER TABLE comment
5
+ DROP COLUMN disable_reply_notifications
Original file line number Diff line number Diff line change 1
- alter table post add column disable_reply_notifications bool not null default false;
1
+ ALTER TABLE post
2
+ ADD COLUMN disable_reply_notifications bool NOT NULL DEFAULT FALSE;
3
+
4
+ ALTER TABLE comment
5
+ ADD COLUMN disable_reply_notifications bool NOT NULL DEFAULT FALSE;
6
+
You can’t perform that action at this time.
0 commit comments