diff --git a/HISTORY.rst b/HISTORY.rst index 27d885646f..bee71a8699 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -265,6 +265,9 @@ * Show a null mailer backend if there is backend with an invalid path. Due to the app full path change, existing mailer setups need to be recreated. +* The document link URL when mailed is now composed of the + COMMON_PROJECT_URL + document URL instead of the Site + domain. 3.1.11 (2019-04-XX) =================== diff --git a/docs/releases/3.2.rst b/docs/releases/3.2.rst index eeeaa75b91..0261c59ea6 100644 --- a/docs/releases/3.2.rst +++ b/docs/releases/3.2.rst @@ -575,6 +575,9 @@ Other changes * Show a null mailer backend if there is backend with an invalid path. Due to the app full path change, existing mailer setups need to be recreated. +* The document link URL when mailed is now composed of the + COMMON_PROJECT_URL + document URL instead of the Site + domain. Removals diff --git a/mayan/apps/mailer/models.py b/mayan/apps/mailer/models.py index fb9e638826..c9d19dd183 100644 --- a/mayan/apps/mailer/models.py +++ b/mayan/apps/mailer/models.py @@ -3,7 +3,8 @@ from __future__ import unicode_literals import json import logging -from django.contrib.sites.models import Site +from furl import furl + from django.core import mail from django.db import models, transaction from django.template import Context, Template @@ -11,6 +12,8 @@ from django.utils.html import strip_tags from django.utils.module_loading import import_string from django.utils.translation import ugettext_lazy as _ +from mayan.apps.common.settings import setting_project_url + from .classes import NullBackend from .events import event_email_sent from .managers import UserMailerManager @@ -174,10 +177,9 @@ class UserMailer(models.Model): Send a document using this user mailing profile. """ context_dictionary = { - 'link': 'http://%s%s' % ( - Site.objects.get_current().domain, + 'link': furl(setting_project_url.value).join( document.get_absolute_url() - ), + ).tostr(), 'document': document }