Fix test_emails command and add some missed emails
parent
363c9432f5
commit
282b964bd3
|
@ -23,12 +23,16 @@ from django.contrib.auth import get_user_model
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from taiga.base.mails import InlineCSSTemplateMail
|
||||||
from taiga.base.mails import mail_builder
|
from taiga.base.mails import mail_builder
|
||||||
|
|
||||||
from taiga.projects.models import Project, Membership
|
from taiga.projects.models import Project, Membership
|
||||||
from taiga.projects.history.models import HistoryEntry
|
from taiga.projects.history.models import HistoryEntry
|
||||||
from taiga.projects.history.services import get_history_queryset_by_model_instance
|
from taiga.projects.history.services import get_history_queryset_by_model_instance
|
||||||
|
|
||||||
|
from taiga.users.services import get_user_photo_url
|
||||||
|
from taiga.front.templatetags.functions import resolve as resolve_front_url
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = 'Send an example of all emails'
|
help = 'Send an example of all emails'
|
||||||
|
@ -186,18 +190,17 @@ class Command(BaseCommand):
|
||||||
email = cls()
|
email = cls()
|
||||||
email.send(email_address, context)
|
email.send(email_address, context)
|
||||||
|
|
||||||
|
|
||||||
# Transfer Emails
|
# Transfer Emails
|
||||||
context = {
|
context = {
|
||||||
"project": Project.objects.all().order_by("?").first(),
|
"project": Project.objects.all().order_by("?").first(),
|
||||||
"requester": User.objects.all().order_by("?").first(),
|
"requester": get_user_model().objects.all().order_by("?").first(),
|
||||||
}
|
}
|
||||||
email = mail_builder.transfer_request(email_address, context)
|
email = mail_builder.transfer_request(email_address, context)
|
||||||
email.send()
|
email.send()
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
"project": Project.objects.all().order_by("?").first(),
|
"project": Project.objects.all().order_by("?").first(),
|
||||||
"receiver": User.objects.all().order_by("?").first(),
|
"receiver": get_user_model().objects.all().order_by("?").first(),
|
||||||
"token": "test-token",
|
"token": "test-token",
|
||||||
"reason": "Test reason"
|
"reason": "Test reason"
|
||||||
}
|
}
|
||||||
|
@ -206,8 +209,8 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
"project": Project.objects.all().order_by("?").first(),
|
"project": Project.objects.all().order_by("?").first(),
|
||||||
"old_owner": User.objects.all().order_by("?").first(),
|
"old_owner": get_user_model().objects.all().order_by("?").first(),
|
||||||
"new_owner": User.objects.all().order_by("?").first(),
|
"new_owner": get_user_model().objects.all().order_by("?").first(),
|
||||||
"reason": "Test reason"
|
"reason": "Test reason"
|
||||||
}
|
}
|
||||||
email = mail_builder.transfer_accept(email_address, context)
|
email = mail_builder.transfer_accept(email_address, context)
|
||||||
|
@ -215,8 +218,66 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
"project": Project.objects.all().order_by("?").first(),
|
"project": Project.objects.all().order_by("?").first(),
|
||||||
"rejecter": User.objects.all().order_by("?").first(),
|
"rejecter": get_user_model().objects.all().order_by("?").first(),
|
||||||
"reason": "Test reason"
|
"reason": "Test reason"
|
||||||
}
|
}
|
||||||
email = mail_builder.transfer_reject(email_address, context)
|
email = mail_builder.transfer_reject(email_address, context)
|
||||||
email.send()
|
email.send()
|
||||||
|
|
||||||
|
|
||||||
|
# Contact with project admins email
|
||||||
|
project = Project.objects.all().order_by("?").first()
|
||||||
|
user = get_user_model().objects.all().order_by("?").first()
|
||||||
|
context = {
|
||||||
|
"full_name": user.get_full_name(),
|
||||||
|
"project_name": project.name,
|
||||||
|
"photo_url": get_user_photo_url(user),
|
||||||
|
"user_profile_url": resolve_front_url("user", user.username),
|
||||||
|
"project_settings_url": resolve_front_url("project-admin", project.slug),
|
||||||
|
"comment": "Test comment notification."
|
||||||
|
}
|
||||||
|
email = mail_builder.contact_notification(email_address, context)
|
||||||
|
email.send()
|
||||||
|
|
||||||
|
# GitHub importer email
|
||||||
|
context = {
|
||||||
|
"project": Project.objects.all().order_by("?").first(),
|
||||||
|
"user": get_user_model().objects.all().order_by("?").first()
|
||||||
|
}
|
||||||
|
email = mail_builder.github_import_success(email_address, context)
|
||||||
|
email.send()
|
||||||
|
|
||||||
|
# Jira importer email
|
||||||
|
context = {
|
||||||
|
"project": Project.objects.all().order_by("?").first(),
|
||||||
|
"user": get_user_model().objects.all().order_by("?").first()
|
||||||
|
}
|
||||||
|
email = mail_builder.jira_import_success(email_address, context)
|
||||||
|
email.send()
|
||||||
|
|
||||||
|
# Trello importer email
|
||||||
|
context = {
|
||||||
|
"project": Project.objects.all().order_by("?").first(),
|
||||||
|
"user": get_user_model().objects.all().order_by("?").first()
|
||||||
|
}
|
||||||
|
email = mail_builder.trello_import_success(email_address, context)
|
||||||
|
email.send()
|
||||||
|
|
||||||
|
# Asana importer email
|
||||||
|
context = {
|
||||||
|
"project": Project.objects.all().order_by("?").first(),
|
||||||
|
"user": get_user_model().objects.all().order_by("?").first()
|
||||||
|
}
|
||||||
|
email = mail_builder.asana_import_success(email_address, context)
|
||||||
|
email.send()
|
||||||
|
|
||||||
|
# Error importer email
|
||||||
|
context = {
|
||||||
|
"user": get_user_model().objects.all().order_by("?").first(),
|
||||||
|
"error_subject": "Error importing GitHub project",
|
||||||
|
"error_message": "Error importing GitHub project",
|
||||||
|
"project": 1234,
|
||||||
|
"exception": "Exception message"
|
||||||
|
}
|
||||||
|
email = mail_builder.importer_import_error(email_address, context)
|
||||||
|
email.send()
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<img style="vertical-align:middle;" src="{{ photo_url }}" alt="{{ full_name }}" width="60"/>
|
<img style="vertical-align:middle;" src="{{ photo_url }}" alt="{{ full_name }}" width="60"/>
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% trans full_name=full_name, comment=comment, project_name=project_name %}
|
{% trans full_name=full_name, user_profile_url=user_profile_url, project_name=project_name %}
|
||||||
<a style="font-weight: bold;text-decoration:none;color:#222;" href="{{ user_profile_url }}" title="{{ full_name }}">{{ full_name }}</a> has written to {{ project_name }}
|
<a style="font-weight: bold;text-decoration:none;color:#222;" href="{{ user_profile_url }}" title="{{ full_name }}">{{ full_name }}</a> has written to {{ project_name }}
|
||||||
{% endtrans %}
|
{% endtrans %}
|
||||||
</p>
|
</p>
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{% trans project_name=project_name %}
|
{% trans project_name=project_name, project_settings_url=project_settings_url %}
|
||||||
You are receiving this message because you are listed as administrator of the project titled {{ project_name }}. If you don't want members of the Taiga community contacting your project, please <a href="{{ project_settings_url }}">update your project settings</a> to prevent such contacts. Regular communications amongst members of the project will not be affected.
|
You are receiving this message because you are listed as administrator of the project titled {{ project_name }}. If you don't want members of the Taiga community contacting your project, please <a href="{{ project_settings_url }}">update your project settings</a> to prevent such contacts. Regular communications amongst members of the project will not be affected.
|
||||||
{% endtrans %}
|
{% endtrans %}
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Reference in New Issue