Skip to content

Commit

Permalink
アンケート検索
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed May 12, 2019
1 parent eb1447d commit d7053b0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/server/api/endpoints/notes/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ async function searchInternal(me: ILocalUser, query: string, limit: number, offs
let host: string; // = undefined
let sensitive: 'all' | 'sfw' | 'nsfw' = 'all';
let filtered = false;
let withPolls = false;

for (const token of tokens) {
// from
Expand Down Expand Up @@ -148,6 +149,10 @@ async function searchInternal(me: ILocalUser, query: string, limit: number, offs
types = concat([types, ['audio/mpeg', 'audio/mp4']]);
}

if (matchFilter[1] === 'polls') {
withPolls = true;
}

filtered = true;
continue;
}
Expand Down Expand Up @@ -235,6 +240,11 @@ async function searchInternal(me: ILocalUser, query: string, limit: number, offs
};
}

// note - polls
if (withPolls) {
noteQuery.poll = { $exists: true, $ne: null };
}

if (noteQuery.fileIds && sensitive === 'sfw') {
noteQuery['_files.metadata.isSensitive'] = { $ne: true };
}
Expand Down

0 comments on commit d7053b0

Please sign in to comment.