Merge pull request 'feat: allow users to mute their own boosts' (#9841) from naskya/calckey:allow-mute-my-boosts into develop

Reviewed-on: https://codeberg.org/calckey/calckey/pulls/9841
This commit is contained in:
Kainoa Kanter 2023-04-12 23:35:46 +00:00
commit 941b016998
3 changed files with 8 additions and 30 deletions

View file

@ -19,12 +19,6 @@ export const meta = {
id: "6fef56f3-e765-4957-88e5-c6f65329b8a5", id: "6fef56f3-e765-4957-88e5-c6f65329b8a5",
}, },
muteeIsYourself: {
message: "Mutee is yourself.",
code: "MUTEE_IS_YOURSELF",
id: "a4619cb2-5f23-484b-9301-94c903074e10",
},
alreadyMuting: { alreadyMuting: {
message: "You are already muting that user.", message: "You are already muting that user.",
code: "ALREADY_MUTING", code: "ALREADY_MUTING",
@ -45,11 +39,6 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
const muter = user; const muter = user;
// 自分自身
if (user.id === ps.userId) {
throw new ApiError(meta.errors.muteeIsYourself);
}
// Get mutee // Get mutee
const mutee = await getUser(ps.userId).catch((e) => { const mutee = await getUser(ps.userId).catch((e) => {
if (e.id === "15348ddd-432d-49c2-8a5a-8069753becff") if (e.id === "15348ddd-432d-49c2-8a5a-8069753becff")

View file

@ -17,12 +17,6 @@ export const meta = {
id: "b851d00b-8ab1-4a56-8b1b-e24187cb48ef", id: "b851d00b-8ab1-4a56-8b1b-e24187cb48ef",
}, },
muteeIsYourself: {
message: "Mutee is yourself.",
code: "MUTEE_IS_YOURSELF",
id: "f428b029-6b39-4d48-a1d2-cc1ae6dd5cf9",
},
notMuting: { notMuting: {
message: "You are not muting that user.", message: "You are not muting that user.",
code: "NOT_MUTING", code: "NOT_MUTING",
@ -43,11 +37,6 @@ export const paramDef = {
export default define(meta, paramDef, async (ps, user) => { export default define(meta, paramDef, async (ps, user) => {
const muter = user; const muter = user;
// Check if the mutee is yourself
if (user.id === ps.userId) {
throw new ApiError(meta.errors.muteeIsYourself);
}
// Get mutee // Get mutee
const mutee = await getUser(ps.userId).catch((e) => { const mutee = await getUser(ps.userId).catch((e) => {
if (e.id === "15348ddd-432d-49c2-8a5a-8069753becff") if (e.id === "15348ddd-432d-49c2-8a5a-8069753becff")

View file

@ -267,10 +267,6 @@ export function getUserMenu(user, router: Router = mainRouter) {
action: inviteGroup, action: inviteGroup,
} }
: undefined, : undefined,
] as any;
if ($i && meId !== user.id) {
menu = menu.concat([
null, null,
{ {
icon: user.isRenoteMuted icon: user.isRenoteMuted
@ -279,6 +275,10 @@ export function getUserMenu(user, router: Router = mainRouter) {
text: user.isRenoteMuted ? i18n.ts.renoteUnmute : i18n.ts.renoteMute, text: user.isRenoteMuted ? i18n.ts.renoteUnmute : i18n.ts.renoteMute,
action: toggleRenoteMute, action: toggleRenoteMute,
}, },
] as any;
if ($i && meId !== user.id) {
menu = menu.concat([
{ {
icon: user.isMuted icon: user.isMuted
? "ph-eye ph-bold ph-lg" ? "ph-eye ph-bold ph-lg"