Merge pull request #2041 from famedly/krille/refactor-mark-unread
refactor: Make markUnread a noop if unread is already as intendend and throw exception if room membership is not join
This commit is contained in:
commit
f76210d99b
|
|
@ -566,6 +566,12 @@ class Room {
|
||||||
/// this works if there is no connection to the homeserver. This does **not**
|
/// this works if there is no connection to the homeserver. This does **not**
|
||||||
/// set a read marker!
|
/// set a read marker!
|
||||||
Future<void> markUnread(bool unread) async {
|
Future<void> markUnread(bool unread) async {
|
||||||
|
if (unread == markedUnread) return;
|
||||||
|
if (membership != Membership.join) {
|
||||||
|
throw Exception(
|
||||||
|
'Can not markUnread on a room with membership $membership',
|
||||||
|
);
|
||||||
|
}
|
||||||
final content = MarkedUnread(unread).toJson();
|
final content = MarkedUnread(unread).toJson();
|
||||||
await _handleFakeSync(
|
await _handleFakeSync(
|
||||||
SyncUpdate(
|
SyncUpdate(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue