fixup: muted-renotes review round 1

This commit is contained in:
Chloe Kudryavtsev 2022-10-10 04:19:30 -04:00 committed by Gitea
parent 897658c188
commit 6d58d5ed3b
6 changed files with 10 additions and 10 deletions

View file

@ -2,7 +2,7 @@ import { Brackets, SelectQueryBuilder } from 'typeorm';
import { User } from '@/models/entities/user.js';
import { RenoteMutings } from '@/models/index.js';
export function generateMutedUserRenotesQueryForNotes(q: SelectQueryBuilder<any>, me: { id: User['id'] }): void {
export function generateMutedRenotesQuery(q: SelectQueryBuilder<any>, me: { id: User['id'] }): void {
const mutingQuery = RenoteMutings.createQueryBuilder('renote_muting')
.select('renote_muting.muteeId')
.where('renote_muting.muterId = :muterId', { muterId: me.id });

View file

@ -8,7 +8,7 @@ import { generateMutedUserQuery } from '../../common/generate-muted-user-query.j
import { generateRepliesQuery } from '../../common/generate-replies-query.js';
import { generateMutedNoteQuery } from '../../common/generate-muted-note-query.js';
import { generateBlockedUserQuery } from '../../common/generate-block-query.js';
import { generateMutedUserRenotesQueryForNotes } from '../../common/generated-muted-renote-query.js';
import { generateMutedRenotesQuery } from '../../common/generated-muted-renote-query.js';
export const meta = {
tags: ['notes'],
@ -80,7 +80,7 @@ export default define(meta, paramDef, async (ps, user) => {
generateMutedUserQuery(query, user);
generateMutedNoteQuery(query, user);
generateBlockedUserQuery(query, user);
generateMutedUserRenotesQueryForNotes(query, user);
generateMutedRenotesQuery(query, user);
}
if (ps.withFiles) {

View file

@ -11,7 +11,7 @@ import { generateRepliesQuery } from '../../common/generate-replies-query.js';
import { generateMutedNoteQuery } from '../../common/generate-muted-note-query.js';
import { generateChannelQuery } from '../../common/generate-channel-query.js';
import { generateBlockedUserQuery } from '../../common/generate-block-query.js';
import { generateMutedUserRenotesQueryForNotes } from '../../common/generated-muted-renote-query.js';
import { generateMutedRenotesQuery } from '../../common/generated-muted-renote-query.js';
export const meta = {
tags: ['notes'],
@ -94,7 +94,7 @@ export default define(meta, paramDef, async (ps, user) => {
generateMutedUserQuery(query, user);
generateMutedNoteQuery(query, user);
generateBlockedUserQuery(query, user);
generateMutedUserRenotesQueryForNotes(query, user);
generateMutedRenotesQuery(query, user);
if (ps.includeMyRenotes === false) {
query.andWhere(new Brackets(qb => {

View file

@ -11,7 +11,7 @@ import { generateRepliesQuery } from '../../common/generate-replies-query.js';
import { generateMutedNoteQuery } from '../../common/generate-muted-note-query.js';
import { generateChannelQuery } from '../../common/generate-channel-query.js';
import { generateBlockedUserQuery } from '../../common/generate-block-query.js';
import { generateMutedUserRenotesQueryForNotes } from '../../common/generated-muted-renote-query.js';
import { generateMutedRenotesQuery } from '../../common/generated-muted-renote-query.js';
export const meta = {
tags: ['notes'],
@ -87,7 +87,7 @@ export default define(meta, paramDef, async (ps, user) => {
if (user) generateMutedUserQuery(query, user);
if (user) generateMutedNoteQuery(query, user);
if (user) generateBlockedUserQuery(query, user);
if (user) generateMutedUserRenotesQueryForNotes(query, user);
if (user) generateMutedRenotesQuery(query, user);
if (ps.withFiles) {
query.andWhere('note.fileIds != \'{}\'');

View file

@ -9,7 +9,7 @@ import { generateRepliesQuery } from '../../common/generate-replies-query.js';
import { generateMutedNoteQuery } from '../../common/generate-muted-note-query.js';
import { generateChannelQuery } from '../../common/generate-channel-query.js';
import { generateBlockedUserQuery } from '../../common/generate-block-query.js';
import { generateMutedUserRenotesQueryForNotes } from '../../common/generated-muted-renote-query.js';
import { generateMutedRenotesQuery } from '../../common/generated-muted-renote-query.js';
export const meta = {
tags: ['notes'],
@ -86,7 +86,7 @@ export default define(meta, paramDef, async (ps, user) => {
generateMutedUserQuery(query, user);
generateMutedNoteQuery(query, user);
generateBlockedUserQuery(query, user);
generateMutedUserRenotesQueryForNotes(query, user);
generateMutedRenotesQuery(query, user);
if (ps.includeMyRenotes === false) {
query.andWhere(new Brackets(qb => {

View file

@ -46,7 +46,7 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, user) => {
const muter = user;
// 自分自身
// Check if the mutee is yourself
if (user.id === ps.userId) {
throw new ApiError(meta.errors.muteeIsYourself);
}