diff --git a/lib/handlers/non-keyserver-activity-handler.js b/lib/handlers/non-keyserver-activity-handler.js --- a/lib/handlers/non-keyserver-activity-handler.js +++ b/lib/handlers/non-keyserver-activity-handler.js @@ -85,14 +85,27 @@ return; } + const threadHandledByHandlerOnly = + threadSpecs[activeThreadInfo.type].protocol() + .threadActivityUpdatedByActivityHandlerOnly; + const alwaysUpdateActivity = + threadSpecs[activeThreadInfo.type].protocol().alwaysUpdateThreadActivity; + const activityShouldBeRecorded = + threadHandledByHandlerOnly || alwaysUpdateActivity; + + if (!activityShouldBeRecorded) { + return; + } + if (activeThreadInfo.currentUser.unread) { void updateDMActivity(); return; } if ( - activeThreadChanged || - activeThreadLatestMessage === prevActiveThreadLatestMessage + !alwaysUpdateActivity && + (activeThreadChanged || + activeThreadLatestMessage === prevActiveThreadLatestMessage) ) { return; } diff --git a/lib/shared/threads/protocols/dm-thread-protocol.js b/lib/shared/threads/protocols/dm-thread-protocol.js --- a/lib/shared/threads/protocols/dm-thread-protocol.js +++ b/lib/shared/threads/protocols/dm-thread-protocol.js @@ -919,6 +919,8 @@ threadActivityUpdatedByActivityHandlerOnly: true, + alwaysUpdateThreadActivity: false, + membershipMessageNotifAction: messageNotifyTypes.SET_UNREAD, shouldConvertIDs: false, diff --git a/lib/shared/threads/protocols/farcaster-thread-protocol.js b/lib/shared/threads/protocols/farcaster-thread-protocol.js --- a/lib/shared/threads/protocols/farcaster-thread-protocol.js +++ b/lib/shared/threads/protocols/farcaster-thread-protocol.js @@ -395,6 +395,7 @@ messagesStoredOnServer: false, arePendingThreadsDescendantsOfGenesis: false, threadActivityUpdatedByActivityHandlerOnly: false, + alwaysUpdateThreadActivity: true, membershipMessageNotifAction: messageNotifyTypes.NONE, shouldConvertIDs: false, dataIsBackedUp: true, diff --git a/lib/shared/threads/protocols/keyserver-thread-protocol.js b/lib/shared/threads/protocols/keyserver-thread-protocol.js --- a/lib/shared/threads/protocols/keyserver-thread-protocol.js +++ b/lib/shared/threads/protocols/keyserver-thread-protocol.js @@ -675,6 +675,8 @@ threadActivityUpdatedByActivityHandlerOnly: false, + alwaysUpdateThreadActivity: false, + membershipMessageNotifAction: messageNotifyTypes.NONE, shouldConvertIDs: true, diff --git a/lib/shared/threads/thread-spec.js b/lib/shared/threads/thread-spec.js --- a/lib/shared/threads/thread-spec.js +++ b/lib/shared/threads/thread-spec.js @@ -429,6 +429,10 @@ // This flag is temporary. It should be deleted as a part of // https://linear.app/comm/issue/ENG-10729/consider-merging-activity-handlers +threadActivityUpdatedByActivityHandlerOnly: boolean, + // This property makes sure that activity is sent always, regardless of + // the previous state. Example: information that the thread is read is + // sent on each open, not only if it was unread previously. + +alwaysUpdateThreadActivity: boolean, +membershipMessageNotifAction: MessageNotifyType, +shouldConvertIDs: boolean, // This flag specifies that all data created or updated should be included