Page MenuHomePhabricator

[keyserver/lib] Set up responders, endpoints, and related functions to toggle a message pin
ClosedPublic

Authored by rohan on Mar 2 2023, 1:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 24, 1:01 AM
Unknown Object (File)
Fri, Nov 8, 5:38 PM
Unknown Object (File)
Fri, Nov 8, 5:38 PM
Unknown Object (File)
Fri, Nov 8, 5:38 PM
Unknown Object (File)
Fri, Nov 8, 5:38 PM
Unknown Object (File)
Fri, Nov 8, 5:38 PM
Unknown Object (File)
Fri, Nov 8, 5:38 PM
Unknown Object (File)
Fri, Nov 8, 5:38 PM
Subscribers

Details

Summary

Now that the function to INSERT and DELETE from MariaDB is set up, this diff handles setting up the endpoint, responder and validator, as well as the action method that'll be called via
useServerCall client-side.

To not block review while I figure out how to alert the client of a message pin, I've created a follow-up task to decide what to replace Promise<void> with: https://linear.app/comm/issue/ENG-3392/alert-the-client-of-a-message-pin-unpin

Linear: https://linear.app/comm/issue/ENG-3187/set-up-responders-endpoints-and-related-functions-to-toggle-a-message

Depends on D6929

Test Plan

The testing for both the previous diff and this diff are combined here. I tested the stack so far by doing the following:

  1. Finding a place to call toggleMessagePin on the client. It's not really important where I call it, just as long as the code runs, so I used the thread settings media gallery on web since it's easy to reach (just need to open the gallery).
  1. Log into an admin account locally.
  1. Call toggleMessagePin with the following parameters: {messageID: "83806", threadID: "83794", action: 'pin}. I confirm that the message was considered pinned.

Screenshot 2023-03-20 at 4.09.42 PM.png (148×2 px, 60 KB)

  1. Call toggleMessagePin with the following parameters: {messageID: "83806", threadID: "83794", action: 'unpin'}. I confirm that the message was considered unpinned.

Screenshot 2023-03-20 at 4.09.56 PM.png (164×2 px, 63 KB)

  1. Log into a non-admin account part of a thread
  1. Call toggleMessagePin and confirm that the ServerError throws

Screenshot 2023-03-02 at 3.59.41 PM.png (454×1 px, 452 KB)

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

rohan requested review of this revision.Mar 2 2023, 1:18 PM
atul requested changes to this revision.Mar 10 2023, 3:43 PM

Are we still waiting on D6924 before the rest of the stack is ready for review? Back to your queue for now, feel free to re-request review as-is if I should be reviewing it.

This revision now requires changes to proceed.Mar 10 2023, 3:43 PM

Update toggleMessagePinRequestInputValidator

tomek added inline comments.
keyserver/src/endpoints.js
190 ↗(On Diff #23884)

Do we still can say that this endpoint toggles the pin? It rather sets a value based on a request.

keyserver/src/endpoints.js
190 ↗(On Diff #23884)

I'm still ok with toggle since we'll be flipping pinned / unpinned, but if you disagree I'm ok updating everything from toggle to something like update or manage

This revision is now accepted and ready to land.Mar 24 2023, 10:55 AM
keyserver/src/endpoints.js
190 ↗(On Diff #23884)

I don't think it matters too much - up to you.

Remove threadID from toggleMessagePinRequestInputValidator