fix: 일부 타임라인 옵션이 작동하지 않음

- (friendly) 알림 영역 활성화
- (friendly) 위젯 영역 활성화
- 리노트 표시
- 고양이만 보기
This commit is contained in:
NoriDev 2023-12-06 17:01:40 +09:00
parent 9b68d487d5
commit 448a19e141
9 changed files with 18 additions and 0 deletions

View file

@ -32,6 +32,7 @@ type TimelineOptions = {
excludeNoFiles?: boolean; excludeNoFiles?: boolean;
excludeReplies?: boolean; excludeReplies?: boolean;
excludePureRenotes: boolean; excludePureRenotes: boolean;
withCats: boolean;
dbFallback: (untilId: string | null, sinceId: string | null, limit: number) => Promise<MiNote[]>, dbFallback: (untilId: string | null, sinceId: string | null, limit: number) => Promise<MiNote[]>,
}; };
@ -93,6 +94,11 @@ export class FanoutTimelineEndpointService {
filter = (note) => !isPureRenote(note) && parentFilter(note); filter = (note) => !isPureRenote(note) && parentFilter(note);
} }
if (ps.withCats) {
const parentFilter = filter;
filter = (note) => (note.user ? note.user.isCat : false) && parentFilter(note);
}
if (ps.me) { if (ps.me) {
const me = ps.me; const me = ps.me;
const [ const [

View file

@ -101,6 +101,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
useDbFallback: true, useDbFallback: true,
redisTimelines: [`channelTimeline:${channel.id}`], redisTimelines: [`channelTimeline:${channel.id}`],
excludePureRenotes: false, excludePureRenotes: false,
withCats: false,
dbFallback: async (untilId, sinceId, limit) => { dbFallback: async (untilId, sinceId, limit) => {
return await this.getFromDb({ untilId, sinceId, limit, channelId: channel.id }, me); return await this.getFromDb({ untilId, sinceId, limit, channelId: channel.id }, me);
}, },

View file

@ -153,6 +153,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
useDbFallback: serverSettings.enableFanoutTimelineDbFallback, useDbFallback: serverSettings.enableFanoutTimelineDbFallback,
alwaysIncludeMyNotes: true, alwaysIncludeMyNotes: true,
excludePureRenotes: !ps.withRenotes, excludePureRenotes: !ps.withRenotes,
withCats: ps.withCats,
dbFallback: async (untilId, sinceId, limit) => await this.getFromDb({ dbFallback: async (untilId, sinceId, limit) => await this.getFromDb({
untilId, untilId,
sinceId, sinceId,

View file

@ -125,6 +125,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
: ['localTimeline'], : ['localTimeline'],
alwaysIncludeMyNotes: true, alwaysIncludeMyNotes: true,
excludePureRenotes: !ps.withRenotes, excludePureRenotes: !ps.withRenotes,
withCats: ps.withCats,
dbFallback: async (untilId, sinceId, limit) => await this.getFromDb({ dbFallback: async (untilId, sinceId, limit) => await this.getFromDb({
untilId, untilId,
sinceId, sinceId,

View file

@ -113,6 +113,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
redisTimelines: ps.withFiles ? [`homeTimelineWithFiles:${me.id}`] : [`homeTimeline:${me.id}`], redisTimelines: ps.withFiles ? [`homeTimelineWithFiles:${me.id}`] : [`homeTimeline:${me.id}`],
alwaysIncludeMyNotes: true, alwaysIncludeMyNotes: true,
excludePureRenotes: !ps.withRenotes, excludePureRenotes: !ps.withRenotes,
withCats: ps.withCats,
noteFilter: note => { noteFilter: note => {
if (note.reply && note.reply.visibility === 'followers') { if (note.reply && note.reply.visibility === 'followers') {
if (!Object.hasOwn(followings, note.reply.userId)) return false; if (!Object.hasOwn(followings, note.reply.userId)) return false;

View file

@ -129,6 +129,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
redisTimelines: ps.withFiles ? [`userListTimelineWithFiles:${list.id}`] : [`userListTimeline:${list.id}`], redisTimelines: ps.withFiles ? [`userListTimelineWithFiles:${list.id}`] : [`userListTimeline:${list.id}`],
alwaysIncludeMyNotes: true, alwaysIncludeMyNotes: true,
excludePureRenotes: !ps.withRenotes, excludePureRenotes: !ps.withRenotes,
withCats: ps.withCats,
dbFallback: async (untilId, sinceId, limit) => await this.getFromDb(list, { dbFallback: async (untilId, sinceId, limit) => await this.getFromDb(list, {
untilId, untilId,
sinceId, sinceId,

View file

@ -121,6 +121,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
excludeReplies: ps.withChannelNotes && !ps.withReplies, // userTimelineWithChannel may include replies excludeReplies: ps.withChannelNotes && !ps.withReplies, // userTimelineWithChannel may include replies
excludeNoFiles: ps.withChannelNotes && ps.withFiles, // userTimelineWithChannel may include notes without files excludeNoFiles: ps.withChannelNotes && ps.withFiles, // userTimelineWithChannel may include notes without files
excludePureRenotes: !ps.withRenotes, excludePureRenotes: !ps.withRenotes,
withCats: ps.withCats,
noteFilter: note => { noteFilter: note => {
if (note.channel?.isSensitive && !isSelf) return false; if (note.channel?.isSensitive && !isSelf) return false;
if (note.visibility === 'specified' && (!me || (me.id !== note.userId && !note.visibleUserIds.some(v => v === me.id)))) return false; if (note.visibility === 'specified' && (!me || (me.id !== note.userId && !note.visibleUserIds.some(v => v === me.id)))) return false;

View file

@ -242,14 +242,17 @@ const headerActions = $computed(() => {
type: 'switch', type: 'switch',
text: i18n.ts.friendlyEnableNotifications, text: i18n.ts.friendlyEnableNotifications,
ref: $$(friendlyEnableNotifications), ref: $$(friendlyEnableNotifications),
disabled: false,
}, { }, {
type: 'switch', type: 'switch',
text: i18n.ts.friendlyEnableWidgets, text: i18n.ts.friendlyEnableWidgets,
ref: $$(friendlyEnableWidgets), ref: $$(friendlyEnableWidgets),
disabled: false,
}, { }, {
type: 'switch', type: 'switch',
text: i18n.ts.showRenotes, text: i18n.ts.showRenotes,
ref: $$(withRenotes), ref: $$(withRenotes),
disabled: false,
}, src === 'local' || src === 'social' ? { }, src === 'local' || src === 'social' ? {
type: 'switch', type: 'switch',
text: i18n.ts.showRepliesToOthersInTimeline, text: i18n.ts.showRepliesToOthersInTimeline,
@ -264,6 +267,7 @@ const headerActions = $computed(() => {
type: 'switch', type: 'switch',
text: i18n.ts.showCatOnly, text: i18n.ts.showCatOnly,
ref: $$(onlyCats), ref: $$(onlyCats),
disabled: false,
}], ev.currentTarget ?? ev.target); }], ev.currentTarget ?? ev.target);
}, },
}, },

View file

@ -124,6 +124,7 @@ const menu = [{
type: 'switch', type: 'switch',
text: i18n.ts.showRenotes, text: i18n.ts.showRenotes,
ref: $$(withRenotes), ref: $$(withRenotes),
disabled: false,
}, props.column.tl === 'local' || props.column.tl === 'social' ? { }, props.column.tl === 'local' || props.column.tl === 'social' ? {
type: 'switch', type: 'switch',
text: i18n.ts.showRepliesToOthersInTimeline, text: i18n.ts.showRepliesToOthersInTimeline,
@ -138,6 +139,7 @@ const menu = [{
type: 'switch', type: 'switch',
text: i18n.ts.showCatOnly, text: i18n.ts.showCatOnly,
ref: $$(onlyCats), ref: $$(onlyCats),
disabled: false,
}]; }];
</script> </script>