Skip to content

Commit

Permalink
feat(backend): option to exclude polls in channels
Browse files Browse the repository at this point in the history
  • Loading branch information
anatawa12 committed May 19, 2024
1 parent 2521721 commit 0e970ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const paramDef = {
properties: {
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
offset: { type: 'integer', default: 0 },
excludeChannels: { type: 'boolean', default: false },
},
required: [],
} as const;
Expand Down Expand Up @@ -86,6 +87,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
query.setParameters(mutingQuery.getParameters());
//#endregion

//#region exclude channels
if (ps.excludeChannels) {
query.andWhere('poll.channelId IS NULL');
}
//#endregion

const polls = await query
.orderBy('poll.noteId', 'DESC')
.limit(ps.limit)
Expand Down
2 changes: 2 additions & 0 deletions packages/misskey-js/src/autogen/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21019,6 +21019,8 @@ export type operations = {
limit?: number;
/** @default 0 */
offset?: number;
/** @default false */
excludeChannels?: boolean;
};
};
};
Expand Down

0 comments on commit 0e970ac

Please sign in to comment.