mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-09 19:53:08 +02:00
不明なリアクションのフォールバックに star を使うようにするオプション
This commit is contained in:
parent
810ed50976
commit
08c176e549
10 changed files with 26 additions and 16 deletions
|
@ -1239,6 +1239,7 @@ admin/views/instance.vue:
|
|||
disable-global-timeline: "グローバルタイムラインを無効にする"
|
||||
disabling-timelines-info: "これらのタイムラインを無効にしても、管理者およびモデレーターは引き続き利用できます。"
|
||||
enable-emoji-reaction: "リアクションに絵文字を使えるようにする"
|
||||
use-star-for-reaction-fallback: "不明なリアクションのフォールバックに star を使う"
|
||||
invite: "招待"
|
||||
save: "保存"
|
||||
saved: "保存しました"
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
<ui-switch v-model="disableGlobalTimeline">{{ $t('disable-global-timeline') }}</ui-switch>
|
||||
<ui-info>{{ $t('disabling-timelines-info') }}</ui-info>
|
||||
<ui-switch v-model="enableEmojiReaction">{{ $t('enable-emoji-reaction') }}</ui-switch>
|
||||
<ui-switch v-model="useStarForReactionFallback">{{ $t('use-star-for-reaction-fallback') }}</ui-switch>
|
||||
</section>
|
||||
<section class="fit-bottom">
|
||||
<header><fa icon="cloud"/> {{ $t('drive-config') }}</header>
|
||||
|
@ -157,6 +158,7 @@ export default Vue.extend({
|
|||
disableLocalTimeline: false,
|
||||
disableGlobalTimeline: false,
|
||||
enableEmojiReaction: true,
|
||||
useStarForReactionFallback: false,
|
||||
mascotImageUrl: null,
|
||||
bannerUrl: null,
|
||||
errorImageUrl: null,
|
||||
|
@ -209,6 +211,7 @@ export default Vue.extend({
|
|||
this.disableLocalTimeline = meta.disableLocalTimeline;
|
||||
this.disableGlobalTimeline = meta.disableGlobalTimeline;
|
||||
this.enableEmojiReaction = meta.enableEmojiReaction;
|
||||
this.useStarForReactionFallback = meta.useStarForReactionFallback;
|
||||
this.mascotImageUrl = meta.mascotImageUrl;
|
||||
this.bannerUrl = meta.bannerUrl;
|
||||
this.errorImageUrl = meta.errorImageUrl;
|
||||
|
@ -271,6 +274,7 @@ export default Vue.extend({
|
|||
disableLocalTimeline: this.disableLocalTimeline,
|
||||
disableGlobalTimeline: this.disableGlobalTimeline,
|
||||
enableEmojiReaction: this.enableEmojiReaction,
|
||||
useStarForReactionFallback: this.useStarForReactionFallback,
|
||||
mascotImageUrl: this.mascotImageUrl,
|
||||
bannerUrl: this.bannerUrl,
|
||||
errorImageUrl: this.errorImageUrl,
|
||||
|
|
|
@ -31,6 +31,7 @@ export default Vue.extend({
|
|||
case 'confused': return '😥';
|
||||
case 'rip': return '😇';
|
||||
case 'pudding': return (this.$store.getters.isSignedIn && this.$store.state.settings.iLikeSushi) ? '🍣' : '🍮';
|
||||
case 'star': return '⭐';
|
||||
default: return this.reaction;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -10,6 +10,7 @@ export default function(reaction: string): string {
|
|||
case 'confused': return '😥';
|
||||
case 'rip': return '😇';
|
||||
case 'pudding': return '🍮';
|
||||
default: return '';
|
||||
case 'star': return '⭐';
|
||||
default: return reaction;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Emoji from '../models/emoji';
|
||||
import { emojiRegex } from './emoji-regex';
|
||||
import fetchMeta from './fetch-meta';
|
||||
|
||||
const basic10: Record<string, string> = {
|
||||
'👍': 'like',
|
||||
|
@ -15,7 +16,8 @@ const basic10: Record<string, string> = {
|
|||
};
|
||||
|
||||
export async function getFallbackReaction(): Promise<string> {
|
||||
return 'like';
|
||||
const meta = await fetchMeta();
|
||||
return meta.useStarForReactionFallback ? 'star' : 'like';
|
||||
}
|
||||
|
||||
export async function toDbReaction(reaction: string, enableEmoji = true): Promise<string> {
|
||||
|
|
|
@ -195,6 +195,7 @@ export type IMeta = {
|
|||
disableLocalTimeline?: boolean;
|
||||
disableGlobalTimeline?: boolean;
|
||||
enableEmojiReaction?: boolean;
|
||||
useStarForReactionFallback?: boolean;
|
||||
hidedTags?: string[];
|
||||
mascotImageUrl?: string;
|
||||
bannerUrl?: string;
|
||||
|
|
|
@ -20,19 +20,6 @@ export interface INoteReaction {
|
|||
reaction: string;
|
||||
}
|
||||
|
||||
export const validateReaction = $.str.or([
|
||||
'like',
|
||||
'love',
|
||||
'laugh',
|
||||
'hmm',
|
||||
'surprise',
|
||||
'congrats',
|
||||
'angry',
|
||||
'confused',
|
||||
'rip',
|
||||
'pudding'
|
||||
]);
|
||||
|
||||
/**
|
||||
* Pack a reaction for API response
|
||||
*/
|
||||
|
|
|
@ -48,6 +48,13 @@ export const meta = {
|
|||
}
|
||||
},
|
||||
|
||||
useStarForReactionFallback: {
|
||||
validator: $.optional.nullable.bool,
|
||||
desc: {
|
||||
'ja-JP': '不明なリアクションのフォールバックに star リアクションを使うか'
|
||||
}
|
||||
},
|
||||
|
||||
hidedTags: {
|
||||
validator: $.optional.nullable.arr($.str),
|
||||
desc: {
|
||||
|
@ -362,6 +369,10 @@ export default define(meta, async (ps) => {
|
|||
set.enableEmojiReaction = ps.enableEmojiReaction;
|
||||
}
|
||||
|
||||
if (typeof ps.useStarForReactionFallback === 'boolean') {
|
||||
set.useStarForReactionFallback = ps.useStarForReactionFallback;
|
||||
}
|
||||
|
||||
if (Array.isArray(ps.hidedTags)) {
|
||||
set.hidedTags = ps.hidedTags;
|
||||
}
|
||||
|
|
|
@ -152,6 +152,7 @@ export default define(meta, async (ps, me) => {
|
|||
}
|
||||
|
||||
if (me && (me.isAdmin || me.isModerator)) {
|
||||
response.useStarForReactionFallback = instance.useStarForReactionFallback;
|
||||
response.hidedTags = instance.hidedTags;
|
||||
response.recaptchaSecretKey = instance.recaptchaSecretKey;
|
||||
response.proxyAccount = instance.proxyAccount;
|
||||
|
|
|
@ -392,7 +392,8 @@ export const schemas = {
|
|||
'angry',
|
||||
'confused',
|
||||
'rip',
|
||||
'pudding'
|
||||
'pudding',
|
||||
'star'
|
||||
],
|
||||
description: 'The reaction type.'
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue