diff --git a/lib/actions/thread-actions.js b/lib/actions/thread-actions.js --- a/lib/actions/thread-actions.js +++ b/lib/actions/thread-actions.js @@ -251,6 +251,7 @@ rawMessageInfos: response.rawMessageInfos, truncationStatuses: response.truncationStatuses, userInfos, + keyserverID, }; }; diff --git a/lib/reducers/user-reducer.js b/lib/reducers/user-reducer.js --- a/lib/reducers/user-reducer.js +++ b/lib/reducers/user-reducer.js @@ -23,6 +23,7 @@ setUserSettingsActionTypes, updateUserAvatarActionTypes, } from '../actions/user-actions.js'; +import { extractKeyserverIDFromID } from '../keyserver-conn/keyserver-call-utils.js'; import { setNewSessionActionType } from '../keyserver-conn/keyserver-conn-types.js'; import { convertUserInfosToReplaceUserOps, @@ -300,9 +301,19 @@ ]; } } else if ( - action.type === joinThreadActionTypes.success || - action.type === newThreadActionTypes.success + (action.type === joinThreadActionTypes.success || + action.type === newThreadActionTypes.success) && + relyingOnAuthoritativeKeyserver ) { + let keyserverID; + if (action.type === joinThreadActionTypes.success) { + keyserverID = action.payload.keyserverID; + } else { + keyserverID = extractKeyserverIDFromID(action.payload.newThreadID); + } + if (keyserverID !== authoritativeKeyserverID()) { + return [state, [], []]; + } const newUserInfos: UserInfos = _keyBy(userInfo => userInfo.id)( action.payload.userInfos, ); diff --git a/lib/types/thread-types.js b/lib/types/thread-types.js --- a/lib/types/thread-types.js +++ b/lib/types/thread-types.js @@ -323,6 +323,7 @@ +rawMessageInfos: $ReadOnlyArray<RawMessageInfo>, +truncationStatuses: MessageTruncationStatuses, +userInfos: $ReadOnlyArray<UserInfo>, + +keyserverID: string, }; export type ThreadFetchMediaResult = {