A function for fetching the keyserver admins ID, similarly to D4958 - assuming there is only one community and it's admin is the keyservers admin. This will be added to ENG-1707 hack.
This function is needed in message-report creator. The function from D4958 will not be used there as it would be much slower. The function from this diff will not be used where the function from D4958 is
used, because it's used on native and web so we cannot call the database there.
Details
Add the following line to the textMessageCreationResponder from keyserver/src/responders/message-responders.js:
console.log(await fetchKeyserverAdminID());
And see that when a user sends a text message (if you have just one admin in your setup) ashoat users's id (256) is logged to console.
Diff Detail
- Repository
- rCOMM Comm
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
Change the way we decide which threads are community threads, based on threadTypeIsCommunityRoot function
keyserver/src/fetchers/user-fetchers.js | ||
---|---|---|
274 | According to https://linear.app/comm/issue/ENG-1707/revert-fix-getting-the-keyserver-admin-info, in our hack we not only check if it is any admin role, but also check if this role has CHANGE_ROLE permission. Can we add this check also here? | |
280 | We can consider logging a warning if there are more rows. |
Log a warning when multiple potential keyserver admins found, check for CHANGE_ROLE permission
Great! Just one last comment inline
keyserver/src/fetchers/user-fetchers.js | ||
---|---|---|
274–275 ↗ | (On Diff #16619) | Unfortunately, we don't have any automated tool for formatting SQL, but we have a convention that we indent nested statements by 2 spaces and prefer adding AND at the end of the line. Additional note: we should use a constant instead of hardcoding change_role permission. |
keyserver/src/fetchers/user-fetchers.js | ||
---|---|---|
282 ↗ | (On Diff #16619) | Not sure if it should say "community admin" or "keyserver admin" |
Make code prettier
keyserver/src/fetchers/user-fetchers.js | ||
---|---|---|
287 ↗ | (On Diff #16620) |
(Repeating so it doesn't get lost) |
Looks great! Adding @ashoat so that he can take a look - this solution seems to be consistent with our current https://linear.app/comm/issue/ENG-1707/revert-fix-getting-the-keyserver-admin-info.
keyserver/src/fetchers/user-fetchers.js | ||
---|---|---|
287 ↗ | (On Diff #16620) | I think the current message is fine, but improving it is also a good idea. Also curious about @ashoat opinion. About repeating stuff: there's a setting that allows displaying all the comments, not only the ones from the most recent reviosion. |
keyserver/src/fetchers/user-fetchers.js | ||
---|---|---|
287 ↗ | (On Diff #16620) | Looks good to me! Sorry for the delay in reviewing here |