refactor: Restrict canRequestHistory to joined or archived rooms

This commit is contained in:
Christian Kußowski 2025-07-17 09:44:11 +02:00
parent 48f59f378d
commit d3071ec531
No known key found for this signature in database
GPG Key ID: E067ECD60F1A0652
1 changed files with 3 additions and 0 deletions

View File

@ -80,6 +80,9 @@ class Timeline {
bool _fetchedAllDatabaseEvents = false;
bool get canRequestHistory {
if (!{Membership.join, Membership.leave}.contains(room.membership)) {
return false;
}
if (events.isEmpty) return true;
return !_fetchedAllDatabaseEvents ||
(room.prev_batch != null && events.last.type != EventTypes.RoomCreate);