Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/better_notification_mail into lp:widelands-website

2018-02-21 Thread kaputtnik
Merged and deployed
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/better_notification_mail/+merge/335028
Your team Widelands Developers is subscribed to branch lp:widelands-website.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/better_notification_mail into lp:widelands-website

2018-02-21 Thread noreply
The proposal to merge 
lp:~widelands-dev/widelands-website/better_notification_mail into 
lp:widelands-website has been updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands-website/better_notification_mail/+merge/335028
-- 
Your team Widelands Developers is subscribed to branch lp:widelands-website.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/better_notification_mail into lp:widelands-website

2018-02-15 Thread GunChleoc
There's a typo in the subject now: was send -> was sent

I got the 2 notifications for the messages.
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/better_notification_mail/+merge/335028
Your team Widelands Developers is subscribed to branch lp:widelands-website.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/better_notification_mail into lp:widelands-website

2018-02-15 Thread kaputtnik
Thanks for testing :-)

The subject on private messages should work now. I forgot that django_messages 
ships his own short.txt (used for the subject).

I send you a PM reply  and a new PM. If this is ok it can go in, imho.

Shut off the alpha site for now.
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/better_notification_mail/+merge/335028
Your team Widelands Developers is subscribed to branch lp:widelands-website.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/better_notification_mail into lp:widelands-website

2018-02-15 Thread GunChleoc
PM to myself just says "by GunChleoc" in the subject. It should read "X sent 
you a message on Widelands" or something.
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/better_notification_mail/+merge/335028
Your team Widelands Developers is subscribed to branch lp:widelands-website.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/better_notification_mail into lp:widelands-website

2018-02-15 Thread GunChleoc
I have added a few posts to the alpha site and uploaded a map.
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/better_notification_mail/+merge/335028
Your team Widelands Developers is subscribed to branch lp:widelands-website.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/better_notification_mail into lp:widelands-website

2018-02-04 Thread kaputtnik
Ooops, sorry for spamming you with emails. I just forgot that ./manage.py 
emit_notices must be called by hand on the alpha site and wrote post after 
post, wondering that no emails get send :-S


-- 
https://code.launchpad.net/~widelands-dev/widelands-website/better_notification_mail/+merge/335028
Your team Widelands Developers is subscribed to branch lp:widelands-website.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/better_notification_mail into lp:widelands-website

2018-02-04 Thread kaputtnik
Review: Resubmit

alpha site is running with database django_18 now, so only the 8 registered 
people in this database may get emails and not the people from the old alpha 
database.
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/better_notification_mail/+merge/335028
Your team Widelands Developers is subscribed to branch lp:widelands-website.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/better_notification_mail into lp:widelands-website

2018-02-03 Thread kaputtnik
Review: Needs Fixing

Some parts aren't fine. E.g. the email subject when replying to a pm.
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/better_notification_mail/+merge/335028
Your team Widelands Developers is subscribed to branch lp:widelands-website.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/better_notification_mail into lp:widelands-website

2018-01-28 Thread SirVer
Review: Approve

lgtm. not tested though.
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/better_notification_mail/+merge/335028
Your team Widelands Developers is subscribed to branch lp:widelands-website.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/better_notification_mail into lp:widelands-website

2018-01-14 Thread kaputtnik
I've made a failure recently by updating django-messages to a wrong version.

https://wl.widelands.org/forum/topic/4196/

I fixed it in trunk and also in this branch, which means we need to keep the 
templates in 

templates/notification/messages_*/full_text
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/better_notification_mail/+merge/335028
Your team Widelands Developers is subscribed to branch lp:widelands-website.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/better_notification_mail into lp:widelands-website

2018-01-04 Thread GunChleoc
Code LGTM as far as I can tell.

I might be available sometime next week to do some testing.
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/better_notification_mail/+merge/335028
Your team Widelands Developers is subscribed to branch lp:widelands-website.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/better_notification_mail into lp:widelands-website

2018-01-04 Thread kaputtnik
Review: Resubmit

I had forgotten to update the packages of the virtual environment the last 
time. Did this now. The content of email send by django-messages are defined by 
django-messages itself, so the old templates 
(templates/notification/messages_*.txt) are obsolete and i have removed them in 
this branch.

django messages uses this template:

http://bazaar.launchpad.net/~widelands-dev/widelands-website/trunk/view/head:/templates/django_messages/new_message.html
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/better_notification_mail/+merge/335028
Your team Widelands Developers is subscribed to branch lp:widelands-website.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/better_notification_mail into lp:widelands-website

2018-01-02 Thread kaputtnik
Review: Needs Fixing

I found a bug in this code which needs fixing.
-- 
https://code.launchpad.net/~widelands-dev/widelands-website/better_notification_mail/+merge/335028
Your team Widelands Developers is subscribed to branch lp:widelands-website.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/better_notification_mail into lp:widelands-website

2017-12-11 Thread kaputtnik
kaputtnik has proposed merging 
lp:~widelands-dev/widelands-website/better_notification_mail into 
lp:widelands-website.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #340920 in Widelands Website: "wiki change notification mail is very 
sparse"
  https://bugs.launchpad.net/widelands-website/+bug/340920
  Bug #1736263 in Widelands Website: "notification to user of user's posts"
  https://bugs.launchpad.net/widelands-website/+bug/1736263

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands-website/better_notification_mail/+merge/335028

Fixes bug 1736263

Do not send emails to the one who

- creates a new topic
- replied to a topic
- uploaded a new map

Reworked the content of send emails. For the wiki it contains now the user who 
edited an article and a link to the last changeset, which shows the changes, 
e.g. https://wl.widelands.org/wiki/history/Main%20Page/changeset/94/. This will 
fix bug 340920 

Removed filter 'custom_date' from wiki feeds, to get a normal date format.

This should may be tested on the alpha site.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands-website/better_notification_mail into 
lp:widelands-website.
=== modified file 'notification/models.py'
--- notification/models.py	2017-05-07 09:51:15 +
+++ notification/models.py	2017-12-11 13:12:44 +
@@ -40,7 +40,9 @@
 class NoticeType(models.Model):
 
 label = models.CharField(_('label'), max_length=40)
-display = models.CharField(_('display'), max_length=50)
+display = models.CharField(_('display'),
+   max_length=50,
+   help_text=_('Used as subject when sending emails.'))
 description = models.CharField(_('description'), max_length=100)
 
 # by default only on for media with sensitivity less than or equal to this
@@ -101,14 +103,22 @@
 setting.save()
 return setting
 
+
 def should_send(user, notice_type, medium):
 return get_notification_setting(user, notice_type, medium).send
 
-def get_observers_for(notice_type):
-""" Returns the list of users which wants to get a message (email) for this
+
+def get_observers_for(notice_type, excl_user=None):
+"""Returns the list of users which wants to get a message (email) for this
 type of notice."""
-settings = NoticeSetting.objects.filter(notice_type__label=notice_type).filter(send=True)
-return [s.user for s in NoticeSetting.objects.filter(notice_type__label=notice_type).filter(send=True)]
+query = NoticeSetting.objects.filter(
+notice_type__label=notice_type, send=True)
+
+if excl_user:
+query = query.exclude(user=excl_user)
+
+return [notice_setting.user for notice_setting in query]
+
 
 class NoticeQueueBatch(models.Model):
 """A queued notice.
@@ -244,6 +254,8 @@
 'user': user,
 'notices_url': notices_url,
 'current_site': current_site,
+'subject': notice_type.display,
+'description': notice_type.description,
 })
 context.update(extra_context)
 

=== modified file 'pybb/views.py'
--- pybb/views.py	2017-11-26 10:57:35 +
+++ pybb/views.py	2017-12-11 13:12:44 +
@@ -178,14 +178,20 @@
 if notification:
 if not topic:
 # Inform subscribers of a new topic
-notification.send(notification.get_observers_for('forum_new_topic'), 'forum_new_topic',
-  {'topic': post.topic, 'post': post, 'user': post.topic.user}, queue = True)
+subscribers = notification.get_observers_for('forum_new_topic',
+ excl_user=request.user)
+notification.send(subscribers, 'forum_new_topic',
+  {'topic': post.topic,
+   'post': post,
+   'user': post.topic.user
+   },
+  queue = True)
 # Topics author is subscriber for all new posts in his topic
 post.topic.subscribers.add(request.user)
 
 else:
 # Send mails about a new post to topic subscribers
-notification.send(post.topic.subscribers.all(), 'forum_new_post',
+notification.send(post.topic.subscribers.exclude(username=post.user), 'forum_new_post',
   {'post': post, 'topic': topic, 'user': post.user}, queue = True)
 
 return HttpResponseRedirect(post.get_absolute_url())

=== modified file 'templates/notification/email_body.txt'
--- templates/notification/email_body.txt	2017-04-17 14:34:48 +
+++ templates/notification/email_body.txt	2017-12-11