HomePhabricator
Diffusion Comm bdd01e69c5f6

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

Description

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

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)

Reviewers: atul, ginsu, tomek

Reviewed By: tomek

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D6930

Details