add in url to the delete email (bug #622768)
This commit is contained in:
Родитель
c8936c5782
Коммит
ad09596d4d
|
@ -279,6 +279,7 @@ class Addon(amo.models.OnChangeMixin, amo.models.ModelBase):
|
|||
|
||||
@transaction.commit_on_success
|
||||
def delete(self, msg):
|
||||
from amo.helpers import absolutify
|
||||
delete_harder = self.highest_status or self.status
|
||||
if delete_harder:
|
||||
if self.guid:
|
||||
|
@ -295,6 +296,7 @@ class Addon(amo.models.OnChangeMixin, amo.models.ModelBase):
|
|||
email_msg = u"""
|
||||
The following add-on was deleted.
|
||||
ADD-ON: %s
|
||||
URL: %s
|
||||
DELETED BY: %s
|
||||
ID: %s
|
||||
GUID: %s
|
||||
|
@ -302,8 +304,9 @@ class Addon(amo.models.OnChangeMixin, amo.models.ModelBase):
|
|||
TOTAL DOWNLOADS: %s
|
||||
AVERAGE DAILY USERS: %s
|
||||
NOTES: %s
|
||||
""" % (self.name, user_str, self.id, self.guid, authors,
|
||||
self.total_downloads, self.average_daily_users, msg)
|
||||
""" % (self.name, absolutify(self.get_url_path()), user_str,
|
||||
self.id, self.guid, authors, self.total_downloads,
|
||||
self.average_daily_users, msg)
|
||||
log.debug('Sending delete email for add-on %s' % self.id)
|
||||
subject = 'Deleting add-on %s (%d)' % (self.slug, self.id)
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ import test_utils
|
|||
|
||||
import amo
|
||||
from amo import set_user
|
||||
from amo.helpers import absolutify
|
||||
from amo.signals import _connect, _disconnect
|
||||
from addons.models import (Addon, AddonCategory, AddonDependency,
|
||||
AddonRecommendation, AddonType, BlacklistedGuid,
|
||||
|
@ -152,6 +153,12 @@ class TestAddonModels(test_utils.TestCase):
|
|||
eq_(len(mail.outbox), 1)
|
||||
assert BlacklistedGuid.objects.filter(guid=a.guid)
|
||||
|
||||
def test_delete_url(self):
|
||||
"""Test deleting addon has URL in the email."""
|
||||
a = Addon.objects.get(pk=4594)
|
||||
a.delete('bye')
|
||||
assert absolutify(a.get_url_path()) in mail.outbox[0].body
|
||||
|
||||
def test_delete_searchengine(self):
|
||||
"""
|
||||
Test deleting searchengines (which have no guids) should not barf up
|
||||
|
|
Загрузка…
Ссылка в новой задаче