closeThread method

void closeThread(
  1. String threadId, {
  2. String? actor,
})

Marks threadId done (thread.close) and appends thread.closed.

Implementation

void closeThread(String threadId, {String? actor}) {
  final thread = threads[threadId]!;
  thread
    ..['state'] = 'closed'
    ..['closed_at'] = stamp()
    ..['version'] = (thread['version']! as int) + 1;
  if (actor != null) thread['closed_by'] = actor;
  append(
    'thread.closed',
    resource: {
      'kind': 'thread',
      'id': threadId,
      'version': thread['version'],
    },
    scope: _scopeOf(threadId),
    payload: {'thread': thread},
    actor: actor,
  );
}