ロール周りの修正
This commit is contained in:
parent
36319a2b72
commit
55c5f7fdb0
|
|
@ -6650,6 +6650,10 @@ export interface Locale extends ILocale {
|
||||||
* パブリック投稿の許可
|
* パブリック投稿の許可
|
||||||
*/
|
*/
|
||||||
"canPublicNote": string;
|
"canPublicNote": string;
|
||||||
|
/**
|
||||||
|
* ノートの編集の許可
|
||||||
|
*/
|
||||||
|
"canEditNote": string;
|
||||||
/**
|
/**
|
||||||
* ノート内の最大メンション数
|
* ノート内の最大メンション数
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1719,6 +1719,7 @@ _role:
|
||||||
gtlAvailable: "グローバルタイムラインの閲覧"
|
gtlAvailable: "グローバルタイムラインの閲覧"
|
||||||
ltlAvailable: "ローカルタイムラインの閲覧"
|
ltlAvailable: "ローカルタイムラインの閲覧"
|
||||||
canPublicNote: "パブリック投稿の許可"
|
canPublicNote: "パブリック投稿の許可"
|
||||||
|
canEditNote: "ノートの編集の許可"
|
||||||
mentionMax: "ノート内の最大メンション数"
|
mentionMax: "ノート内の最大メンション数"
|
||||||
canInvite: "サーバー招待コードの発行"
|
canInvite: "サーバー招待コードの発行"
|
||||||
inviteLimit: "招待コードの作成可能数"
|
inviteLimit: "招待コードの作成可能数"
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,11 @@ export const meta = {
|
||||||
code: 'ACCESS_DENIED',
|
code: 'ACCESS_DENIED',
|
||||||
id: 'fe8d7103-0ea8-4ec3-814d-f8b401dc69e9',
|
id: 'fe8d7103-0ea8-4ec3-814d-f8b401dc69e9',
|
||||||
},
|
},
|
||||||
|
cannotEditNote: {
|
||||||
|
message: 'Editing notes are not allowed by the role policy.',
|
||||||
|
code: 'CANNOT_EDIT_NOTE',
|
||||||
|
id: '59ece09c-56ab-4bd5-905c-0f6bbf5af143',
|
||||||
|
},
|
||||||
containsProhibitedWords: {
|
containsProhibitedWords: {
|
||||||
message: 'Cannot post because it contains prohibited words.',
|
message: 'Cannot post because it contains prohibited words.',
|
||||||
code: 'CONTAINS_PROHIBITED_WORDS',
|
code: 'CONTAINS_PROHIBITED_WORDS',
|
||||||
|
|
@ -138,8 +143,12 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
});
|
});
|
||||||
|
|
||||||
// この操作を行うのが投稿者とは限らない(例えばモデレーター)ため
|
// この操作を行うのが投稿者とは限らない(例えばモデレーター)ため
|
||||||
if (!await this.roleService.isModerator(me) && (note.userId !== me.id) && (await this.roleService.getUserPolicies(me.id)).canEditNote !== true) {
|
if (!await this.roleService.isModerator(me)) {
|
||||||
throw new ApiError(meta.errors.accessDenied);
|
if (note.userId !== me.id) {
|
||||||
|
throw new ApiError(meta.errors.accessDenied);
|
||||||
|
} else if ((await this.roleService.getUserPolicies(me.id)).canEditNote !== true) {
|
||||||
|
throw new ApiError(meta.errors.cannotEditNote);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div v-show="cw == null || cw == '' || showContent">
|
<div v-show="cw == null || cw == '' || showContent">
|
||||||
<Mfm :text="text.trim()" :author="user" :nyaize="'respect'" :i="user"/>
|
<Mfm :text="text.trim()" :author="user" :nyaize="'respect'" :i="user"/>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="files && files.length > 0">
|
||||||
|
<MkMediaList ref="galleryEl" :mediaList="files"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<footer :class="$style.footer">
|
<footer :class="$style.footer">
|
||||||
<button ref="menuButton" :class="$style.footerButton" class="_button" @mousedown.prevent="showMenu()">
|
<button ref="menuButton" :class="$style.footerButton" class="_button" @mousedown.prevent="showMenu()">
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
|
import type { OpenOnRemoteOptions } from '@/scripts/please-login.js';
|
||||||
import { sum } from '@/scripts/array.js';
|
import { sum } from '@/scripts/array.js';
|
||||||
import { pleaseLogin } from '@/scripts/please-login.js';
|
import { pleaseLogin } from '@/scripts/please-login.js';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
|
|
@ -36,7 +37,6 @@ import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { host } from '@/config.js';
|
import { host } from '@/config.js';
|
||||||
import { useInterval } from '@/scripts/use-interval.js';
|
import { useInterval } from '@/scripts/use-interval.js';
|
||||||
import type { OpenOnRemoteOptions } from '@/scripts/please-login.js';
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
noteId: string;
|
noteId: string;
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ export const ROLE_POLICIES = [
|
||||||
'gtlAvailable',
|
'gtlAvailable',
|
||||||
'ltlAvailable',
|
'ltlAvailable',
|
||||||
'canPublicNote',
|
'canPublicNote',
|
||||||
|
'canEditNote',
|
||||||
'mentionLimit',
|
'mentionLimit',
|
||||||
'canInvite',
|
'canInvite',
|
||||||
'inviteLimit',
|
'inviteLimit',
|
||||||
|
|
@ -127,7 +128,7 @@ export const MFM_PARAMS: Record<typeof MFM_TAGS[number], string[]> = {
|
||||||
position: ['x=', 'y='],
|
position: ['x=', 'y='],
|
||||||
fg: ['color='],
|
fg: ['color='],
|
||||||
bg: ['color='],
|
bg: ['color='],
|
||||||
border: ['width=', 'style=', 'color=', 'radius=', 'noclip'],
|
border: ['width=', 'style=', 'color=', 'radius=', 'noclip'],
|
||||||
font: ['serif', 'monospace', 'cursive', 'fantasy', 'emoji', 'math'],
|
font: ['serif', 'monospace', 'cursive', 'fantasy', 'emoji', 'math'],
|
||||||
blur: [],
|
blur: [],
|
||||||
rainbow: ['speed=', 'delay='],
|
rainbow: ['speed=', 'delay='],
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,26 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</div>
|
</div>
|
||||||
</MkFolder>
|
</MkFolder>
|
||||||
|
|
||||||
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canEditNote, 'canEditNote'])">
|
||||||
|
<template #label>{{ i18n.ts._role._options.canEditNote }}</template>
|
||||||
|
<template #suffix>
|
||||||
|
<span v-if="role.policies.canEditNote.useDefault" :class="$style.useDefaultLabel">{{ i18n.ts._role.useBaseValue }}</span>
|
||||||
|
<span v-else>{{ role.policies.canEditNote.value ? i18n.ts.yes : i18n.ts.no }}</span>
|
||||||
|
<span :class="$style.priorityIndicator"><i :class="getPriorityIcon(role.policies.canEditNote)"></i></span>
|
||||||
|
</template>
|
||||||
|
<div class="_gaps">
|
||||||
|
<MkSwitch v-model="role.policies.canEditNote.useDefault" :readonly="readonly">
|
||||||
|
<template #label>{{ i18n.ts._role.useBaseValue }}</template>
|
||||||
|
</MkSwitch>
|
||||||
|
<MkSwitch v-model="role.policies.canEditNote.value" :disabled="role.policies.canEditNote.useDefault" :readonly="readonly">
|
||||||
|
<template #label>{{ i18n.ts.enable }}</template>
|
||||||
|
</MkSwitch>
|
||||||
|
<MkRange v-model="role.policies.canEditNote.priority" :min="0" :max="2" :step="1" easing :textConverter="(v) => v === 0 ? i18n.ts._role._priority.low : v === 1 ? i18n.ts._role._priority.middle : v === 2 ? i18n.ts._role._priority.high : ''">
|
||||||
|
<template #label>{{ i18n.ts._role.priority }}</template>
|
||||||
|
</MkRange>
|
||||||
|
</div>
|
||||||
|
</MkFolder>
|
||||||
|
|
||||||
<MkFolder v-if="matchQuery([i18n.ts._role._options.mentionMax, 'mentionLimit'])">
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.mentionMax, 'mentionLimit'])">
|
||||||
<template #label>{{ i18n.ts._role._options.mentionMax }}</template>
|
<template #label>{{ i18n.ts._role._options.mentionMax }}</template>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<MkStickyContainer>
|
<MkStickyContainer>
|
||||||
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
<template #header>
|
||||||
|
<XHeader :actions="headerActions" :tabs="headerTabs"/>
|
||||||
|
</template>
|
||||||
<MkSpacer :contentMax="700">
|
<MkSpacer :contentMax="700">
|
||||||
<div class="_gaps">
|
<div class="_gaps">
|
||||||
<MkFolder>
|
<MkFolder>
|
||||||
|
|
@ -48,6 +50,14 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</MkSwitch>
|
</MkSwitch>
|
||||||
</MkFolder>
|
</MkFolder>
|
||||||
|
|
||||||
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.canEditNote, 'canEditNote'])">
|
||||||
|
<template #label>{{ i18n.ts._role._options.canEditNote }}</template>
|
||||||
|
<template #suffix>{{ policies.canEditNote ? i18n.ts.yes : i18n.ts.no }}</template>
|
||||||
|
<MkSwitch v-model="policies.canEditNote">
|
||||||
|
<template #label>{{ i18n.ts.enable }}</template>
|
||||||
|
</MkSwitch>
|
||||||
|
</MkFolder>
|
||||||
|
|
||||||
<MkFolder v-if="matchQuery([i18n.ts._role._options.mentionMax, 'mentionLimit'])">
|
<MkFolder v-if="matchQuery([i18n.ts._role._options.mentionMax, 'mentionLimit'])">
|
||||||
<template #label>{{ i18n.ts._role._options.mentionMax }}</template>
|
<template #label>{{ i18n.ts._role._options.mentionMax }}</template>
|
||||||
<template #suffix>{{ policies.mentionLimit }}</template>
|
<template #suffix>{{ policies.mentionLimit }}</template>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue