Page MenuHomePhabricator

[web] Replace `threadHasPermission` with `useThreadHasPermission` in `ThreadSettings*`
ClosedPublic

Authored by atul on Apr 23 2024, 1:49 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 3, 3:04 AM
Unknown Object (File)
Sat, Oct 12, 3:50 PM
Unknown Object (File)
Sat, Oct 12, 3:50 PM
Unknown Object (File)
Sat, Oct 12, 3:50 PM
Unknown Object (File)
Sat, Oct 12, 3:50 PM
Unknown Object (File)
Sat, Oct 12, 3:50 PM
Unknown Object (File)
Sat, Oct 12, 3:50 PM
Unknown Object (File)
Sat, Oct 12, 3:50 PM
Subscribers

Details

Summary

Similar to D11752, but for ThreadSettingsGeneralTab and ThreadSettingsModal


Depends on D11752

Test Plan

flow + close reading.

Will test generally at end to make sure things work as expected. Don't think it's practical to manually test each of these trivial changes.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

atul requested review of this revision.Apr 23 2024, 2:05 PM
tomek requested changes to this revision.Apr 24 2024, 4:51 AM
tomek added inline comments.
web/modals/threads/settings/thread-settings-general-tab.react.js
83–86 ↗(On Diff #39430)

Nit: usually we're calling hooks without altering the returned value inline - the current approach makes it less obvious that this is a hook and not a plain function. (doesn't matter too much, though).

web/modals/threads/settings/thread-settings-modal.react.js
100–119 ↗(On Diff #39430)

It looks like it could be more convenient to have a hook that returns a set with all the permissions. But I don't think it is worth changing at this point.

124 ↗(On Diff #39430)

We're changing the logic here - instead of checking the permissions of the thread from the parameter, we're checking the one from the selector. Is it safe? If it is safe, do we still need thread parameter in this callback?

This revision now requires changes to proceed.Apr 24 2024, 4:51 AM

rebase before addressing feedback

atul added inline comments.
web/modals/threads/settings/thread-settings-modal.react.js
100–119 ↗(On Diff #39430)

Yeah agree, this is definitely verbose but I think fine for now.

124 ↗(On Diff #39430)

Good point, the thread parameter in the callback should be removed.

atul marked an inline comment as done.

address @tomek's feedback

ashoat removed a reviewer: tomek.

@tomek is off, so accepting for him

web/modals/threads/settings/thread-settings-modal.react.js
149 ↗(On Diff #40789)

Do we still need this check now that we're not passing it in? Seems like we can remove it, and remove it from the dep list

This revision is now accepted and ready to land.May 30 2024, 11:54 AM
web/modals/threads/settings/thread-settings-modal.react.js
149 ↗(On Diff #40789)

Ah yeah thanks for catching that, will update diff to remove.

remove extraneous threadInfo from useEffect + deplist

This revision was landed with ongoing or failed builds.May 30 2024, 12:18 PM
This revision was automatically updated to reflect the committed changes.