Skip to content

Commit

Permalink
feat(frontend): 自作フラグを設定できるように
Browse files Browse the repository at this point in the history
  • Loading branch information
slofp committed Aug 3, 2024
1 parent ef5be78 commit d47a533
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 18 deletions.
5 changes: 5 additions & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,11 @@ relationalDate: "Registration datetime to allow RTL"
confirmAddEmoji: "Is there a chance that the emoji you are about to add will be used more than once by someone other than you?"
community: "Community"
manageRole: "Manage roles"
selfMadeResource: "I created the image myself."
nonSelfResourceLicense: "License and Evidence of Use"
pleaseEnterTheLicenseNonSelf: "Please enter a license."
checkLicenseNonSelf: "License and Evidence of Use: {license}\nDo you have the license to register the image you are about to add as a emoji?"
nonLicenseCannotAddNonSelf: "Emoji without license and evidence of use cannot be registered.\nPlease check our Emoji Guidelines."
_delivery:
status: "Delivery status"
stop: "Suspended"
Expand Down
22 changes: 22 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5244,6 +5244,28 @@ export interface Locale extends ILocale {
* 作成したアンテナ
*/
"createdAntennas": string;
/**
* 自分で画像を作成しました
*/
"selfMadeResource": string;
/**
* 使用許諾と根拠
*/
"nonSelfResourceLicense": string;
/**
* 使用許諾を入力してください
*/
"pleaseEnterTheLicenseNonSelf": string;
/**
* 使用許諾と根拠: {license}
* あなたが追加しようとしている画像を絵文字として登録する権利を有していますか?
*/
"checkLicenseNonSelf": ParameterizedString<"license">;
/**
* 使用許諾と根拠のない絵文字は登録することができません。
* 絵文字ガイドラインをご確認ください。
*/
"nonLicenseCannotAddNonSelf": string;
"_delivery": {
/**
* 配信状態
Expand Down
5 changes: 5 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,11 @@ confirmWhenRevealingSensitiveMedia: "センシティブなメディアを表示
sensitiveMediaRevealConfirm: "センシティブなメディアです。表示しますか?"
createdLists: "作成したリスト"
createdAntennas: "作成したアンテナ"
selfMadeResource: "自分で画像を作成しました"
nonSelfResourceLicense: "使用許諾と根拠"
pleaseEnterTheLicenseNonSelf: "使用許諾を入力してください"
checkLicenseNonSelf: "使用許諾と根拠: {license}\n あなたが追加しようとしている画像を絵文字として登録する権利を有していますか?"
nonLicenseCannotAddNonSelf: "使用許諾と根拠のない絵文字は登録することができません。\n絵文字ガイドラインをご確認ください。"

_delivery:
status: "配信状態"
Expand Down
5 changes: 5 additions & 0 deletions locales/ja-KS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,11 @@ changeLog: "更新履歴"
confirmAddEmoji: "今追加しとる絵文字はあんた以外が2回以上使用される可能性があるんか?"
community: "コミュニティー"
manageRole: "ロールの管理"
selfMadeResource: "自分で画像を作成しました"
nonSelfResourceLicense: "使用許諾と根拠"
pleaseEnterTheLicenseNonSelf: "使用許諾を入力してください"
checkLicenseNonSelf: "使用許諾と根拠: {license}\n あなたが追加しようとしている画像を絵文字として登録する権利を有していますか?"
nonLicenseCannotAddNonSelf: "使用許諾と根拠のない絵文字は登録することができません。\n絵文字ガイドラインをご確認ください。"
_delivery:
stop: "配信せぇへん"
_type:
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/src/components/MkEmojiLog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const typeToi18n = {
category: i18n.ts.category,
originalUrl: i18n.ts.emojiUrl,
aliases: i18n.ts.tags,
isSelfMadeResource: i18n.ts.selfMadeResource,
license: i18n.ts.license,
localOnly: i18n.ts.localOnly,
isSensitive: i18n.ts.markAsSensitive,
Expand Down
76 changes: 58 additions & 18 deletions packages/frontend/src/pages/emoji-edit-dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts.setMultipleBySeparatingWithSpace }}
</template>
</MkInput>
<MkInput v-model="license" :mfmAutocomplete="true">
<template #label>{{ i18n.ts.license }}</template>
<MkSwitch v-model="isSelfMadeResource">{{ i18n.ts.selfMadeResource }}</MkSwitch>
<MkInput v-model.trim="license" :mfmAutocomplete="true">
<template v-if="isSelfMadeResource" #label>{{ i18n.ts.license }}</template>
<template v-else #label>{{ i18n.ts.nonSelfResourceLicense }}</template>
</MkInput>
<MkFolder>
<template #label>{{ i18n.ts.rolesThatCanBeUsedThisEmojiAsReaction }}</template>
Expand Down Expand Up @@ -188,6 +190,7 @@ const aliasesText = computed({
}));
}
});
const isSelfMadeResource = ref(props.emoji ? props.emoji.isSelfMadeResource : false);
const license = ref<string>(props.emoji ? (props.emoji.license ?? '') : '');
const isSensitive = ref(props.emoji ? props.emoji.isSensitive : false);
const localOnly = ref(props.emoji ? props.emoji.localOnly : false);
Expand Down Expand Up @@ -264,7 +267,59 @@ async function removeRole(role, ev) {
rolesThatCanBeUsedThisEmojiAsReaction.value = rolesThatCanBeUsedThisEmojiAsReaction.value.filter(x => x.id !== role.id);
}

async function licenseCheckWithCanceled(): Promise<boolean> {
if (isSelfMadeResource.value) {
if (license.value === '') {
const { canceled } = await os.confirm({
type: 'warning',
text: i18n.ts.noneLicense,
okText: i18n.ts.yes,
cancelText: i18n.ts.no,
});
if (canceled) {
await os.alert({
type: 'error',
title: i18n.ts.error,
text: i18n.ts.noneLicenseNo,
});
return true;
}
}
return false;
}

if (license.value === '') {
await os.alert({
type: 'error',
title: i18n.ts.error,
text: i18n.ts.pleaseEnterTheLicenseNonSelf,
});
return true;
}
const { canceled } = await os.confirm({
type: 'warning',
text: i18n.tsx.checkLicenseNonSelf({
license: license.value,
}),
okText: i18n.ts.yes,
cancelText: i18n.ts.no,
});
if (canceled) {
await os.alert({
type: 'error',
title: i18n.ts.error,
text: i18n.ts.nonLicenseCannotAddNonSelf,
});
return true;
}
return false;
}

async function done() {
if (await licenseCheckWithCanceled()) {
return;
}

if (!props.emoji && $i.emojiCount < 10) {
const { canceled } = await os.confirm({
type: 'warning',
Expand All @@ -274,27 +329,12 @@ async function done() {
});
if (canceled) return;
}
if (license.value === '') {
const { canceled } = await os.confirm({
type: 'warning',
text: i18n.ts.noneLicense,
okText: i18n.ts.yes,
cancelText: i18n.ts.no,
});
if (canceled) {
await os.alert({
type: 'error',
title: i18n.ts.error,
text: i18n.ts.noneLicenseNo,
});
return;
}
}

const params = {
name: name.value,
category: category.value === '' ? null : category.value,
aliases: aliases.value.map(v => v.value),
isSelfMadeResource: isSelfMadeResource.value,
license: license.value === '' ? null : license.value,
isSensitive: isSensitive.value,
localOnly: localOnly.value,
Expand Down
3 changes: 3 additions & 0 deletions packages/misskey-js/src/autogen/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4733,6 +4733,7 @@ export type components = {
/** @description The local host is represented with `null`. */
host: string | null;
url: string;
isSelfMadeResource: boolean;
license: string | null;
isSensitive: boolean;
localOnly: boolean;
Expand Down Expand Up @@ -7076,6 +7077,7 @@ export type operations = {
/** @description Use `null` to reset the category. */
category?: string | null;
aliases?: string[];
isSelfMadeResource?: boolean;
license?: string | null;
isSensitive?: boolean;
localOnly?: boolean;
Expand Down Expand Up @@ -7706,6 +7708,7 @@ export type operations = {
/** @description Use `null` to reset the category. */
category?: string | null;
aliases?: string[];
isSelfMadeResource?: boolean;
license?: string | null;
isSensitive?: boolean;
localOnly?: boolean;
Expand Down

0 comments on commit d47a533

Please sign in to comment.