Created
July 25, 2024 16:42
-
-
Save marcinwasowicz/c9944e2ed8ed7bbd269017aff7a9a336 to your computer and use it in GitHub Desktop.
Latest E2EE notifications testing stack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/push/send-utils.js b/lib/push/send-utils.js | |
index d33b4ce4b2..aa5a19b5e6 100644 | |
--- a/lib/push/send-utils.js | |
+++ b/lib/push/send-utils.js | |
@@ -136,15 +136,15 @@ async function getPushUserInfo( | |
const threadInfo = thickRawThreadInfos[threadID]; | |
for (const memberInfo of threadInfo.members) { | |
if ( | |
- !isMemberActive(memberInfo) || | |
- !hasPermission(memberInfo.permissions, 'visible') | |
+ !isMemberActive(memberInfo) | |
+ // !hasPermission(memberInfo.permissions, 'visible') | |
) { | |
continue; | |
} | |
- | |
+ const subscription: ThreadSubscription = { home: true, pushNotifs: true }; | |
if (pushUserThreadInfos[memberInfo.id]) { | |
pushUserThreadInfos[memberInfo.id].threadsWithSubscriptions[threadID] = | |
- { ...memberInfo.subscription, role: memberInfo.role }; | |
+ { ...subscription, role: memberInfo.role }; | |
continue; | |
} | |
@@ -168,7 +168,7 @@ async function getPushUserInfo( | |
pushUserThreadInfos[memberInfo.id] = { | |
devices, | |
threadsWithSubscriptions: { | |
- [threadID]: { ...memberInfo.subscription, role: memberInfo.role }, | |
+ [threadID]: { ...subscription, role: memberInfo.role }, | |
}, | |
}; | |
} | |
diff --git a/lib/reducers/master-reducer.js b/lib/reducers/master-reducer.js | |
index ad8b3456fa..4f21f4ad39 100644 | |
--- a/lib/reducers/master-reducer.js | |
+++ b/lib/reducers/master-reducer.js | |
@@ -81,13 +81,16 @@ export default function baseReducer<N: BaseNavInfo, T: BaseAppState<N>>( | |
]; | |
// Only allow checkpoints to increase if we are connected | |
// or if the action is a STATE_SYNC | |
- const { messageStoreOperations, messageStore: reducedMessageStore } = | |
- reduceMessageStore( | |
- state.messageStore, | |
- action, | |
- threadInfos, | |
- onStateDifferenceForStaff, | |
- ); | |
+ const { | |
+ messageStoreOperations, | |
+ notificationsMessageDatas, | |
+ messageStore: reducedMessageStore, | |
+ } = reduceMessageStore( | |
+ state.messageStore, | |
+ action, | |
+ threadInfos, | |
+ onStateDifferenceForStaff, | |
+ ); | |
let messageStore = reducedMessageStore; | |
let { keyserverStore, keyserverStoreOperations } = reduceKeyserverStore( | |
@@ -241,6 +244,9 @@ export default function baseReducer<N: BaseNavInfo, T: BaseAppState<N>>( | |
auxUserStoreOperations, | |
threadActivityStoreOperations, | |
entryStoreOperations, | |
+ notificationsMessageDatas: notificationsMessageDatas | |
+ ? notificationsMessageDatas | |
+ : [], | |
}, | |
}; | |
} | |
diff --git a/lib/reducers/message-reducer.js b/lib/reducers/message-reducer.js | |
index 5043c91e83..7f81193b1d 100644 | |
--- a/lib/reducers/message-reducer.js | |
+++ b/lib/reducers/message-reducer.js | |
@@ -90,6 +90,7 @@ import { | |
messageTruncationStatus, | |
defaultNumberPerThread, | |
type ThreadMessageInfo, | |
+ type MessageData, | |
} from '../types/message-types.js'; | |
import type { RawImagesMessageInfo } from '../types/messages/images.js'; | |
import type { RawMediaMessageInfo } from '../types/messages/media.js'; | |
@@ -772,6 +773,7 @@ const { processStoreOperations: processMessageStoreOperations } = | |
messageStoreOpsHandlers; | |
type ReduceMessageStoreResult = { | |
+ +notificationsMessageDatas?: $ReadOnlyArray<MessageData>, | |
+messageStoreOperations: $ReadOnlyArray<MessageStoreOperation>, | |
+messageStore: MessageStore, | |
}; | |
@@ -1142,7 +1144,8 @@ function reduceMessageStore( | |
messageStore, | |
messageStoreOperations, | |
); | |
- | |
+ const { id, localID: locID, ...messageData } = action.payload; | |
+ const notificationsMessageDatas = [messageData]; | |
const newMessageStore = { | |
messages: processedMessageStore.messages, | |
threads: processedMessageStore.threads, | |
@@ -1151,6 +1154,7 @@ function reduceMessageStore( | |
}; | |
return { | |
+ notificationsMessageDatas, | |
messageStoreOperations, | |
messageStore: newMessageStore, | |
}; | |
diff --git a/lib/selectors/thread-selectors.js b/lib/selectors/thread-selectors.js | |
index 60d2da4617..7c31603ecf 100644 | |
--- a/lib/selectors/thread-selectors.js | |
+++ b/lib/selectors/thread-selectors.js | |
@@ -224,15 +224,16 @@ const thickRawThreadInfosSelector: ( | |
) => ThickRawThreadInfos = createSelector( | |
(state: BaseAppState<>) => state.threadStore.threadInfos, | |
(threadInfos: RawThreadInfos): ThickRawThreadInfos => { | |
- const thickRawThreadInfos: { [id: string]: ThickRawThreadInfo } = {}; | |
- for (const id in threadInfos) { | |
- const threadInfo = threadInfos[id]; | |
- if (!threadInfo.thick) { | |
- continue; | |
- } | |
- thickRawThreadInfos[id] = threadInfo; | |
- } | |
- return thickRawThreadInfos; | |
+ // const thickRawThreadInfos: { [id: string]: ThickRawThreadInfo } = {}; | |
+ // for (const id in threadInfos) { | |
+ // const threadInfo = threadInfos[id]; | |
+ // if (!threadInfo.thick) { | |
+ // continue; | |
+ // } | |
+ // thickRawThreadInfos[id] = threadInfo; | |
+ // } | |
+ // return thickRawThreadInfos; | |
+ return ((threadInfos: any): ThickRawThreadInfos); | |
}, | |
); | |
diff --git a/nix/dev-shell.nix b/nix/dev-shell.nix | |
index 5a3cd6612a..5d5993a601 100644 | |
--- a/nix/dev-shell.nix | |
+++ b/nix/dev-shell.nix | |
@@ -40,7 +40,6 @@ | |
, sops | |
, sqlite | |
, terraform | |
-, watchman | |
, rustfmt | |
, wasm-pack | |
, yarn | |
@@ -66,7 +65,6 @@ mkShell { | |
mariadb | |
nodejs | |
yarn | |
- watchman # react native | |
python3 | |
redis | |
wasm-pack | |
@@ -143,6 +141,8 @@ mkShell { | |
wait "$mariadb_pid" "$redis_pid" | |
${../scripts}/install_homebrew_macos.sh | |
+ | |
+ ${../scripts}/install_homebrew_deps.sh watchman | |
'' + '' | |
# Render default configuration for keyserver |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment