Page MenuHomePhabricator

[lib] Remove `getCurrentUser`
ClosedPublic

Authored by atul on May 21 2024, 9:06 AM.
Tags
None
Referenced Files
F3376920: D12158.diff
Wed, Nov 27, 2:54 AM
Unknown Object (File)
Sat, Nov 23, 12:40 PM
Unknown Object (File)
Sat, Nov 23, 12:24 PM
Unknown Object (File)
Tue, Nov 19, 11:41 PM
Unknown Object (File)
Sat, Nov 9, 5:12 AM
Unknown Object (File)
Thu, Nov 7, 10:14 PM
Unknown Object (File)
Oct 18 2024, 3:42 PM
Unknown Object (File)
Oct 11 2024, 4:36 PM
Subscribers
None

Details

Summary

We needed getCurrentUser in order to "patch" permissions based on block. However, we're now considering filtered permissions as part of useThreadsWithPermission so we can handle blocks as part of permission check vs. RawThreadInfo -> ThreadInfo. This greatly simplifies deprecation of memberHasAdminPowers on the client.


Depends on D12154

Test Plan

flow + ensuring that useExistingThreadInfoFinder, threadInfoFromRawThreadInfo, etc. continue to work as expected.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul published this revision for review.May 21 2024, 9:06 AM

i'm probably not a good reviewer of this code

ashoat requested changes to this revision.May 24 2024, 3:07 AM

Great to see this!

I'd like to understand a bit more why this is safe to do at this time. I tried looking through your Linear task tree, but couldn't find where this is tracked.

Can you share where you're tracking all permissions checks on the client (ideally on Linear), so I can confirm that they're all updated to use hooks that check block status?

This revision now requires changes to proceed.May 24 2024, 3:07 AM

rebase before addressing feedback

I'd like to understand a bit more why this is safe to do at this time.

We should be confident in this change after flow changes in D12246. Let me know if there's any questions or details I can clarify.


I tried looking through your Linear task tree, but couldn't find where this is tracked.

Can you share where you're tracking all permissions checks on the client (ideally on Linear), so I can confirm that they're all updated to use hooks that check block status?

Going to go through and update Linear task tree right now.

atul requested review of this revision.May 30 2024, 1:27 PM
lib/shared/thread-utils.js
1160–1163 ↗(On Diff #40798)

This can just be return updatedThread now.

remove unnecessary spread

Thanks @atul. I'm still a little confused, so three more follow-up questions:

  1. Can you share where you're tracking all permissions checks on the client (ideally on Linear), so I can confirm that they're all updated to use hooks that check block status?
  2. I found a client-related task on Linear that was listed as in-progress. I left a small question on Linear, can you respond there?
  3. Regarding another client-related task on Linear that was listed as in-progress, I sent a message on Comm. Can you respond there?
ashoat requested changes to this revision.May 31 2024, 12:08 PM

Passing back to respond to the above

This revision now requires changes to proceed.May 31 2024, 12:08 PM
atul requested review of this revision.Jun 11 2024, 1:17 PM
  1. Can you share where you're tracking all permissions checks on the client (ideally on Linear), so I can confirm that they're all updated to use hooks that check block status?

Places that used threadHasPermission that needed to be updated to use useThreadHasPermission are listed here: https://linear.app/comm/issue/ENG-7254/use-hook-instead-of-mutating-permissions-in-getminimallyencodeduser

In addition, we know that all checks that check permissions affected by block are going through useThreadHasPermission because the threadHasPermission function has been updated to only accept ThreadPermissionNotAffectedByBlock:

cd245f.png (224×1 px, 64 KB)

  1. I found a client-related task on Linear that was listed as in-progress. I left a small question on Linear, can you respond there?

Believe you're referring to: https://linear.app/comm/issue/ENG-8000/update-usefilteredchildthreads-to-call-usethreadinchatlist. That change didn't turn out to be necessary.

  1. Regarding another client-related task on Linear that was listed as in-progress, I sent a message on Comm. Can you respond there?

Responded on Comm, but here was the discussion:

6e94b1.png (740×1 px, 212 KB)

This revision is now accepted and ready to land.Jun 12 2024, 8:50 AM
This revision was automatically updated to reflect the committed changes.