Page MenuHomePhabricator

[lib, web, native] extract getting the keyserver admin
ClosedPublic

Authored by inka on Aug 26 2022, 7:39 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 25, 5:00 PM
Unknown Object (File)
Mon, Nov 25, 4:14 PM
Unknown Object (File)
Mon, Nov 25, 3:14 PM
Unknown Object (File)
Mon, Nov 25, 8:56 AM
Unknown Object (File)
Mon, Nov 25, 8:43 AM
Unknown Object (File)
Fri, Nov 22, 8:28 AM
Unknown Object (File)
Fri, Nov 22, 7:52 AM
Unknown Object (File)
Fri, Nov 22, 2:43 AM
Subscribers

Details

Summary

This common logic has been exctracted to lib, because I need to use this in yet another place
More context on this part of code: ENG-1707
Related issue: ENG-1700

Test Plan

Checked that web and native launch and name 'ashoat' is displayed in the chat-thread-ancestors component

image.png (86×520 px, 12 KB)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

inka requested review of this revision.Aug 26 2022, 7:49 AM
inka edited the summary of this revision. (Show Details)
inka edited the summary of this revision. (Show Details)

One inline question.

lib/shared/user-utils.js
40–46 ↗(On Diff #16003)

Up to you if you'd like to use this, it looks cleaner, but performance matters more.

native/components/community-pill.react.js
23 ↗(On Diff #16003)

It looks like whenever we use getKeyserverAdmin (here and in ChatThreadAncestors), we are using it to get the username field out. Could we just return the username in getKeyserverAdmin?

This hack only works as long as there is only one admin, so returning one string for a username shouldn't be an issue until we revert it, right?

This revision now requires changes to proceed.Aug 26 2022, 9:54 AM
lib/shared/user-utils.js
40–46 ↗(On Diff #16003)

Meant to write userInfos[admin.id] instead of userInfos[member.id].

Thanks for extracting this!

native/components/community-pill.react.js
23 ↗(On Diff #16003)
  1. () => { return something; } can just be () => something
  2. I think returning ?UserInfo is better. The repeated ?.username isn't that bad
web/chat/chat-thread-ancestors.react.js
44 ↗(On Diff #16003)

() => { return something; } can just be () => something

abosh added inline comments.
native/components/community-pill.react.js
23 ↗(On Diff #16003)

Ok!

This revision is now accepted and ready to land.Aug 26 2022, 12:49 PM
native/components/community-pill.react.js
23 ↗(On Diff #16003)

I'm currently working on code that will need the keyserver admins id

tomek added inline comments.
lib/shared/user-utils.js
40 ↗(On Diff #16039)

We should mention a Linear task in the comment

41 ↗(On Diff #16039)

I think we can use a shorthand

Add linear task to comment, correct code style

Make getKeyserverAdmin accept ThreadInfo as well as RawThreadInfo

Make getKeyserverAdmin accept ServerThreadInfo as well