File tree 3 files changed +13
-8
lines changed
3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ def send_reply_created_notification(comment_pk):
18
18
send_email = True ,
19
19
sender = comment .profile or comment .user ,
20
20
recipient = comment .in_reply_to .user ,
21
- verb = "COMMENT_REPLY_CREATED" ,
21
+ verb = "COMMENTS. COMMENT_REPLY_CREATED" ,
22
22
action_object = comment ,
23
23
target = comment .in_reply_to ,
24
24
level = "info" ,
@@ -40,7 +40,7 @@ def send_comment_created_notification(comment_pk, recipient_id):
40
40
send_email = True ,
41
41
sender = comment .profile or comment .user ,
42
42
recipient = recipient ,
43
- verb = "COMMENT_CREATED" ,
43
+ verb = "COMMENTS. COMMENT_CREATED" ,
44
44
action_object = comment ,
45
45
target = comment .target ,
46
46
level = "info" ,
Original file line number Diff line number Diff line change @@ -121,11 +121,16 @@ def send_email_notification(to, context):
121
121
122
122
def can_user_receive_notification (user_id , verb , channel ):
123
123
NotificationSetting = swapper .load_model ("baseapp_notifications" , "NotificationSetting" )
124
- user_setting = NotificationSetting .objects .filter (
125
- Q (channel = channel ) | Q (channel = NotificationSetting .NotificationChannelTypes .ALL ),
126
- user_id = user_id ,
127
- verb = get_setting_from_verb (verb ),
128
- ).first ()
124
+ user_setting = (
125
+ NotificationSetting .objects .filter (
126
+ Q (channel = channel ) | Q (channel = NotificationSetting .NotificationChannelTypes .ALL ),
127
+ Q (verb = get_setting_from_verb (verb )) | Q (verb = "_ALL_" ),
128
+ user_id = user_id ,
129
+ )
130
+ .order_by ("is_active" )
131
+ .first ()
132
+ )
133
+
129
134
if user_setting :
130
135
return user_setting .is_active
131
136
return True
Original file line number Diff line number Diff line change 1
1
[metadata]
2
2
name = baseapp_notifications
3
- version = 0.3.0
3
+ version = 0.3.1
4
4
description = BaseApp Notifications
5
5
long_description = file: README.md
6
6
url = https://github.com/silverlogic/baseapp-backend
You can’t perform that action at this time.
0 commit comments