This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

add escalation actions to activitylog migrate

  • Loading branch information...
ngokevin committed Feb 27, 2014
1 parent ba9cd1f commit 31e7f8d6dd47d0a01e80b48f74bace28f5cf5ec6
Showing with 27 additions and 6 deletions.
  1. +1 −2 mkt/comm/management/commands/migrate_activity_log.py
  2. +18 −0 mkt/comm/tests/test_commands.py
  3. +8 −4 mkt/constants/comm.py
@@ -59,8 +59,7 @@ def _migrate_activity_log(logs, **kwargs):
# Create note.
note = CommunicationNote.objects.create(
# Developers should not see escalate/reviewer comments.
- read_permission_developer=action not in (cmb.ESCALATION,
- cmb.REVIEWER_COMMENT),
+ read_permission_developer=action not in cmb.REVIEWER_NOTE_TYPES,
**note_params)
note.update(created=log.created)
@@ -77,6 +77,24 @@ def test_migrate_noaction(self):
user=self.user, details={'comments': 'something'})
self._assert(cmb.NO_ACTION)
+ def test_migrate_escalation_high_abuse(self):
+ amo.log(amo.LOG.ESCALATED_HIGH_ABUSE, self.app, self.version,
+ user=self.user, details={'comments': 'something'})
+ thread, note = self._assert(cmb.ESCALATION_HIGH_ABUSE)
+ assert not note.read_permission_developer
+
+ def test_migrate_escalation_high_refunds(self):
+ amo.log(amo.LOG.ESCALATED_HIGH_REFUNDS, self.app, self.version,
+ user=self.user, details={'comments': 'something'})
+ thread, note = self._assert(cmb.ESCALATION_HIGH_REFUNDS)
+ assert not note.read_permission_developer
+
+ def test_migrate_escalation_cleared(self):
+ amo.log(amo.LOG.ESCALATION_CLEARED, self.app, self.version,
+ user=self.user, details={'comments': 'something'})
+ thread, note = self._assert(cmb.ESCALATION_CLEARED)
+ assert not note.read_permission_developer
+
def test_get_or_create(self):
amo.log(amo.LOG.REQUEST_VERSION, self.app, self.version,
user=self.user, details={'comments': 'something'})
View
@@ -40,10 +40,14 @@
REREVIEW_CLEARED: _('Re-review cleared')
}
-
-def NOTE_TYPES_JSON():
- return json.dumps(dict(
- (k, unicode(v)) for k, v in NOTE_TYPES.items()))
+# Note types only visible by reviewers and not developers.
+REVIEWER_NOTE_TYPES = (
+ ESCALATION,
+ REVIEWER_COMMENT,
+ ESCALATION_HIGH_ABUSE,
+ ESCALATION_HIGH_REFUNDS,
+ ESCALATION_CLEARED
+)
# Prefix of the reply to address in comm emails.

0 comments on commit 31e7f8d

Please sign in to comment.