Record the actor on assign, archive and unarchive (#35)
Assign logged only the assignee (user_id), archive/unarchive logged nothing. Migration 018 adds actor_user_id/actor_service_account_id to incident_events for 'assigned'; archive/unarchive now log archived/unarchived events with the caller via callerActorIDs. Timeline JSON gains actor_* fields; web timeline renders them. Service accounts are still not assignable.
This commit is contained in:
@@ -225,6 +225,15 @@ function actorLabel(ev, named = false) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// assignerLabel is actorLabel for an 'assigned' event, whose user_id is the
|
||||
// assignee: the person who made the assignment is in the actor_* fields
|
||||
// (null for assignments from before they were recorded).
|
||||
function assignerLabel(ev, named = false) {
|
||||
if (ev.actor_user_id != null) return named ? (ev.actor_username || 'someone') : who(ev.actor_user_id, ev.actor_username);
|
||||
if (ev.actor_service_account_id != null) return ev.actor_service_account_name || 'a service account';
|
||||
return null;
|
||||
}
|
||||
|
||||
// named spells users out instead of "you", for text that leaves this page.
|
||||
function eventText(ev, named = false) {
|
||||
const person = actorLabel(ev, named);
|
||||
@@ -239,7 +248,12 @@ function eventText(ev, named = false) {
|
||||
case 'alert_resolved': return [`Alert resolved: ${alertName()}`];
|
||||
case 'acknowledged': return [strong(person), ' acknowledged'];
|
||||
case 'unacknowledged': return [strong(person), ' cleared the acknowledgement'];
|
||||
case 'assigned': return ['Assigned to ', strong(person)];
|
||||
case 'assigned': {
|
||||
const by = assignerLabel(ev, named);
|
||||
return by ? ['Assigned to ', strong(person), ' by ', strong(by)] : ['Assigned to ', strong(person)];
|
||||
}
|
||||
case 'archived': return [strong(person), ' archived the incident'];
|
||||
case 'unarchived': return [strong(person), ' unarchived the incident'];
|
||||
case 'snoozed': return [strong(person), ` snoozed until ${ev.detail ? when(ev.detail) : '…'}`];
|
||||
case 'unsnoozed': return [strong(person), ' ended the snooze'];
|
||||
case 'resolved': return person ? [strong(person), ' resolved the incident'] : ['Resolved: every alert stopped firing'];
|
||||
|
||||
Reference in New Issue
Block a user