Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3386992
D13832.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D13832.diff
View Options
diff --git a/keyserver/src/fetchers/community-fetchers.js b/keyserver/src/fetchers/community-fetchers.js
--- a/keyserver/src/fetchers/community-fetchers.js
+++ b/keyserver/src/fetchers/community-fetchers.js
@@ -5,7 +5,7 @@
ServerCommunityInfoWithCommunityName,
} from 'lib/types/community-types.js';
-import { dbQuery, SQL } from '../database/database.js';
+import { dbQuery, SQL, mergeAndConditions } from '../database/database.js';
import { Viewer } from '../session/viewer.js';
type ServerCommunityInfoWithHolder = $ReadOnly<{
@@ -25,16 +25,28 @@
SELECT c.id, c.farcaster_channel_id as farcasterChannelID,
c.blob_holder as blobHolder
FROM communities c
- INNER JOIN memberships m
- ON c.id = m.thread AND m.user = ${viewer.userID}
- WHERE m.role > 0
`;
+ if (!viewer.isScriptViewer) {
+ query.append(SQL`
+ INNER JOIN memberships m
+ ON c.id = m.thread AND m.user = ${viewer.userID}
+ `);
+ }
+ const conditions = [];
+ if (!viewer.isScriptViewer) {
+ conditions.push(SQL`m.role > 0`);
+ }
if (communityIDs && communityIDs.length > 0) {
- query.append(SQL`
- AND c.id IN (${communityIDs})
+ conditions.push(SQL`
+ c.id IN (${communityIDs})
`);
}
+ if (conditions.length > 0) {
+ const clause = mergeAndConditions(conditions);
+ query.append(SQL`WHERE `);
+ query.append(clause);
+ }
const [result] = await dbQuery(query);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 30, 7:08 AM (10 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2595715
Default Alt Text
D13832.diff (1 KB)
Attached To
Mode
D13832: [keyserver] do not filter by role in fetchCommunityInfos calls for script viewers
Attached
Detach File
Event Timeline
Log In to Comment