buildRejectedEvent fires when a reviewer rejects a pending outbound. userID is the reviewer (a separate identity from the agent's owner when multi-reviewer ACLs land in a future slice — today they're always the same).
( userID string, rejected *identity.Message, reason string, )
| 135 | // when multi-reviewer ACLs land in a future slice — today they're |
| 136 | // always the same). |
| 137 | func (a *API) buildRejectedEvent( |
| 138 | userID string, |
| 139 | rejected *identity.Message, |
| 140 | reason string, |
| 141 | ) webhookpub.Event { |
| 142 | data := map[string]interface{}{ |
| 143 | "message_id": rejected.ID, |
| 144 | "direction": "outbound", |
| 145 | "type": rejected.Type, |
| 146 | "rejection_reason": reason, |
| 147 | "reviewed_by_user_id": userID, |
| 148 | } |
| 149 | return webhookpub.Event{ |
| 150 | ID: generateEventIDForAgent(), |
| 151 | Type: webhookpub.EventEmailReviewRejected, |
| 152 | CreatedAt: time.Now().UTC(), |
| 153 | UserID: userID, |
| 154 | AgentID: rejected.AgentID, |
| 155 | MessageID: rejected.ID, |
| 156 | Data: data, |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | // buildInboundReleasedEvent fires when a reviewer releases a held inbound |
| 161 | // message to the agent (status pending_review → review_approved, now inbox- |