From ce7041fb848909bc898f5343a70d598b0535875d Mon Sep 17 00:00:00 2001 From: Sean Hammond Date: Tue, 4 Dec 2012 17:13:20 +0100 Subject: [PATCH] [#1635] Fix repeat email sending The `since` date wasn't being saved after sending an email to a user, resulting in repeat emails being sent about the same activity. There is a test for this, but for some reason it was working in the tests, just not in production. Don't know why. This seems to fix it in production. --- ckan/lib/email_notifications.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ckan/lib/email_notifications.py b/ckan/lib/email_notifications.py index 75298029104..3b02940ff59 100644 --- a/ckan/lib/email_notifications.py +++ b/ckan/lib/email_notifications.py @@ -134,7 +134,9 @@ def get_and_send_notifications_for_user(user): # FIXME: We are accessing model from lib here but I'm not sure what # else to do unless we add a update_email_last_sent() # logic function which would only be needed by this lib. - model.Dashboard.get(user['id']).email_last_sent = datetime.datetime.now() + dash = model.Dashboard.get(user['id']) + dash.email_last_sent = datetime.datetime.now() + model.repo.commit() def get_and_send_notifications_for_all_users():