bug 625830, log to AddonLog as well
This commit is contained in:
Родитель
600122b993
Коммит
bf7b9835ee
|
@ -235,14 +235,17 @@ class CHANGE_LICENSE:
|
|||
id = 37
|
||||
format = _(u'{addon} is now licensed under {0.name}.')
|
||||
|
||||
|
||||
class CHANGE_POLICY:
|
||||
id = 38
|
||||
format = _(u'{addon} policy changed.')
|
||||
|
||||
|
||||
class CHANGE_ICON:
|
||||
id = 39
|
||||
format = _(u'{addon} icon changed.')
|
||||
|
||||
|
||||
class CUSTOM_TEXT:
|
||||
id = 98
|
||||
format = '{0}'
|
||||
|
@ -295,6 +298,11 @@ def log(action, *args, **kw):
|
|||
al.save()
|
||||
|
||||
for arg in args:
|
||||
if isinstance(arg, tuple):
|
||||
if arg[0] == Addon:
|
||||
AddonLog(addon_id=arg[1], activity_log=al).save()
|
||||
elif arg[0] == UserProfile:
|
||||
AddonLog(user_id=arg[1], activity_log=al).save()
|
||||
if isinstance(arg, Addon):
|
||||
AddonLog(addon=arg, activity_log=al).save()
|
||||
elif isinstance(arg, UserProfile):
|
||||
|
|
|
@ -7,7 +7,7 @@ from pyquery import PyQuery as pq
|
|||
import amo
|
||||
from addons.models import Addon, AddonUser
|
||||
from bandwagon.models import Collection
|
||||
from devhub.models import ActivityLog
|
||||
from devhub.models import ActivityLog, AddonLog
|
||||
from tags.models import Tag
|
||||
from files.models import File
|
||||
from reviews.models import Review
|
||||
|
@ -52,6 +52,14 @@ class TestActivityLog(test_utils.TestCase):
|
|||
a.arguments = [(Addon, 3615)]
|
||||
eq_(a.arguments[0], Addon.objects.get(pk=3615))
|
||||
|
||||
def test_addon_logging_pseudo(self):
|
||||
"""
|
||||
If we are given (Addon, 3615) it should log in the AddonLog as well.
|
||||
"""
|
||||
a = Addon.objects.get()
|
||||
amo.log(amo.LOG.CREATE_ADDON, (Addon, a.id))
|
||||
eq_(AddonLog.objects.count(), 1)
|
||||
|
||||
def test_fancy_rendering(self):
|
||||
"""HTML for Review, and Collection."""
|
||||
a = ActivityLog.objects.create(action=amo.LOG.ADD_REVIEW.id)
|
||||
|
|
Загрузка…
Ссылка в новой задаче