Keep older history reachable and skip notifying spam marked mid-translation
- Channel chat: when the message filter hides or collapses loaded messages and the list is too short to scroll (so the load-older trigger can't fire), load older pages automatically until it can scroll, storage runs out, or 20 pages have loaded. Past that cap an empty channel offers a "Load older messages" button instead of a dead end. - Notifications: incoming channel messages notify after awaiting translation; marking one as spam meanwhile replaced the stored copy but not the captured one, so the spam still notified. Check the stored message's filter state before notifying.
This commit is contained in:
1 parent
1332c35884
commit
4862966e47
39 files changed
+163
-3
No files matched your search
@@ -1118,6 +1118,17 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// The loaded copy of [messageId] in channel [channelIndex], or null when
|
||||
/// it is not in the in-memory window.
|
||||
ChannelMessage? _loadedChannelMessage(int channelIndex, String messageId) {
|
||||
final messages = _channelMessages[_canonicalSlot(channelIndex)];
|
||||
if (messages == null) return null;
|
||||
for (var i = messages.length - 1; i >= 0; i--) {
|
||||
if (messages[i].messageId == messageId) return messages[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// User marked [message] in [channel] as spam: hide it and teach the
|
||||
/// filter.
|
||||
Future<void> markChannelMessageSpam(
|
||||
@@ -7784,6 +7795,12 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
// Check if channel is muted
|
||||
if (notificationMode == ChannelNotificationMode.muted) return;
|
||||
|
||||
// Callers notify after awaiting translation, and the user may mark the
|
||||
// message as spam meanwhile; that replaces the stored copy, not the
|
||||
// [message] the caller captured. Go by the stored state.
|
||||
final stored = _loadedChannelMessage(channelIndex, message.messageId);
|
||||
if (stored != null && stored.isFiltered) return;
|
||||
|
||||
// Reuse translation result only if completed and non-empty; else use original text
|
||||
final resolvedText =
|
||||
(translationResult != null &&
|
||||
|
||||
Reference in new issue
Block a user