Feat: new internal post visibility "hidden"
This commit is contained in:
parent
5fd6690755
commit
3800eb8980
11 changed files with 27 additions and 5 deletions
13
packages/backend/migration/1682891891317-AddHiddenPosts.js
Normal file
13
packages/backend/migration/1682891891317-AddHiddenPosts.js
Normal file
|
@ -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;
|
||||||
|
|
|
@ -98,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(() => {
|
||||||
|
|
|
@ -156,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(() => {
|
||||||
|
|
|
@ -128,6 +128,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
query.andWhere("note.visibility != 'hidden'");
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
|
|
|
@ -131,6 +131,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
query.andWhere("note.visibility != 'hidden'");
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
|
|
|
@ -152,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(() => {
|
||||||
|
|
|
@ -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 a new issue