friendly unfriend message

This commit is contained in:
pa
2025-12-16 20:29:48 +09:00
committed by Natsumi
parent 42547b43fb
commit b7c97efeda
4 changed files with 14 additions and 7 deletions

View File

@@ -63,9 +63,10 @@ const friendReq = {
* @param {{ userId: string }} params
* @returns {Promise<{json: any, params: { userId: string }}>}
*/
deleteFriend(params) {
deleteFriend(params, customMsg) {
return request(`auth/user/friends/${params.userId}`, {
method: 'DELETE'
method: 'DELETE',
customMsg
}).then((json) => {
const args = {
json,

View File

@@ -2110,9 +2110,12 @@
reportUserForHacking(userId);
break;
case 'Unfriend':
args = await friendRequest.deleteFriend({
userId
});
args = await friendRequest.deleteFriend(
{
userId
},
t('dialog.user.actions.unfriend_success_msg')
);
handleFriendDelete(args);
break;
}

View File

@@ -947,6 +947,7 @@
"edit_pronouns": "Pronouns",
"report_hacking": "Report For Hacking",
"unfriend": "Unfriend",
"unfriend_success_msg": "Unfriended",
"logout": "Logout"
},
"info": {

View File

@@ -25,7 +25,7 @@ const t = i18n.global.t;
/**
* @template T
* @param {string} endpoint
* @param {RequestInit & { params?: any }} [options]
* @param {RequestInit & { params?: any } & {customMsg?: string}} [options]
* @returns {Promise<T>}
*/
export function request(endpoint, options) {
@@ -159,7 +159,9 @@ export function request(endpoint, options) {
if (text) {
new Noty({
type: 'success',
text: escapeTag(text)
text: options.customMsg
? options.customMsg
: escapeTag(text)
}).show();
}
return data;