Merge branch 'develop' into fix/word-mutes
This commit is contained in:
commit
069c789a78
|
@ -0,0 +1,13 @@
|
||||||
|
export class AddHiddenPosts1682891891317 {
|
||||||
|
name = "AddHiddenPosts1682891891317";
|
||||||
|
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(
|
||||||
|
`ALTER TYPE note_visibility_enum ADD VALUE IF NOT EXISTS 'hidden'`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TYPE note_visibility_enum REMOVE VALUE IF EXISTS 'hidden'`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -111,6 +111,7 @@ export class Note {
|
||||||
/**
|
/**
|
||||||
* public ... 公開
|
* public ... 公開
|
||||||
* home ... ホームタイムライン(ユーザーページのタイムライン含む)のみに流す
|
* home ... ホームタイムライン(ユーザーページのタイムライン含む)のみに流す
|
||||||
|
* hidden ... only visible on profile (doesnt federate, like local only, but can be fetched via AP like home) <- for now only used for post imports
|
||||||
* followers ... フォロワーのみ
|
* followers ... フォロワーのみ
|
||||||
* specified ... visibleUserIds で指定したユーザーのみ
|
* specified ... visibleUserIds で指定したユーザーのみ
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -65,7 +65,7 @@ export async function importPosts(
|
||||||
renote: null,
|
renote: null,
|
||||||
cw: cw,
|
cw: cw,
|
||||||
localOnly,
|
localOnly,
|
||||||
visibility: "public",
|
visibility: "hidden",
|
||||||
visibleUsers: [],
|
visibleUsers: [],
|
||||||
channel: null,
|
channel: null,
|
||||||
apMentions: new Array(0),
|
apMentions: new Array(0),
|
||||||
|
@ -109,7 +109,7 @@ export async function importPosts(
|
||||||
renote: null,
|
renote: null,
|
||||||
cw: post.sensitive,
|
cw: post.sensitive,
|
||||||
localOnly: false,
|
localOnly: false,
|
||||||
visibility: "public",
|
visibility: "hidden",
|
||||||
visibleUsers: [],
|
visibleUsers: [],
|
||||||
channel: null,
|
channel: null,
|
||||||
apMentions: new Array(0),
|
apMentions: new Array(0),
|
||||||
|
|
|
@ -686,7 +686,7 @@ export async function updateNote(value: string | IObject, resolver?: Resolver) {
|
||||||
multiple: poll?.multiple,
|
multiple: poll?.multiple,
|
||||||
votes: poll?.votes,
|
votes: poll?.votes,
|
||||||
expiresAt: poll?.expiresAt,
|
expiresAt: poll?.expiresAt,
|
||||||
noteVisibility: note.visibility,
|
noteVisibility: note.visibility === "hidden" ? "home" : note.visibility,
|
||||||
userId: actor.id,
|
userId: actor.id,
|
||||||
userHost: actor.host,
|
userHost: actor.host,
|
||||||
});
|
});
|
||||||
|
@ -704,7 +704,7 @@ export async function updateNote(value: string | IObject, resolver?: Resolver) {
|
||||||
multiple: poll?.multiple,
|
multiple: poll?.multiple,
|
||||||
votes: poll?.votes,
|
votes: poll?.votes,
|
||||||
expiresAt: poll?.expiresAt,
|
expiresAt: poll?.expiresAt,
|
||||||
noteVisibility: note.visibility,
|
noteVisibility: note.visibility === "hidden" ? "home" : note.visibility,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
updating = true;
|
updating = true;
|
||||||
|
|
|
@ -32,6 +32,11 @@ export const meta = {
|
||||||
code: "GTL_DISABLED",
|
code: "GTL_DISABLED",
|
||||||
id: "0332fc13-6ab2-4427-ae80-a9fadffd1a6b",
|
id: "0332fc13-6ab2-4427-ae80-a9fadffd1a6b",
|
||||||
},
|
},
|
||||||
|
queryError: {
|
||||||
|
message: "Please follow more users.",
|
||||||
|
code: "QUERY_ERROR",
|
||||||
|
id: "620763f4-f621-4533-ab33-0577a1a3c343",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -93,6 +98,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
if (ps.withFiles) {
|
if (ps.withFiles) {
|
||||||
query.andWhere("note.fileIds != '{}'");
|
query.andWhere("note.fileIds != '{}'");
|
||||||
}
|
}
|
||||||
|
query.andWhere("note.visibility != 'hidden'");
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
|
@ -106,11 +112,15 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
const found = [];
|
const found = [];
|
||||||
const take = Math.floor(ps.limit * 1.5);
|
const take = Math.floor(ps.limit * 1.5);
|
||||||
let skip = 0;
|
let skip = 0;
|
||||||
while (found.length < ps.limit) {
|
try {
|
||||||
const notes = await query.take(take).skip(skip).getMany();
|
while (found.length < ps.limit) {
|
||||||
found.push(...(await Notes.packMany(notes, user)));
|
const notes = await query.take(take).skip(skip).getMany();
|
||||||
skip += take;
|
found.push(...(await Notes.packMany(notes, user)));
|
||||||
if (notes.length < take) break;
|
skip += take;
|
||||||
|
if (notes.length < take) break;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
throw new ApiError(meta.errors.queryError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found.length > ps.limit) {
|
if (found.length > ps.limit) {
|
||||||
|
|
|
@ -36,6 +36,11 @@ export const meta = {
|
||||||
code: "STL_DISABLED",
|
code: "STL_DISABLED",
|
||||||
id: "620763f4-f621-4533-ab33-0577a1a3c342",
|
id: "620763f4-f621-4533-ab33-0577a1a3c342",
|
||||||
},
|
},
|
||||||
|
queryError: {
|
||||||
|
message: "Please follow more users.",
|
||||||
|
code: "QUERY_ERROR",
|
||||||
|
id: "620763f4-f621-4533-ab33-0577a1a3c343",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -151,6 +156,8 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
if (ps.withFiles) {
|
if (ps.withFiles) {
|
||||||
query.andWhere("note.fileIds != '{}'");
|
query.andWhere("note.fileIds != '{}'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
query.andWhere("note.visibility != 'hidden'");
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
|
@ -162,11 +169,15 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
const found = [];
|
const found = [];
|
||||||
const take = Math.floor(ps.limit * 1.5);
|
const take = Math.floor(ps.limit * 1.5);
|
||||||
let skip = 0;
|
let skip = 0;
|
||||||
while (found.length < ps.limit) {
|
try {
|
||||||
const notes = await query.take(take).skip(skip).getMany();
|
while (found.length < ps.limit) {
|
||||||
found.push(...(await Notes.packMany(notes, user)));
|
const notes = await query.take(take).skip(skip).getMany();
|
||||||
skip += take;
|
found.push(...(await Notes.packMany(notes, user)));
|
||||||
if (notes.length < take) break;
|
skip += take;
|
||||||
|
if (notes.length < take) break;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
throw new ApiError(meta.errors.queryError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found.length > ps.limit) {
|
if (found.length > ps.limit) {
|
||||||
|
|
|
@ -35,6 +35,11 @@ export const meta = {
|
||||||
code: "LTL_DISABLED",
|
code: "LTL_DISABLED",
|
||||||
id: "45a6eb02-7695-4393-b023-dd3be9aaaefd",
|
id: "45a6eb02-7695-4393-b023-dd3be9aaaefd",
|
||||||
},
|
},
|
||||||
|
queryError: {
|
||||||
|
message: "Please follow more users.",
|
||||||
|
code: "QUERY_ERROR",
|
||||||
|
id: "620763f4-f621-4533-ab33-0577a1a3c343",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -123,6 +128,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
query.andWhere("note.visibility != 'hidden'");
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
|
@ -136,11 +142,15 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
const found = [];
|
const found = [];
|
||||||
const take = Math.floor(ps.limit * 1.5);
|
const take = Math.floor(ps.limit * 1.5);
|
||||||
let skip = 0;
|
let skip = 0;
|
||||||
while (found.length < ps.limit) {
|
try {
|
||||||
const notes = await query.take(take).skip(skip).getMany();
|
while (found.length < ps.limit) {
|
||||||
found.push(...(await Notes.packMany(notes, user)));
|
const notes = await query.take(take).skip(skip).getMany();
|
||||||
skip += take;
|
found.push(...(await Notes.packMany(notes, user)));
|
||||||
if (notes.length < take) break;
|
skip += take;
|
||||||
|
if (notes.length < take) break;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
throw new ApiError(meta.errors.queryError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found.length > ps.limit) {
|
if (found.length > ps.limit) {
|
||||||
|
|
|
@ -35,6 +35,11 @@ export const meta = {
|
||||||
code: "RTL_DISABLED",
|
code: "RTL_DISABLED",
|
||||||
id: "45a6eb02-7695-4393-b023-dd3be9aaaefe",
|
id: "45a6eb02-7695-4393-b023-dd3be9aaaefe",
|
||||||
},
|
},
|
||||||
|
queryError: {
|
||||||
|
message: "Please follow more users.",
|
||||||
|
code: "QUERY_ERROR",
|
||||||
|
id: "620763f4-f621-4533-ab33-0577a1a3c343",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -126,6 +131,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
query.andWhere("note.visibility != 'hidden'");
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
|
@ -139,11 +145,15 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
const found = [];
|
const found = [];
|
||||||
const take = Math.floor(ps.limit * 1.5);
|
const take = Math.floor(ps.limit * 1.5);
|
||||||
let skip = 0;
|
let skip = 0;
|
||||||
while (found.length < ps.limit) {
|
try {
|
||||||
const notes = await query.take(take).skip(skip).getMany();
|
while (found.length < ps.limit) {
|
||||||
found.push(...(await Notes.packMany(notes, user)));
|
const notes = await query.take(take).skip(skip).getMany();
|
||||||
skip += take;
|
found.push(...(await Notes.packMany(notes, user)));
|
||||||
if (notes.length < take) break;
|
skip += take;
|
||||||
|
if (notes.length < take) break;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
throw new ApiError(meta.errors.queryError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found.length > ps.limit) {
|
if (found.length > ps.limit) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { generateMutedNoteQuery } from "../../common/generate-muted-note-query.j
|
||||||
import { generateChannelQuery } from "../../common/generate-channel-query.js";
|
import { generateChannelQuery } from "../../common/generate-channel-query.js";
|
||||||
import { generateBlockedUserQuery } from "../../common/generate-block-query.js";
|
import { generateBlockedUserQuery } from "../../common/generate-block-query.js";
|
||||||
import { generateMutedUserRenotesQueryForNotes } from "../../common/generated-muted-renote-query.js";
|
import { generateMutedUserRenotesQueryForNotes } from "../../common/generated-muted-renote-query.js";
|
||||||
|
import { ApiError } from "../../error.js";
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ["notes"],
|
tags: ["notes"],
|
||||||
|
@ -27,6 +28,14 @@ export const meta = {
|
||||||
ref: "Note",
|
ref: "Note",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
queryError: {
|
||||||
|
message: "Please follow more users.",
|
||||||
|
code: "QUERY_ERROR",
|
||||||
|
id: "620763f4-f621-4533-ab33-0577a1a3c343",
|
||||||
|
},
|
||||||
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export const paramDef = {
|
export const paramDef = {
|
||||||
|
@ -143,6 +152,8 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
if (ps.withFiles) {
|
if (ps.withFiles) {
|
||||||
query.andWhere("note.fileIds != '{}'");
|
query.andWhere("note.fileIds != '{}'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
query.andWhere("note.visibility != 'hidden'");
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
|
@ -154,11 +165,15 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
const found = [];
|
const found = [];
|
||||||
const take = Math.floor(ps.limit * 1.5);
|
const take = Math.floor(ps.limit * 1.5);
|
||||||
let skip = 0;
|
let skip = 0;
|
||||||
while (found.length < ps.limit) {
|
try {
|
||||||
const notes = await query.take(take).skip(skip).getMany();
|
while (found.length < ps.limit) {
|
||||||
found.push(...(await Notes.packMany(notes, user)));
|
const notes = await query.take(take).skip(skip).getMany();
|
||||||
skip += take;
|
found.push(...(await Notes.packMany(notes, user)));
|
||||||
if (notes.length < take) break;
|
skip += take;
|
||||||
|
if (notes.length < take) break;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
throw new ApiError(meta.errors.queryError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found.length > ps.limit) {
|
if (found.length > ps.limit) {
|
||||||
|
|
|
@ -29,6 +29,11 @@ export const meta = {
|
||||||
code: "NO_SUCH_LIST",
|
code: "NO_SUCH_LIST",
|
||||||
id: "8fb1fbd5-e476-4c37-9fb0-43d55b63a2ff",
|
id: "8fb1fbd5-e476-4c37-9fb0-43d55b63a2ff",
|
||||||
},
|
},
|
||||||
|
queryError: {
|
||||||
|
message: "Please follow more users.",
|
||||||
|
code: "QUERY_ERROR",
|
||||||
|
id: "620763f4-f621-4533-ab33-0577a1a3c343",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -149,11 +154,15 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
const found = [];
|
const found = [];
|
||||||
const take = Math.floor(ps.limit * 1.5);
|
const take = Math.floor(ps.limit * 1.5);
|
||||||
let skip = 0;
|
let skip = 0;
|
||||||
while (found.length < ps.limit) {
|
try {
|
||||||
const notes = await query.take(take).skip(skip).getMany();
|
while (found.length < ps.limit) {
|
||||||
found.push(...(await Notes.packMany(notes, user)));
|
const notes = await query.take(take).skip(skip).getMany();
|
||||||
skip += take;
|
found.push(...(await Notes.packMany(notes, user)));
|
||||||
if (notes.length < take) break;
|
skip += take;
|
||||||
|
if (notes.length < take) break;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
throw new ApiError(meta.errors.queryError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found.length > ps.limit) {
|
if (found.length > ps.limit) {
|
||||||
|
|
|
@ -29,6 +29,7 @@ export default class extends Channel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async onNote(note: Packed<"Note">) {
|
private async onNote(note: Packed<"Note">) {
|
||||||
|
if (note.visibility === "hidden") return;
|
||||||
if (note.channelId !== this.channelId) return;
|
if (note.channelId !== this.channelId) return;
|
||||||
|
|
||||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||||
|
|
|
@ -24,6 +24,7 @@ export default class extends Channel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async onNote(note: Packed<"Note">) {
|
private async onNote(note: Packed<"Note">) {
|
||||||
|
if (note.visibility === "hidden") return;
|
||||||
const noteTags = note.tags
|
const noteTags = note.tags
|
||||||
? note.tags.map((t: string) => t.toLowerCase())
|
? note.tags.map((t: string) => t.toLowerCase())
|
||||||
: [];
|
: [];
|
||||||
|
|
|
@ -20,6 +20,7 @@ export default class extends Channel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async onNote(note: Packed<"Note">) {
|
private async onNote(note: Packed<"Note">) {
|
||||||
|
if (note.visibility === "hidden") return;
|
||||||
if (note.channelId) {
|
if (note.channelId) {
|
||||||
if (!this.followingChannels.has(note.channelId)) return;
|
if (!this.followingChannels.has(note.channelId)) return;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -29,6 +29,7 @@ export default class extends Channel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async onNote(note: Packed<"Note">) {
|
private async onNote(note: Packed<"Note">) {
|
||||||
|
if (note.visibility === "hidden") return;
|
||||||
// チャンネルの投稿ではなく、自分自身の投稿 または
|
// チャンネルの投稿ではなく、自分自身の投稿 または
|
||||||
// チャンネルの投稿ではなく、その投稿のユーザーをフォローしている または
|
// チャンネルの投稿ではなく、その投稿のユーザーをフォローしている または
|
||||||
// チャンネルの投稿ではなく、全体公開のローカルの投稿 または
|
// チャンネルの投稿ではなく、全体公開のローカルの投稿 または
|
||||||
|
|
|
@ -29,6 +29,7 @@ export default class extends Channel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async onNote(note: Packed<"Note">) {
|
private async onNote(note: Packed<"Note">) {
|
||||||
|
if (note.visibility === "hidden") return;
|
||||||
// チャンネルの投稿ではなく、自分自身の投稿 または
|
// チャンネルの投稿ではなく、自分自身の投稿 または
|
||||||
// チャンネルの投稿ではなく、その投稿のユーザーをフォローしている または
|
// チャンネルの投稿ではなく、その投稿のユーザーをフォローしている または
|
||||||
// チャンネルの投稿ではなく、全体公開のローカルの投稿 または
|
// チャンネルの投稿ではなく、全体公開のローカルの投稿 または
|
||||||
|
|
|
@ -49,6 +49,7 @@ export default class extends Channel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async onNote(note: Packed<"Note">) {
|
private async onNote(note: Packed<"Note">) {
|
||||||
|
if (note.visibility === "hidden") return;
|
||||||
if (!this.listUsers.includes(note.userId)) return;
|
if (!this.listUsers.includes(note.userId)) return;
|
||||||
|
|
||||||
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
// 流れてきたNoteがミュートしているユーザーが関わるものだったら無視する
|
||||||
|
|
|
@ -144,7 +144,7 @@ export default async (
|
||||||
});
|
});
|
||||||
|
|
||||||
//#region deliver
|
//#region deliver
|
||||||
if (Users.isLocalUser(user) && !note.localOnly) {
|
if (Users.isLocalUser(user) && !note.localOnly && note.visibility !== "hidden") {
|
||||||
const content = renderActivity(await renderLike(record, note));
|
const content = renderActivity(await renderLike(record, note));
|
||||||
const dm = new DeliverManager(user, content);
|
const dm = new DeliverManager(user, content);
|
||||||
if (note.userHost !== null) {
|
if (note.userHost !== null) {
|
||||||
|
|
|
@ -18,6 +18,7 @@ export const noteVisibilities = [
|
||||||
"home",
|
"home",
|
||||||
"followers",
|
"followers",
|
||||||
"specified",
|
"specified",
|
||||||
|
"hidden",
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export const mutedNoteReasons = ["word", "manual", "spam", "other"] as const;
|
export const mutedNoteReasons = ["word", "manual", "spam", "other"] as const;
|
||||||
|
|
Loading…
Reference in New Issue