def test_review_queue_covered(self): """ Test that every review queue log has its own note type. If this test is failing, tell ngoke to add a new note type. """ for log_type in mkt.LOG_REVIEW_QUEUE: if log_type in self.blocked: continue assert comm.ACTION_MAP(log_type) != comm.NO_ACTION, log_type assert comm.ACTION_MAP(log_type) in comm.NOTE_TYPES, log_type
def create_note(self, action): """ Permissions default to developers + reviewers + Mozilla contacts. For escalation/comment, exclude the developer from the conversation. """ details = { 'comments': self.data['comments'], 'reviewtype': self.review_type } if self.files: details['files'] = [f.id for f in self.files] tested = self.get_tested() # You really should... if tested: self.data['comments'] += '\n\n%s' % tested # Commbadge (the future). note_type = comm.ACTION_MAP(action.id) self.comm_thread, self.comm_note = create_comm_note( self.addon, self.version, self.request.user, self.data['comments'], note_type=note_type, attachments=self.attachment_formset) # ActivityLog (ye olde). mkt.log(action, self.addon, self.version, user=self.user, created=datetime.now(), details=details)
def create_note(self, action): """ Permissions default to developers + reviewers + Mozilla contacts. For escalation/comment, exclude the developer from the conversation. """ details = {'comments': self.data['comments'], 'reviewtype': self.review_type} if self.files: details['files'] = [f.id for f in self.files] # Commbadge (the future). perm_overrides = { comm.ESCALATION: {'developer': False}, comm.REVIEWER_COMMENT: {'developer': False}, } note_type = comm.ACTION_MAP(action.id) self.comm_thread, self.comm_note = create_comm_note( self.addon, self.version, self.request.amo_user, self.data['comments'], note_type=note_type, # Ignore switch so we don't have to re-migrate new notes. perms=perm_overrides.get(note_type), no_switch=True, attachments=self.attachment_formset) # ActivityLog (ye olde). amo.log(action, self.addon, self.version, user=self.user, created=datetime.now(), details=details, attachments=self.attachment_formset)
def log_reviewer_action(addon, user, msg, action, **kwargs): create_comm_note(addon, addon.latest_version, user, msg, note_type=comm.ACTION_MAP(action.id)) mkt.log(action, addon, addon.latest_version, details={'comments': msg}, **kwargs)
def escalate_app(app, version, user, msg, log_type): # Add to escalation queue EscalationQueue.objects.get_or_create(addon=app) # Create comm note create_comm_note(app, version, user, msg, note_type=comm.ACTION_MAP(log_type)) # Log action mkt.log(log_type, app, version, created=datetime.now(), details={'comments': msg}) log.info(u'[app:%s] escalated - %s' % (app.name, msg))
def flag(cls, addon, event, message=None): cls.objects.get_or_create(addon=addon) version = addon.current_version or addon.latest_version if message: mkt.log(event, addon, version, details={'comments': message}) else: mkt.log(event, addon, version) # TODO: if we ever get rid of ActivityLog for reviewer notes, replace # all flag calls to use the comm constant and not have to use # ACTION_MAP. create_comm_note(addon, version, None, message, note_type=comm.ACTION_MAP(event))
def _migrate_activity_log(ids, **kwargs): """For migrate_activity_log.py script.""" for log in ActivityLog.objects.filter(pk__in=ids): action = cmb.ACTION_MAP(log.action) # Create thread. try: thread, tc = CommunicationThread.objects.safer_get_or_create( addon=log.arguments[0], version=log.arguments[1]) except IndexError: continue # Filter notes. note_params = { 'thread': thread, 'note_type': action, 'author': log.user, 'body': log.details.get('comments', '') if log.details else '', } notes = CommunicationNote.objects.filter(created=log.created, **note_params) if notes.exists(): # Note already exists, move on. continue # Create note. note = CommunicationNote.objects.create( # Developers should not see escalate/reviewer comments. read_permission_developer=action not in cmb.REVIEWER_NOTE_TYPES, **note_params) note.update(created=log.created) # Attachments. if note.attachments.exists(): # Already migrated. Continue. continue # Create attachments. for attachment in log.activitylogattachment_set.all(): note_attachment = note.attachments.create( filepath=attachment.filepath, mimetype=attachment.mimetype, description=attachment.description) note_attachment.update(created=attachment.created)
def escalate_app(app, version, user, msg, email_template, log_type): # Add to escalation queue EscalationQueue.objects.get_or_create(addon=app) # Create comm note create_comm_note(app, version, user, msg, note_type=comm.ACTION_MAP(log_type)) # Log action amo.log(log_type, app, version, created=datetime.now(), details={'comments': msg}) log.info(u'[app:%s] escalated - %s' % (app.name, msg)) # Special senior reviewer email. if not waffle.switch_is_active('comm-dashboard'): context = {'name': app.name, 'review_url': absolutify(reverse('reviewers.apps.review', args=[app.app_slug])), 'SITE_URL': settings.SITE_URL} send_reviewer_mail(u'%s: %s' % (msg, app.name), email_template, context, [settings.MKT_SENIOR_EDITORS_EMAIL])