HomePhabricator
Diffusion Comm 9d78e018f716

[keyserver] Create a function to query for all uploads from a provided threadID

Description

[keyserver] Create a function to query for all uploads from a provided threadID

Summary:
We create a function in upload-fetchers to query the database for uploads given a specific threadID. The query uses a UNION to join two select statements, one for the photos and one for the videos. We get the necessary information for both media, and for the thumbnail data for videos, the photos are defaulted to NULL.

https://linear.app/comm/issue/ENG-2873/create-a-function-to-query-for-all-uploads-from-a-provided-thread

Depends on D6482

Test Plan:
I tested the membership permissions in two ways:

  1. By simulating a user who should have access to the media, navigating to the thread and confirming that the shared media is still present in the gallery.
  1. More importantly, to try to simulate a user who shouldn't have access to the shared media, I ran the query in TablePlus and filled in the ${viewer.id} parameter with a user who definitely should not have access to the thread media. I confirmed that the query returned 0 results, as opposed to, prior to the permissions checking, the query always returned all of the media.

Screenshot 2023-02-26 at 10.16.43 AM.png (596×1 px, 60 KB)

Reviewers: atul, ginsu, kamil, tomek, ashoat

Reviewed By: ashoat

Subscribers: ashoat

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

Details