File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -93,20 +93,17 @@ def visible(self):
9393
9494class NotificationQuerySet (models .QuerySet ):
9595 def for_user (self , user : 'TigaUser' ):
96- from .models import SentNotification
96+ from .models import NotificationTopic
9797
98- sent_notifications_subquery = SentNotification .objects .filter (
99- notification = models .OuterRef ('pk' )
100- ).filter (
101- models .Q (sent_to_user = user ) |
102- models .Q (sent_to_topic__topic_code = 'global' ) |
103- models .Q (sent_to_topic__topic_users__user = user )
104- ).values ('notification' ).distinct ('notification' )
98+ topics = NotificationTopic .objects .filter (
99+ models .Q (topic_users__user = user ) | models .Q (topic_code = 'global' )
100+ ).distinct ()
105101
106102 return self .filter (
107103 models .Q (user = user ) |
108104 #models.Q(report__user=user) |
109- models .Q (pk__in = models .Subquery (sent_notifications_subquery ))
105+ models .Q (notification_sendings__sent_to_user = user ) |
106+ models .Q (notification_sendings__sent_to_topic__in = topics )
110107 )
111108
112109 def seen_by_user (self , user : 'TigaUser' , state : bool = True ):
You can’t perform that action at this time.
0 commit comments