From: yomguy Date: Mon, 24 Sep 2012 12:19:18 +0000 (+0200) Subject: Merge branch 'dev' of git+ssh://vcs.parisson.com/var/git/django-postman X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=cda5aadcd285f38f0d6c514f1e54867f87bfd86e;p=django-postman.git Merge branch 'dev' of git+ssh://vcs.parisson.com/var/git/django-postman Conflicts: MANIFEST.in docs/conf.py postman/__init__.py postman/locale/de/LC_MESSAGES/django.po postman/templates/postman/base.html postman/templates/postman/base_write.html postman/test_urls.py postman/tests.py postman/utils.py --- cda5aadcd285f38f0d6c514f1e54867f87bfd86e diff --cc MANIFEST.in index 12431ac,bbdf4a3..c3ac1c7 --- a/MANIFEST.in +++ b/MANIFEST.in @@@ -1,6 -1,6 +1,6 @@@ -include LICENSE +include LICENSE CHANGELOG recursive-include postman/locale *.po *.mo -recursive-include postman/medias * +recursive-include postman/static * recursive-include postman/templates *.html *.txt graft docs --prune docs/_build ++prune docs/_build diff --cc postman/templates/postman/base.html index 3633211,061cf3d..8f100f8 --- a/postman/templates/postman/base.html +++ b/postman/templates/postman/base.html @@@ -2,18 -2,12 +2,18 @@@ {% load url from future %} {% load i18n %}{% load postman_tags %} {% block title %}{% trans "Messaging" %}{% endblock %} +{% block extrahead %}{{ block.super }} +{% endblock %} {% block postman_menu %} --{% endblock %} ++{% endblock %} diff --cc postman/templates/postman/base_write.html index 8611709,e188e48..a7a3892 --- a/postman/templates/postman/base_write.html +++ b/postman/templates/postman/base_write.html @@@ -33,4 -21,4 +33,4 @@@ --{% endblock %} ++{% endblock %} diff --cc postman/tests.py index 400da37,ed96f4c..c8ffa3e --- a/postman/tests.py +++ b/postman/tests.py @@@ -1295,12 -1295,12 +1295,21 @@@ class MessageTest(BaseTest) def test_notification_rejection_user(self): "Test notify_users() for rejection, sender is a User." ++<<<<<<< HEAD m = Message.objects.create(subject='s', moderation_status=STATUS_REJECTED, sender = self.user1, recipient=self.user2) self.check_notification(m, 1, self.user1.email, is_auto_moderated=False, notice_label='postman_rejection') def test_notification_rejection_user_auto_moderated(self): "Test notify_users() for rejection, sender is a User, and is alerted online." m = Message.objects.create(subject='s', moderation_status=STATUS_REJECTED, sender = self.user1, recipient=self.user2) ++======= ++ m = Message.objects.create(subject='s', moderation_status=STATUS_REJECTED, sender = self.user1, recipient=self.user2) ++ self.check_notification(m, 1, self.user1.email, is_auto_moderated=False, notice_label='postman_rejection') ++ ++ def test_notification_rejection_user_auto_moderated(self): ++ "Test notify_users() for rejection, sender is a User, and is alerted online." ++ m = Message.objects.create(subject='s', moderation_status=STATUS_REJECTED, sender = self.user1, recipient=self.user2) ++>>>>>>> dcea2b745ee6fac6ad1721470356616cc4db68fd self.check_notification(m, 0, is_auto_moderated=True) def test_notification_rejection_user_inactive(self): diff --cc postman/utils.py index d9a2c98,18a2877..eeaf998 --- a/postman/utils.py +++ b/postman/utils.py @@@ -24,11 -24,11 +24,14 @@@ name = getattr(settings, 'POSTMAN_MAILE if name and name in settings.INSTALLED_APPS: send_mail = __import__(name, globals(), locals(), ['send_mail']).send_mail else: - from django.core.mail import send_mail + from django.core.mail import send_mail, mail_admins + + # to disable email notification to users + DISABLE_USER_EMAILING = getattr(settings, 'POSTMAN_DISABLE_USER_EMAILING', False) +# to disable email notification to users +DISABLE_USER_EMAILING = getattr(settings, 'POSTMAN_DISABLE_USER_EMAILING', False) + # default wrap width; referenced in forms.py WRAP_WIDTH = 55 @@@ -88,8 -89,8 +92,9 @@@ def notify_user(object, action) else: return if notification: - notification.send(users=[user], label=label, extra_context={'message': object, 'action': action}) + # the context key 'message' is already used in django-notification/models.py/send_now() (v0.2.0) + notification.send(users=[user], label=label, extra_context={'pm_message': object, 'pm_action': action}) else: - if not DISABLE_USER_EMAILING and user.email: - email('postman/email_user_subject.txt', 'postman/email_user.txt',[user.email], object, action) + if not DISABLE_USER_EMAILING and user.email and user.is_active: + email('postman/email_user_subject.txt', 'postman/email_user.txt', [user.email], object, action) +