Commit 642249e7 authored by Skia's avatar Skia

Notification fix

parent 97f7214f
Pipeline #509 passed with stage
in 2 minutes and 45 seconds
...@@ -70,7 +70,7 @@ class AddFilesForm(forms.Form): ...@@ -70,7 +70,7 @@ class AddFilesForm(forms.Form):
self.add_error(None, _("Error uploading file %(file_name)s: %(msg)s") % {'file_name': f, 'msg': repr(e)}) self.add_error(None, _("Error uploading file %(file_name)s: %(msg)s") % {'file_name': f, 'msg': repr(e)})
if notif: if notif:
for u in RealGroup.objects.filter(id=settings.SITH_GROUP_COM_ADMIN_ID).first().users.all(): for u in RealGroup.objects.filter(id=settings.SITH_GROUP_COM_ADMIN_ID).first().users.all():
if not u.notifications.filter(type="FILE_MODERATION").exists(): if not u.notifications.filter(type="FILE_MODERATION", viewed=False).exists():
Notification(user=u, url=reverse("core:file_moderation"), type="FILE_MODERATION").save() Notification(user=u, url=reverse("core:file_moderation"), type="FILE_MODERATION").save()
class FileListView(ListView): class FileListView(ListView):
......
...@@ -2962,7 +2962,7 @@ msgstr "Personne(s)" ...@@ -2962,7 +2962,7 @@ msgstr "Personne(s)"
#: sas/templates/sas/picture.jinja:81 #: sas/templates/sas/picture.jinja:81
msgid "Moderator: " msgid "Moderator: "
msgstr "Modérateur" msgstr "Modérateur : "
#: sas/templates/sas/picture.jinja:87 #: sas/templates/sas/picture.jinja:87
msgid "HD version" msgid "HD version"
......
...@@ -50,7 +50,7 @@ class SASForm(forms.Form): ...@@ -50,7 +50,7 @@ class SASForm(forms.Form):
self.add_error(None, _("Error uploading file %(file_name)s: %(msg)s") % {'file_name': f, 'msg': repr(e)}) self.add_error(None, _("Error uploading file %(file_name)s: %(msg)s") % {'file_name': f, 'msg': repr(e)})
if notif: if notif:
for u in RealGroup.objects.filter(id=settings.SITH_GROUP_SAS_ADMIN_ID).first().users.all(): for u in RealGroup.objects.filter(id=settings.SITH_GROUP_SAS_ADMIN_ID).first().users.all():
if not u.notifications.filter(type="SAS_MODERATION").exists(): if not u.notifications.filter(type="SAS_MODERATION", viewed=False).exists():
Notification(user=u, url=reverse("sas:moderation"), type="SAS_MODERATION").save() Notification(user=u, url=reverse("sas:moderation"), type="SAS_MODERATION").save()
class RelationForm(forms.ModelForm): class RelationForm(forms.ModelForm):
...@@ -122,7 +122,7 @@ class PictureView(CanViewMixin, DetailView, FormMixin): ...@@ -122,7 +122,7 @@ class PictureView(CanViewMixin, DetailView, FormMixin):
u = User.objects.filter(id=uid).first() u = User.objects.filter(id=uid).first()
PeoplePictureRelation(user=u, PeoplePictureRelation(user=u,
picture=self.form.cleaned_data['picture']).save() picture=self.form.cleaned_data['picture']).save()
if not u.notifications.filter(type="NEW_PICTURES").exists(): if not u.notifications.filter(type="NEW_PICTURES", viewed=False).exists():
Notification(user=u, url=reverse("core:user_pictures", kwargs={'user_id': u.id}), type="NEW_PICTURES").save() Notification(user=u, url=reverse("core:user_pictures", kwargs={'user_id': u.id}), type="NEW_PICTURES").save()
return super(PictureView, self).form_valid(self.form) return super(PictureView, self).form_valid(self.form)
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment