summaryrefslogtreecommitdiff
path: root/packages/backend
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend')
-rw-r--r--packages/backend/src/server/api/endpoints/notes/bubble-timeline.ts11
-rw-r--r--packages/backend/src/server/api/stream/channel.ts3
-rw-r--r--packages/backend/src/server/api/stream/channels/bubble-timeline.ts11
3 files changed, 21 insertions, 4 deletions
diff --git a/packages/backend/src/server/api/endpoints/notes/bubble-timeline.ts b/packages/backend/src/server/api/endpoints/notes/bubble-timeline.ts
index 2677143a49..17c9b31c90 100644
--- a/packages/backend/src/server/api/endpoints/notes/bubble-timeline.ts
+++ b/packages/backend/src/server/api/endpoints/notes/bubble-timeline.ts
@@ -81,7 +81,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
ps.sinceId, ps.untilId, ps.sinceDate, ps.untilDate)
.andWhere('note.visibility = \'public\'')
.andWhere('note.channelId IS NULL')
- .andWhere('note.userHost IS NULL')
+ .andWhere('note.userHost IS NOT NULL')
.andWhere('userInstance.isBubbled = true') // This comes from generateBlockedHostQueryForNote below
.innerJoinAndSelect('note.user', 'user')
.leftJoinAndSelect('note.reply', 'reply')
@@ -94,6 +94,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (me) this.queryService.generateMutedUserQueryForNotes(query, me);
if (me) this.queryService.generateBlockedUserQueryForNotes(query, me);
if (me) this.queryService.generateMutedUserRenotesQueryForNotes(query, me);
+ if (!me) query.andWhere('user.requireSigninToViewContents = false');
if (ps.withFiles) {
query.andWhere('note.fileIds != \'{}\'');
@@ -115,7 +116,13 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
let timeline = await query.limit(ps.limit).getMany();
timeline = timeline.filter(note => {
- if (note.user?.isSilenced && me && followings && note.userId !== me.id && !followings[note.userId]) return false;
+ if (note.user?.isSilenced) {
+ if (!me) return false;
+ if (!followings) return false;
+ if (note.userId !== me.id) {
+ return followings[note.userId];
+ }
+ }
return true;
});
diff --git a/packages/backend/src/server/api/stream/channel.ts b/packages/backend/src/server/api/stream/channel.ts
index 9af816dfbb..204ea9f705 100644
--- a/packages/backend/src/server/api/stream/channel.ts
+++ b/packages/backend/src/server/api/stream/channel.ts
@@ -65,6 +65,9 @@ export default abstract class Channel {
* ミュートとブロックされてるを処理する
*/
protected isNoteMutedOrBlocked(note: Packed<'Note'>): boolean {
+ // Ignore notes that require sign-in
+ if (note.user.requireSigninToViewContents && !this.user) return true;
+
// 流れてきたNoteがインスタンスミュートしたインスタンスが関わる
if (isInstanceMuted(note, new Set<string>(this.userProfile?.mutedInstances ?? [])) && !this.following[note.userId]) return true;
diff --git a/packages/backend/src/server/api/stream/channels/bubble-timeline.ts b/packages/backend/src/server/api/stream/channels/bubble-timeline.ts
index d29101cbc5..88cb9937b3 100644
--- a/packages/backend/src/server/api/stream/channels/bubble-timeline.ts
+++ b/packages/backend/src/server/api/stream/channels/bubble-timeline.ts
@@ -12,6 +12,7 @@ import { RoleService } from '@/core/RoleService.js';
import type { MiMeta } from '@/models/Meta.js';
import { isRenotePacked, isQuotePacked } from '@/misc/is-renote.js';
import type { JsonObject } from '@/misc/json-value.js';
+import { UtilityService } from '@/core/UtilityService.js';
import Channel, { MiChannelService } from '../channel.js';
class BubbleTimelineChannel extends Channel {
@@ -26,6 +27,7 @@ class BubbleTimelineChannel extends Channel {
constructor(
private metaService: MetaService,
private roleService: RoleService,
+ private readonly utilityService: UtilityService,
noteEntityService: NoteEntityService,
id: string,
@@ -56,12 +58,15 @@ class BubbleTimelineChannel extends Channel {
if (note.visibility !== 'public') return;
if (note.channelId != null) return;
if (note.user.host == null) return;
- if (!this.instance.bubbleInstances.includes(note.user.host)) return;
+ if (!this.utilityService.isBubbledHost(note.user.host)) return;
if (note.user.requireSigninToViewContents && this.user == null) return;
if (isRenotePacked(note) && !isQuotePacked(note) && !this.withRenotes) return;
- if (note.user.isSilenced && !this.following[note.userId] && note.userId !== this.user!.id) return;
+ if (note.user.isSilenced) {
+ if (!this.user) return;
+ if (note.userId !== this.user.id && !this.following[note.userId]) return;
+ }
if (this.isNoteMutedOrBlocked(note)) return;
@@ -88,6 +93,7 @@ export class BubbleTimelineChannelService implements MiChannelService<false> {
private metaService: MetaService,
private roleService: RoleService,
private noteEntityService: NoteEntityService,
+ private readonly utilityService: UtilityService,
) {
}
@@ -96,6 +102,7 @@ export class BubbleTimelineChannelService implements MiChannelService<false> {
return new BubbleTimelineChannel(
this.metaService,
this.roleService,
+ this.utilityService,
this.noteEntityService,
id,
connection,