mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 20:44:34 +00:00
copy changes to role channel
This commit is contained in:
parent
2e5792f213
commit
00a9233229
1 changed files with 22 additions and 0 deletions
|
@ -9,6 +9,7 @@ import { bindThis } from '@/decorators.js';
|
||||||
import { RoleService } from '@/core/RoleService.js';
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
||||||
import type { JsonObject } from '@/misc/json-value.js';
|
import type { JsonObject } from '@/misc/json-value.js';
|
||||||
|
import { isQuotePacked, isRenotePacked } from '@/misc/is-renote.js';
|
||||||
import Channel, { type MiChannelService } from '../channel.js';
|
import Channel, { type MiChannelService } from '../channel.js';
|
||||||
|
|
||||||
class RoleTimelineChannel extends Channel {
|
class RoleTimelineChannel extends Channel {
|
||||||
|
@ -40,7 +41,9 @@ class RoleTimelineChannel extends Channel {
|
||||||
private async onEvent(data: GlobalEvents['roleTimeline']['payload']) {
|
private async onEvent(data: GlobalEvents['roleTimeline']['payload']) {
|
||||||
if (data.type === 'note') {
|
if (data.type === 'note') {
|
||||||
const note = data.body;
|
const note = data.body;
|
||||||
|
const isMe = this.user?.id === note.userId;
|
||||||
|
|
||||||
|
// TODO this should be cached
|
||||||
if (!(await this.roleservice.isExplorable({ id: this.roleId }))) {
|
if (!(await this.roleservice.isExplorable({ id: this.roleId }))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +51,25 @@ class RoleTimelineChannel extends Channel {
|
||||||
|
|
||||||
if (this.isNoteMutedOrBlocked(note)) return;
|
if (this.isNoteMutedOrBlocked(note)) return;
|
||||||
|
|
||||||
|
if (note.reply) {
|
||||||
|
const reply = note.reply;
|
||||||
|
// 自分のフォローしていないユーザーの visibility: followers な投稿への返信は弾く
|
||||||
|
if (!this.isNoteVisibleToMe(reply)) return;
|
||||||
|
if (!this.following[note.userId]?.withReplies) {
|
||||||
|
// 「チャンネル接続主への返信」でもなければ、「チャンネル接続主が行った返信」でもなければ、「投稿者の投稿者自身への返信」でもない場合
|
||||||
|
if (reply.userId !== this.user?.id && !isMe && reply.userId !== note.userId) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 純粋なリノート(引用リノートでないリノート)の場合
|
||||||
|
if (isRenotePacked(note) && !isQuotePacked(note) && note.renote) {
|
||||||
|
if (note.renote.reply) {
|
||||||
|
const reply = note.renote.reply;
|
||||||
|
// 自分のフォローしていないユーザーの visibility: followers な投稿への返信のリノートは弾く
|
||||||
|
if (!this.isNoteVisibleToMe(reply)) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const clonedNote = await this.assignMyReaction(note);
|
const clonedNote = await this.assignMyReaction(note);
|
||||||
await this.hideNote(clonedNote);
|
await this.hideNote(clonedNote);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue