wip
This commit is contained in:
@@ -13,12 +13,12 @@ export function getUserMenu(user) {
|
||||
const meId = $i ? $i.id : null;
|
||||
|
||||
async function pushList() {
|
||||
const t = i18n.global.t('selectList'); // なぜか後で参照すると null になるので最初にメモリに確保しておく
|
||||
const t = i18n.locale.selectList; // なぜか後で参照すると null になるので最初にメモリに確保しておく
|
||||
const lists = await os.api('users/lists/list');
|
||||
if (lists.length === 0) {
|
||||
os.dialog({
|
||||
type: 'error',
|
||||
text: i18n.global.t('youHaveNoLists')
|
||||
text: i18n.locale.youHaveNoLists
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -44,13 +44,13 @@ export function getUserMenu(user) {
|
||||
if (groups.length === 0) {
|
||||
os.dialog({
|
||||
type: 'error',
|
||||
text: i18n.global.t('youHaveNoGroups')
|
||||
text: i18n.locale.youHaveNoGroups
|
||||
});
|
||||
return;
|
||||
}
|
||||
const { canceled, result: groupId } = await os.dialog({
|
||||
type: null,
|
||||
title: i18n.global.t('group'),
|
||||
title: i18n.locale.group,
|
||||
select: {
|
||||
items: groups.map(group => ({
|
||||
value: group.id, text: group.name
|
||||
@@ -74,7 +74,7 @@ export function getUserMenu(user) {
|
||||
}
|
||||
|
||||
async function toggleBlock() {
|
||||
if (!await getConfirmed(user.isBlocking ? i18n.global.t('unblockConfirm') : i18n.global.t('blockConfirm'))) return;
|
||||
if (!await getConfirmed(user.isBlocking ? i18n.locale.unblockConfirm : i18n.locale.blockConfirm)) return;
|
||||
|
||||
os.apiWithDialog(user.isBlocking ? 'blocking/delete' : 'blocking/create', {
|
||||
userId: user.id
|
||||
@@ -84,7 +84,7 @@ export function getUserMenu(user) {
|
||||
}
|
||||
|
||||
async function toggleSilence() {
|
||||
if (!await getConfirmed(i18n.global.t(user.isSilenced ? 'unsilenceConfirm' : 'silenceConfirm'))) return;
|
||||
if (!await getConfirmed(i18n.t(user.isSilenced ? 'unsilenceConfirm' : 'silenceConfirm'))) return;
|
||||
|
||||
os.apiWithDialog(user.isSilenced ? 'admin/unsilence-user' : 'admin/silence-user', {
|
||||
userId: user.id
|
||||
@@ -94,7 +94,7 @@ export function getUserMenu(user) {
|
||||
}
|
||||
|
||||
async function toggleSuspend() {
|
||||
if (!await getConfirmed(i18n.global.t(user.isSuspended ? 'unsuspendConfirm' : 'suspendConfirm'))) return;
|
||||
if (!await getConfirmed(i18n.t(user.isSuspended ? 'unsuspendConfirm' : 'suspendConfirm'))) return;
|
||||
|
||||
os.apiWithDialog(user.isSuspended ? 'admin/unsuspend-user' : 'admin/suspend-user', {
|
||||
userId: user.id
|
||||
@@ -122,56 +122,56 @@ export function getUserMenu(user) {
|
||||
|
||||
let menu = [{
|
||||
icon: faAt,
|
||||
text: i18n.global.t('copyUsername'),
|
||||
text: i18n.locale.copyUsername,
|
||||
action: () => {
|
||||
copyToClipboard(`@${user.username}@${user.host || host}`);
|
||||
}
|
||||
}, {
|
||||
icon: faEnvelope,
|
||||
text: i18n.global.t('sendMessage'),
|
||||
text: i18n.locale.sendMessage,
|
||||
action: () => {
|
||||
os.post({ specified: user });
|
||||
}
|
||||
}, meId != user.id ? {
|
||||
type: 'link',
|
||||
icon: faComments,
|
||||
text: i18n.global.t('startMessaging'),
|
||||
text: i18n.locale.startMessaging,
|
||||
to: '/my/messaging/' + getAcct(user),
|
||||
} : undefined, null, {
|
||||
icon: faListUl,
|
||||
text: i18n.global.t('addToList'),
|
||||
text: i18n.locale.addToList,
|
||||
action: pushList
|
||||
}, meId != user.id ? {
|
||||
icon: faUsers,
|
||||
text: i18n.global.t('inviteToGroup'),
|
||||
text: i18n.locale.inviteToGroup,
|
||||
action: inviteGroup
|
||||
} : undefined] as any;
|
||||
|
||||
if ($i && meId != user.id) {
|
||||
menu = menu.concat([null, {
|
||||
icon: user.isMuted ? faEye : faEyeSlash,
|
||||
text: user.isMuted ? i18n.global.t('unmute') : i18n.global.t('mute'),
|
||||
text: user.isMuted ? i18n.locale.unmute : i18n.locale.mute,
|
||||
action: toggleMute
|
||||
}, {
|
||||
icon: faBan,
|
||||
text: user.isBlocking ? i18n.global.t('unblock') : i18n.global.t('block'),
|
||||
text: user.isBlocking ? i18n.locale.unblock : i18n.locale.block,
|
||||
action: toggleBlock
|
||||
}]);
|
||||
|
||||
menu = menu.concat([null, {
|
||||
icon: faExclamationCircle,
|
||||
text: i18n.global.t('reportAbuse'),
|
||||
text: i18n.locale.reportAbuse,
|
||||
action: reportAbuse
|
||||
}]);
|
||||
|
||||
if ($i && ($i.isAdmin || $i.isModerator)) {
|
||||
menu = menu.concat([null, {
|
||||
icon: faMicrophoneSlash,
|
||||
text: user.isSilenced ? i18n.global.t('unsilence') : i18n.global.t('silence'),
|
||||
text: user.isSilenced ? i18n.locale.unsilence : i18n.locale.silence,
|
||||
action: toggleSilence
|
||||
}, {
|
||||
icon: faSnowflake,
|
||||
text: user.isSuspended ? i18n.global.t('unsuspend') : i18n.global.t('suspend'),
|
||||
text: user.isSuspended ? i18n.locale.unsuspend : i18n.locale.suspend,
|
||||
action: toggleSuspend
|
||||
}]);
|
||||
}
|
||||
@@ -180,7 +180,7 @@ export function getUserMenu(user) {
|
||||
if ($i && meId === user.id) {
|
||||
menu = menu.concat([null, {
|
||||
icon: faPencilAlt,
|
||||
text: i18n.global.t('editProfile'),
|
||||
text: i18n.locale.editProfile,
|
||||
action: () => {
|
||||
router.push('/settings/profile');
|
||||
}
|
||||
|
Reference in New Issue
Block a user