setThreadState method
closeThread and reopenThread of principalId (05: write); a thread already in
the state changes nothing. Returns the thread.
Implementation
JsonMap setThreadState(
String principalId,
String threadId, {
required bool closed,
}) {
final thread = _writable(principalId, threadId);
if ((thread['state'] == 'closed') == closed) return thread;
if (closed) {
closeThread(threadId, actor: principalId);
} else {
_reopen(threadId, principalId);
}
return threads[threadId]!;
}