deleteDraft method

void deleteDraft(
  1. String principalId,
  2. String threadId
)

Deletes the draft of principalId in threadId; nothing happens without one.

Implementation

void deleteDraft(String principalId, String threadId) {
  visibleThread(principalId, threadId);
  final draft = drafts.remove('$principalId|$threadId');
  if (draft == null) return;
  append(
    'draft.deleted',
    resource: {'kind': 'draft', 'id': draft['id']},
    scope: _scopeOf(threadId),
    payload: {
      'draft_id': draft['id'],
      'channel_id': draft['channel_id'],
      'thread_id': threadId,
    },
    actor: principalId,
    audience: principalId,
  );
}