Notification fix

This commit is contained in:
Skia 2016-12-14 09:11:26 +01:00
parent 97f7214f01
commit 642249e7fb
3 changed files with 4 additions and 4 deletions

View File

@ -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):

View File

@ -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"

View File

@ -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):
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: