Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make email notifications opt-in - fix 433 when deployed #439

Merged
merged 1 commit into from
Mar 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions optin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import os, sys

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "valuenetwork.settings")

import django
django.setup()


from pinax.notifications import models as notification

nts = notification.NoticeType.objects.all()

for nt in nts:
nt.default = 0
nt.save()

print ""
print "changed ", nts.count(), "NoticeType defaults to 0."

nsets = notification.NoticeSetting.objects.all()

for nset in nsets:
nset.send = False
nset.save()

print "changed ", nsets.count(), "NoticeSetting send flags to False."
print "This turns off all email notifications."

3 changes: 3 additions & 0 deletions valuenetwork/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@


PINAX_NOTIFICATIONS_QUEUE_ALL = True
PINAX_NOTIFICATIONS_BACKENDS = [
("email", "pinax.notifications.backends.email.EmailBackend", 1),
]

THUMBNAIL_DEBUG = True

Expand Down
26 changes: 13 additions & 13 deletions valuenetwork/valueaccounting/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
def create_notice_types(sender, **kwargs):
if "pinax.notifications" in settings.INSTALLED_APPS:
from pinax.notifications import models as notification
notification.NoticeType.create("valnet_join_task", _("Join Task"), _("a colleaque wants to help with this task"), default=2)
notification.NoticeType.create("valnet_help_wanted", _("Help Wanted"), _("a colleague requests help that fits your skills"), default=2)
notification.NoticeType.create("valnet_new_task", _("New Task"), _("a new task was posted that fits your skills"), default=2)
notification.NoticeType.create("valnet_new_todo", _("New Todo"), _("a new todo was posted that is assigned to you"), default=2)
notification.NoticeType.create("valnet_deleted_todo", _("Deleted Todo"), _("a todo that was assigned to you has been deleted"), default=2)
notification.NoticeType.create("valnet_distribution", _("New Distribution"), _("you have received a new income distribution"), default=2)
notification.NoticeType.create("valnet_payout_request", _("Payout Request"), _("you have received a new payout request"), default=2)
notification.NoticeType.create("work_membership_request", _("Freedom Coop Membership Request"), _("we have received a new membership request"), default=2)
notification.NoticeType.create("work_join_request", _("Project Join Request"), _("we have received a new join request"), default=2)
notification.NoticeType.create("work_new_account", _("Project New OCP Account"), _("a new OCP account details"), default=2)
notification.NoticeType.create("comment_membership_request", _("Comment in Freedom Coop Membership Request"), _("we have received a new comment in a membership request"), default=2)
notification.NoticeType.create("comment_join_request", _("Comment in Project Join Request"), _("we have received a new comment in a join request"), default=2)
notification.NoticeType.create("work_skill_suggestion", _("Skill suggestion"), _("we have received a new skill suggestion"), default=2)
notification.NoticeType.create("valnet_join_task", _("Join Task"), _("a colleaque wants to help with this task"), default=0)
notification.NoticeType.create("valnet_help_wanted", _("Help Wanted"), _("a colleague requests help that fits your skills"), default=0)
notification.NoticeType.create("valnet_new_task", _("New Task"), _("a new task was posted that fits your skills"), default=0)
notification.NoticeType.create("valnet_new_todo", _("New Todo"), _("a new todo was posted that is assigned to you"), default=0)
notification.NoticeType.create("valnet_deleted_todo", _("Deleted Todo"), _("a todo that was assigned to you has been deleted"), default=0)
notification.NoticeType.create("valnet_distribution", _("New Distribution"), _("you have received a new income distribution"), default=0)
notification.NoticeType.create("valnet_payout_request", _("Payout Request"), _("you have received a new payout request"), default=0)
notification.NoticeType.create("work_membership_request", _("Freedom Coop Membership Request"), _("we have received a new membership request"), default=0)
notification.NoticeType.create("work_join_request", _("Project Join Request"), _("we have received a new join request"), default=0)
notification.NoticeType.create("work_new_account", _("Project New OCP Account"), _("a new OCP account details"), default=0)
notification.NoticeType.create("comment_membership_request", _("Comment in Freedom Coop Membership Request"), _("we have received a new comment in a membership request"), default=0)
notification.NoticeType.create("comment_join_request", _("Comment in Project Join Request"), _("we have received a new comment in a join request"), default=0)
notification.NoticeType.create("work_skill_suggestion", _("Skill suggestion"), _("we have received a new skill suggestion"), default=0)
print "created valueaccounting notice types"
else:
print "Skipping creation of valueaccounting NoticeTypes as notification app not found"
Expand Down