server: add diagnostics for failing visibility
Some checks failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-sw Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline failed
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/lint-backend Pipeline failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/lint-sw Pipeline failed
Some checks failed
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-sw Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline failed
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/lint-backend Pipeline failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline failed
ci/woodpecker/pr/lint-sw Pipeline failed
This commit is contained in:
parent
d7d10ccd60
commit
aece832c86
3 changed files with 16 additions and 1 deletions
|
@ -11,6 +11,7 @@ import { NoteReaction } from '@/models/entities/note-reaction.js';
|
||||||
import { User } from '@/models/entities/user.js';
|
import { User } from '@/models/entities/user.js';
|
||||||
import { awaitAll } from '@/prelude/await-all.js';
|
import { awaitAll } from '@/prelude/await-all.js';
|
||||||
import { Users, PollVotes, DriveFiles, NoteReactions, Followings, Polls, Channels } from '../index.js';
|
import { Users, PollVotes, DriveFiles, NoteReactions, Followings, Polls, Channels } from '../index.js';
|
||||||
|
import { apiLogger } from '@/server/api/logger.js';
|
||||||
|
|
||||||
async function populatePoll(note: Note, meId: User['id'] | null) {
|
async function populatePoll(note: Note, meId: User['id'] | null) {
|
||||||
const poll = await Polls.findOneByOrFail({ noteId: note.id });
|
const poll = await Polls.findOneByOrFail({ noteId: note.id });
|
||||||
|
@ -270,6 +271,13 @@ export const NoteRepository = db.getRepository(Note).extend({
|
||||||
})));
|
})));
|
||||||
|
|
||||||
// filter out rejected promises, only keep fulfilled values
|
// filter out rejected promises, only keep fulfilled values
|
||||||
return promises.flatMap(result => result.status === 'fulfilled' ? [result.value] : []);
|
return promises.flatMap((result, i) => {
|
||||||
|
if (result.status === 'fulfilled') {
|
||||||
|
return [result.value];
|
||||||
|
} else {
|
||||||
|
apiLogger.error(`dropping note due to violating visibility restrictions, note ${notes[i].id} user ${meId}`);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||||
import { User } from '@/models/entities/user.js';
|
import { User } from '@/models/entities/user.js';
|
||||||
import { Note } from '@/models/entities/note.js';
|
import { Note } from '@/models/entities/note.js';
|
||||||
import { Notes, Users } from '@/models/index.js';
|
import { Notes, Users } from '@/models/index.js';
|
||||||
|
import { apiLogger } from '@/server/api/logger.js';
|
||||||
import { visibilityQuery } from './generate-visibility-query.js';
|
import { visibilityQuery } from './generate-visibility-query.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,6 +17,7 @@ export async function getNote(noteId: Note['id'], me: { id: User['id'] } | null)
|
||||||
const note = await visibilityQuery(query, me).getOne();
|
const note = await visibilityQuery(query, me).getOne();
|
||||||
|
|
||||||
if (note == null) {
|
if (note == null) {
|
||||||
|
apiLogger.error(`user ${me.id} tried to view note ${noteId} violating visibility restrictions`);
|
||||||
throw new IdentifiableError('9725d0ce-ba28-4dde-95a7-2cbb2c15de24', 'No such note.');
|
throw new IdentifiableError('9725d0ce-ba28-4dde-95a7-2cbb2c15de24', 'No such note.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { generateMutedNoteQuery } from '@/server/api/common/generate-muted-note-
|
||||||
import { generateChannelQuery } from '@/server/api/common/generate-channel-query.js';
|
import { generateChannelQuery } from '@/server/api/common/generate-channel-query.js';
|
||||||
import { generateBlockedUserQuery } from '@/server/api/common/generate-block-query.js';
|
import { generateBlockedUserQuery } from '@/server/api/common/generate-block-query.js';
|
||||||
import { generateMutedRenotesQuery } from '@/server/api/common/generated-muted-renote-query.js';
|
import { generateMutedRenotesQuery } from '@/server/api/common/generated-muted-renote-query.js';
|
||||||
|
import { apiLogger } from '@/server/api/logger.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['notes'],
|
tags: ['notes'],
|
||||||
|
@ -124,6 +125,10 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
|
|
||||||
const timeline = await visibilityQuery(query, user).take(ps.limit).getMany();
|
const timeline = await visibilityQuery(query, user).take(ps.limit).getMany();
|
||||||
|
|
||||||
|
if (timeline.length < ps.limit) {
|
||||||
|
apiLogger.warn(`notes missing from TL for user ${user.id}?`);
|
||||||
|
}
|
||||||
|
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
activeUsersChart.read(user);
|
activeUsersChart.read(user);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue