Skip to content
This repository has been archived by the owner on Nov 7, 2019. It is now read-only.

Commit

Permalink
Merge 654c4ce into d4c4f98
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzylogic2000 committed Sep 23, 2019
2 parents d4c4f98 + 654c4ce commit 3198307
Show file tree
Hide file tree
Showing 26 changed files with 350 additions and 82 deletions.
4 changes: 4 additions & 0 deletions apps/actions/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def ready(self):
('a4_candy_ideas', 'idea'),
('a4_candy_mapideas', 'mapidea')
)
configure_type(
'offlineevent',
('a4_candy_offlineevents', 'offlineevent')
)

configure_icon('far fa-comment', type='comment')
configure_icon('far fa-lightbulb', type='item')
Expand Down
26 changes: 17 additions & 9 deletions apps/notifications/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def get_context(self):
return context


class NotifyFollowersOnPhaseIsOverSoonEmail(Email):
class NotifyFollowersOnPhaseStartedEmail(Email):
template_name = 'a4_candy_notifications/emails' \
'/notify_followers_over_soon'
'/notify_followers_phase_started'

def get_receivers(self):
action = self.object
Expand All @@ -108,9 +108,9 @@ def get_receivers(self):
return receivers


class NotifyFollowersOnNewItemCreated(Email):
template_name = \
'a4_candy_notifications/emails/notify_followers_new_item'
class NotifyFollowersOnPhaseIsOverSoonEmail(Email):
template_name = 'a4_candy_notifications/emails' \
'/notify_followers_phase_over_soon'

def get_receivers(self):
action = self.object
Expand All @@ -119,10 +119,18 @@ def get_receivers(self):
follow__enabled=True,
)
receivers = _exclude_notifications_disabled(receivers)
receivers = _exclude_actor(receivers, action.actor)
receivers = _exclude_moderators(receivers, action)
return receivers

if hasattr(action.target, 'creator'):
receivers = _exclude_actor(receivers, action.target.creator)

class NotifyFollowersOnUpcommingEventEmail(Email):
template_name = 'a4_candy_notifications/emails' \
'/notify_followers_event_upcomming'

def get_receivers(self):
action = self.object
receivers = User.objects.filter(
follow__project=action.project,
follow__enabled=True,
)
receivers = _exclude_notifications_disabled(receivers)
return receivers
11 changes: 8 additions & 3 deletions apps/notifications/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ def send_notifications(instance, created, **kwargs):

if action.project:
emails.NotifyModeratorsEmail.send(action)
emails.NotifyFollowersOnNewItemCreated.send(action)

elif action.type == 'phase' and verb == Verbs.SCHEDULE:
emails.NotifyFollowersOnPhaseIsOverSoonEmail.send(action)
elif action.type == 'phase':
if verb == Verbs.START:
emails.NotifyFollowersOnPhaseStartedEmail.send(action)
elif verb == Verbs.SCHEDULE:
emails.NotifyFollowersOnPhaseIsOverSoonEmail.send(action)

elif action.type == 'offlineevent' and verb == Verbs.START:
emails.NotifyFollowersOnUpcommingEventEmail.send(action)


@receiver(dashboard_signals.project_created)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@

{% block subject %}Neue Reaktion auf Ihren Beitrag auf {{ site.name }}{% endblock %}

{% block headline %}{{ action.actor.username }} hat auf Ihren Beitrag reagiert{% endblock %}
{% block headline %}Reaktion auf Ihren Beitrag{% endblock %}
{% block sub-headline %}{{ action.project.name }}{% endblock %}

{% block content %}{{ action.actor.username }} hat auf Ihren Beitrag reagiert. Schauen Sie nach, was in Ihrem Beitrag aktuell passiert.{% endblock %}
{% block greeting %}Hallo {{ receiver.username }},{% endblock %}

{% block content %}{{ action.actor.username }} hat Ihren Beitrag kommentiert:
{% if action.obj.comment %}
{{ action.obj.comment }}
{% endif %}
Möchten Sie antworten?{% endblock %}

{% block cta_url %}{% if action.target.get_absolute_url %}{{ email.get_host }}{{ action.target.get_absolute_url }}{% else %}{{ email.get_host }}{{ action.project.get_absolute_url }}{% endif %}{% endblock %}
{% block cta_label %}{% if action.target.get_absolute_url %}Beitrag anzeigen{% else %}Projekt anzeigen{% endif %}{% endblock %}

{% block reason %}Diese E-Mail wurde an {{ receiver.email }} gesendet. Die E-Mail wurde an Sie gesendet, da Sie einen Beitrag in einem Projekt erstellt haben. Wenn Sie diese E-Mails nicht länger erhalten möchten, können Sie dem Projekt auf der Projektseite entfolgen oder Benachrichtigungen in Ihren Benutzerkonto Einstellungen komplett deaktivieren.{% endblock %}
{% block reason %}Diese E-Mail wurde an {{ receiver.email }} gesendet. Sie haben die E-Mail erhalten, weil Sie einen Beitrag in einem Projekt erstellt haben. Wenn Sie keine Benachrichtigungen mehr erhalten möchten, ändern Sie die Einstellungen zu Ihrem <a href="{{ email.get_host }}{% url 'account' %}">Account</a>.{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@

{% block subject %}A {{ action.obj | verbose_name }} was added to your {{ action.target | verbose_name }}{% endblock %}

{% block headline %}{{ action.actor.username }} created a {{ action.obj | verbose_name }} on your {{ action.target | verbose_name }}{% endblock %}
{% block headline %}Reaction to your contribution{% endblock %}
{% block sub-headline %}{{ action.project.name }}{% endblock %}

{% block content %}On your {{ action.target | verbose_name }}{% if action.target.title %} "{{ action.target.title }}"{% endif %} a {{ action.obj | verbose_name }} was added by {{ action.actor.username }}. Checkout what happend on{% if action.target.get_absolute_url %} your {{ action.target | verbose_name }}{% else %} the project "{{ action.project.name }}"{% endif %} on {{ site.name }} by clicking the {% if part_type == 'txt' %}link{% else %}button{% endif %} below.{% endblock %}
{% block greeting %}Hello {{ receiver.username }},{% endblock %}

{% block content %}{{ action.actor.username }} commented on your post:
{% if action.obj.comment %}
{{ action.obj.comment }}
{% endif %}
Would you like to answer?{% endblock %}

{% block cta_url %}{% if action.target.get_absolute_url %}{{ email.get_host }}{{ action.target.get_absolute_url }}{% else %}{{ email.get_host }}{{ action.project.get_absolute_url }}{% endif %}{% endblock %}
{% block cta_label %}{% if action.target.get_absolute_url %}Check your {{ action.target | verbose_name }}{% else %}Visit the project{% endif %}{% endblock %}
{% block cta_label %}{% if action.target.get_absolute_url %}View Post{% else %}Visit the project{% endif %}{% endblock %}

{% block reason %}This email was sent to {{ receiver.email }}. This email was sent to you because you created content in a project. If you don’t want to receive these notifications anymore, you can unfollow the project on the project page or disable notifications completely in your account settings.{% endblock %}
{% block reason %}This email was sent to {{ receiver.email }}. You have received the e-mail because you added a contribution to the above project. If you no longer want to receive notifications, change the settings for your <a href="{{ email.get_host }}{% url 'account' %}">account</a>.{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{% block subject %}Rückmeldung zu Ihrem Beitrag auf {{ site.name }}{% endblock %}

{% block headline %}Rückmeldung zu Ihrem Beitrag{% endblock %}
{% block sub-headline %}{{ object.project.name }}{% endblock %}

{% block greeting %}Hallo {{ receiver.username }},{% endblock %}

Expand All @@ -22,4 +23,4 @@ Möchten Sie antworten?
{% block cta_url %}{% if object.get_absolute_url %}{{ email.get_host }}{{ object.get_absolute_url }}{% else %}{{ email.get_host }}{{ object.project.get_absolute_url }}{% endif %}{% endblock %}
{% block cta_label %}{% if object.get_absolute_url %}Beitrag anzeigen{% else %}Projekt anzeigen{% endif %}{% endblock %}

{% block reason %}Diese E-Mail wurde an {{ receiver.email }} gesendet. Die E-Mail wurde an Sie gesendet, da Sie einen Beitrag in einem Projekt erstellt haben. Wenn Sie diese E-Mails nicht länger erhalten möchten, können Sie dem Projekt auf der Projektseite entfolgen oder Benachrichtigungen in Ihren Benutzerkonto Einstellungen komplett deaktivieren.{% endblock %}
{% block reason %}Diese E-Mail wurde an {{ receiver.email }} gesendet. Sie haben die E-Mail erhalten, weil Sie einen Beitrag in einem Projekt erstellt haben. Wenn Sie keine Benachrichtigungen mehr erhalten möchten, ändern Sie die Einstellungen zu Ihrem <a href="{{ email.get_host }}{% url 'account' %}">Account</a>.{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{% block subject %}Feedback for your contribution on {{ site.name }}{% endblock %}

{% block headline %}Feedback for your contribution{% endblock %}
{% block sub-headline %}{{ object.project.name }}{% endblock %}

{% block greeting %}Hello {{ receiver.username }},{% endblock %}

Expand All @@ -19,7 +20,7 @@
Do you want to answer?
{% endblock %}

{% block cta_url %}{% if object.get_absolute_url %}{{ email.get_host }}{{ object.get_absolute_url }}{% else %}{{ email.get_host }}{{ object.project.get_absolute_url }}{% endif %}{% endblock %}
{% if object.get_absolute_url %}{{ email.get_host }}{{ object.get_absolute_url }}{% else %}{{ email.get_host }}{{ object.project.get_absolute_url }}{% endif %}{% endblock %}
{% block cta_label %}{% if object.get_absolute_url %}Check your contribution{% else %}Visit the project{% endif %}{% endblock %}

{% block reason %}This email was sent to {{ receiver.email }}. This email was sent to you because you created content in a project. If you don’t want to receive these notifications anymore, you can unfollow the project on the project page or disable notifications completely in your account settings.{% endblock %}
{% block reason %}This email was sent to {{ receiver.email }}. You have received the e-mail because you added a contribution to the above project. If you no longer want to receive notifications, change the settings for your <a href="{{ email.get_host }}{% url 'account' %}">account</a>.{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends 'email_base.'|add:part_type %}

{% block subject %}{{ action.project.name }} startet jetzt!{% endblock %}

{% block headline %}Verstaltung{% endblock %}
{% block sub-headline %}{{ action.project.name }}{% endblock %}

{% block greeting %}Hallo {{ receiver.username }},{% endblock %}

{% block content %}am {{ action.obj.date }} findet die folgende Veranstaltung statt:
<b>{{ action.obj.name }}</b>
Weitere Informationen zu der Veranstaltung finden Sie im Projekt.{% endblock %}

{% block cta_url %}{{ email.get_host }}{{ action.obj.module.event.get_absolute_url }}{% endblock %}
{% block cta_label %}Veranstaltung anzeigen{% endblock %}

{% block reason %}Diese E-Mail wurde an {{ receiver.email }} gesendet. Sie haben die E-Mail erhalten, weil Sie oben genanntem Projekt folgen. Wenn Sie keine Benachrichtigungen mehr erhalten möchten, entfolgen Sie dem <a href="{{ email.get_host }}{{ action.project.get_absolute_url }}">Projekt</a> oder ändern Sie die Einstellungen zu Ihrem <a href="{{ email.get_host }}{% url 'account' %}">Account</a>.{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends 'email_base.'|add:part_type %}

{% block subject %}{{ action.project.name }} new event!{% endblock %}

{% block headline %}Event{% endblock %}
{% block sub-headline %}{{ action.project.name }}{% endblock %}

{% block greeting %}Hello {{ receiver.username }},{% endblock %}

{% block content %}The following event takes place on {{ action.obj.date }}:
<b>{{ action.obj.name }}</b>
Further information about the event can be found in the project.{% endblock %}

{% block cta_url %}{{ email.get_host }}{{ action.obj.module.event.get_absolute_url }}{% endblock %}
{% block cta_label %}Show Event{% endblock %}

{% block reason %}This email was sent to {{ receiver.email }}. You have received the e-mail because you are following the above project. If you no longer want to receive notifications, unsubscribe from the <a href="{{ email.get_host }}{{ action.project.get_absolute_url }}">project</a> or change the settings for your <a href="{{ email.get_host }}{% url 'account' %}">account</a>.{% endblock %}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends 'email_base.'|add:part_type %}
{% load verbose_name %}

{% block subject %}Beteiligung endet bald für {{ action.project.name }}{% endblock %}

{% block headline %}Beteiligung endet bald!{% endblock %}
{% block sub-headline %}{{ action.project.name }}{% endblock %}

{% block greeting %}Hallo {{ receiver.username }},{% endblock %}

{% block content %}die Online-Beteiligung im oben genannten Projekt endet bald.
<b>Sie können noch bis zum {{ action.obj.end_date }} Uhr daran teilnehmen.</b>{% endblock %}

{% block cta_url %}{{ email.get_host }}{{ action.obj.module.get_absolute_url }}{% endblock %}
{% block cta_label %}Jetzt mitmachen{% endblock %}

{% block reason %}Diese E-Mail wurde an {{ receiver.email }} gesendet. Sie haben die E-Mail erhalten, weil Sie oben genanntem Projekt folgen. Wenn Sie keine Benachrichtigungen mehr erhalten möchten, entfolgen Sie dem <a href="{{ email.get_host }}{{ action.project.get_absolute_url }}">Projekt</a> oder ändern Sie die Einstellungen zu Ihrem <a href="{{ email.get_host }}{% url 'account' %}">Account</a>.{% endblock %}

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends 'email_base.'|add:part_type %}
{% load verbose_name %}

{% block subject %}Participation ends soon for {{ action.project.name }}{% endblock %}

{% block headline %}Participation ends soon!{% endblock %}
{% block sub-headline %}{{ action.project.name }}{% endblock %}

{% block greeting %}Hello {{ receiver.username }},{% endblock %}

{% block content %}the online participation in the above mentioned project will end soon.
<b>You can still participate until {{ action.obj.end_date }}.</b>{% endblock %}

{% block cta_url %}{{ email.get_host }}{{ action.obj.module.get_absolute_url }}{% endblock %}
{% block cta_label %}Join now{% endblock %}

{% block reason %}This email was sent to {{ receiver.email }}. You have received the e-mail because you are following the above project. If you no longer want to receive notifications, unsubscribe from the <a href="{{ email.get_host }}{{ action.project.get_absolute_url }}">project</a> or change the settings for your <a href="{{ email.get_host }}{% url 'account' %}">account</a>.{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% extends 'email_base.'|add:part_type %}

{% block subject %}{{ action.project.name }} startet jetzt!{% endblock %}

{% block headline %}Los geht’s!{% endblock %}
{% block sub-headline %}{{ action.project.name }}{% endblock %}

{% block greeting %}Hallo {{ receiver.username }},{% endblock %}

{% block content %}die Online-Beteiligung im oben genannten Projekt hat begonnen.
<b>Sie können bis zum {{ action.obj.end_date }} Uhr daran teilnehmen.</b>{% endblock %}

{% block cta_url %}{{ email.get_host }}{{ action.obj.module.get_absolute_url }}{% endblock %}
{% block cta_label %}Join now{% endblock %}

{% block reason %}Diese E-Mail wurde an {{ receiver.email }} gesendet. Sie haben die E-Mail erhalten, weil Sie oben genanntem Projekt folgen. Wenn Sie keine Benachrichtigungen mehr erhalten möchten, entfolgen Sie dem <a href="{{ email.get_host }}{{ action.project.get_absolute_url }}">Projekt</a> oder ändern Sie die Einstellungen zu Ihrem <a href="{{ email.get_host }}{% url 'account' %}">Account</a>.{% endblock %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% extends 'email_base.'|add:part_type %}

{% block subject %}{{ action.project.name }} startet jetzt!{% endblock %}

{% block headline %}Here we go!{% endblock %}
{% block sub-headline %}{{ action.project.name }}{% endblock %}

{% block greeting %}Hello {{ receiver.username }},{% endblock %}

{% block content %}Online participation for the above project has started.
<b>You can participate untill {{ action.obj.end_date }}.</b>{% endblock %}

{% block cta_url %}{{ email.get_host }}{{ action.obj.module.get_absolute_url }}{% endblock %}
{% block cta_label %}Join now{% endblock %}

{% block reason %}This email was sent to {{ receiver.email }}. You have received the e-mail because you are following the above project. If you no longer want to receive notifications, unsubscribe from the <a href="{{ email.get_host }}{{ action.project.get_absolute_url }}">project</a> or change the settings for your <a href="{{ email.get_host }}{% url 'account' %}">account</a>.{% endblock %}
Empty file.
Loading

0 comments on commit 3198307

Please sign in to comment.