Skip to content

Commit

Permalink
delete!(tms): パクる・数字引用を廃止
Browse files Browse the repository at this point in the history
  • Loading branch information
taiyme committed Sep 30, 2024
1 parent b8485fa commit ba78678
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 476 deletions.
44 changes: 0 additions & 44 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10273,22 +10273,6 @@ export interface Locale extends ILocale {
* フォロワーリノート (連合なし)
*/
readonly "disableFederationFollowersRenote": string;
/**
* パクる
*/
readonly "pakuru": string;
/**
* 数字引用する
*/
readonly "numberquote": string;
/**
* パクりました
*/
readonly "didPakuru": string;
/**
* 数字引用しました
*/
readonly "didNumberquote": string;
/**
* {user}によって解決済み
*/
Expand Down Expand Up @@ -10428,34 +10412,6 @@ export interface Locale extends ILocale {
*/
readonly "caption": string;
};
readonly "_pakuru": {
/**
* 「パクる」機能を有効にする
*/
readonly "label": string;
/**
* リノートメニューに「パクる」を追加します。添付ファイルを含むノートをパクる場合、時間がかかる場合があります。
*/
readonly "caption": string;
/**
* 「パクる」は身内ノリに特化した機能です。悪用や嫌がらせなどを目的として使用しないようにしましょう。
*/
readonly "warning": string;
};
readonly "_numberquote": {
/**
* 「数字引用」機能を有効にする
*/
readonly "label": string;
/**
* リノートメニューに「数字引用する」を追加します。添付ファイルを含むノートを数字引用する場合、時間がかかる場合があります。
*/
readonly "caption": string;
/**
* 「数字引用」は身内ノリに特化した機能です。悪用や嫌がらせなどを目的として使用しないようにしましょう。
*/
readonly "warning": string;
};
};
readonly "_flags": {
/**
Expand Down
12 changes: 0 additions & 12 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2739,10 +2739,6 @@ _tms:
disableFederationRenote: "リノート (連合なし)"
disableFederationHomeRenote: "ホームリノート (連合なし)"
disableFederationFollowersRenote: "フォロワーリノート (連合なし)"
pakuru: "パクる"
numberquote: "数字引用する"
didPakuru: "パクりました"
didNumberquote: "数字引用しました"
resolvedBy: "{user}によって解決済み"
forwardedReport: "リモートサーバーに転送済み"
notYetProvided: "まだ提供されていません"
Expand Down Expand Up @@ -2781,14 +2777,6 @@ _tms:
_pullToRefreshAllReload:
label: "「引っ張ってリロード」でページ全体を再読み込みする"
caption: "構成しているページ全体を再読み込みする動作に置き換えます。"
_pakuru:
label: "「パクる」機能を有効にする"
caption: "リノートメニューに「パクる」を追加します。添付ファイルを含むノートをパクる場合、時間がかかる場合があります。"
warning: "「パクる」は身内ノリに特化した機能です。悪用や嫌がらせなどを目的として使用しないようにしましょう。"
_numberquote:
label: "「数字引用」機能を有効にする"
caption: "リノートメニューに「数字引用する」を追加します。添付ファイルを含むノートを数字引用する場合、時間がかかる場合があります。"
warning: "「数字引用」は身内ノリに特化した機能です。悪用や嫌がらせなどを目的として使用しないようにしましょう。"
_flags:
title: "taiyme実験的機能"
description: "これらの機能はtaiymeで独自実装したものです。"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,26 @@

import ms from 'ms';
import { Injectable } from '@nestjs/common';
import { IdentifiableError } from '@/misc/identifiable-error.js';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { GlobalEventService } from '@/core/GlobalEventService.js';
import { DriveFileEntityService } from '@/core/entities/DriveFileEntityService.js';
import { MetaService } from '@/core/MetaService.js';
import { DriveService } from '@/core/DriveService.js';
import { ApiError } from '../../../error.js';
import { DB_MAX_IMAGE_COMMENT_LENGTH } from '@/const.js';

export const meta = {
tags: ['drive'],

requireCredential: true,

prohibitMoved: true,

limit: {
duration: ms('1hour'),
max: 60,
},

kind: 'write:drive',

description: 'Request the server to download a new drive file from the specified URL.',

res: {
type: 'object',
optional: false, nullable: false,
ref: 'DriveFile',
},
requireCredential: true,

errors: {
inappropriate: {
message: 'Cannot upload the file because it has been determined that it possibly contains inappropriate content.',
code: 'INAPPROPRIATE',
id: '8eb55988-6b8b-4e0f-8d38-97e8b5e112a0',
},
prohibitMoved: true,

noFreeSpace: {
message: 'Cannot upload the file because you have no free space of drive.',
code: 'NO_FREE_SPACE',
id: '70e6b8ac-d2e6-4646-a5e5-a5a54525c133',
},
},
kind: 'write:drive',
} as const;

export const paramDef = {
Expand All @@ -57,7 +33,7 @@ export const paramDef = {
url: { type: 'string' },
folderId: { type: 'string', format: 'misskey:id', nullable: true, default: null },
isSensitive: { type: 'boolean', default: false },
comment: { type: 'string', nullable: true, maxLength: DB_MAX_IMAGE_COMMENT_LENGTH, default: null },
comment: { type: 'string', nullable: true, maxLength: 512, default: null },
marker: { type: 'string', nullable: true, default: null },
force: { type: 'boolean', default: false },
},
Expand All @@ -68,40 +44,18 @@ export const paramDef = {
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
constructor(
private driveFileEntityService: DriveFileEntityService,
private metaService: MetaService,
private driveService: DriveService,
private globalEventService: GlobalEventService,
) {
super(meta, paramDef, async (ps, user, _1, _2, _3, ip, headers) => {
const instance = await this.metaService.fetch();

try {
const driveFile = await this.driveService.uploadFromUrl({
url: ps.url,
user,
folderId: ps.folderId,
sensitive: ps.isSensitive,
force: ps.force,
comment: ps.comment,
requestIp: instance.enableIpLogging ? ip : null,
requestHeaders: instance.enableIpLogging ? headers : null,
});
const packedFile = await this.driveFileEntityService.pack(driveFile, { self: true });
this.globalEventService.publishMainStream(user.id, 'urlUploadFinished', {
marker: ps.marker,
file: packedFile,
this.driveService.uploadFromUrl({ url: ps.url, user, folderId: ps.folderId, sensitive: ps.isSensitive, force: ps.force, comment: ps.comment, requestIp: ip, requestHeaders: headers }).then(file => {
this.driveFileEntityService.pack(file, { self: true }).then(packedFile => {
this.globalEventService.publishMainStream(user.id, 'urlUploadFinished', {
marker: ps.marker,
file: packedFile,
});
});
return packedFile;
} catch (err) {
if (err instanceof Error || typeof err === 'string') {
console.error(err);
}
if (err instanceof IdentifiableError) {
if (err.id === '282f77bf-5816-4f72-9264-aa14d8261a21') throw new ApiError(meta.errors.inappropriate);
if (err.id === 'c6244ed2-a39a-4e1c-bf93-f0fbd7764fa6') throw new ApiError(meta.errors.noFreeSpace);
}
throw new ApiError();
}
});
});
}
}
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkDrive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ function urlUpload() {
misskeyApi('drive/files/upload-from-url', {
url: url,
folderId: folder.value ? folder.value.id : undefined,
}).catch(() => {});
});
os.alert({
title: i18n.ts.uploadFromUrlRequested,
Expand Down
5 changes: 2 additions & 3 deletions packages/frontend/src/components/MkNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<p v-if="appearNote.repliesCount > 0" :class="$style.footerButtonCount">{{ number(appearNote.repliesCount) }}</p>
</button>
<button
v-if="canRenote || canPakuru"
v-if="canRenote"
ref="renoteButton"
:class="$style.footerButton"
class="_button"
Expand Down Expand Up @@ -268,7 +268,6 @@ const translation = ref<Misskey.entities.NotesTranslateResponse | null>(null);
const translating = ref(false);
const showTicker = computed(() => (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.value.user.instance != null) || (appearNote.value.channel != null));
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || (appearNote.value.visibility === 'followers' && appearNote.value.userId === $i?.id));
const canPakuru = computed(() => tmsStore.reactiveState.enablePakuru.value || tmsStore.reactiveState.enableNumberquote.value);
const renoteCollapsed = ref(
defaultStore.state.collapseRenotes && isRenoted && (
($i && ($i.id === note.value.userId || $i.id === appearNote.value.userId)) || // `||` must be `||`! See https://github.com/misskey-dev/misskey/issues/13131
Expand Down Expand Up @@ -417,7 +416,7 @@ async function renote() {
pleaseLogin(undefined, pleaseLoginContext.value);
showMovedDialog();
const { menu } = await getRenoteMenu({ note: note.value, renoteButton, mock: props.mock, canRenote: canRenote.value });
const { menu } = await getRenoteMenu({ note: note.value, renoteButton, mock: props.mock });
os.popupMenu(menu, renoteButton.value);
}
Expand Down
6 changes: 2 additions & 4 deletions packages/frontend/src/components/MkNoteDetailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<p v-if="appearNote.repliesCount > 0" :class="$style.noteFooterButtonCount">{{ number(appearNote.repliesCount) }}</p>
</button>
<button
v-if="canRenote || canPakuru"
v-if="canRenote"
ref="renoteButton"
class="_button"
:class="$style.noteFooterButton"
Expand Down Expand Up @@ -239,7 +239,6 @@ import { isEnabledUrlPreview } from '@/instance.js';
import { type Keymap } from '@/scripts/hotkey.js';
import { getAppearNote } from '@/scripts/tms/get-appear-note.js';
import { isQuote, isRenote } from '@/scripts/tms/is-renote.js';
import { tmsStore } from '@/tms/store.js';
const props = withDefaults(defineProps<{
note: Misskey.entities.Note;
Expand Down Expand Up @@ -293,7 +292,6 @@ const showTicker = computed(() => (defaultStore.state.instanceTicker === 'always
const conversation = ref<Misskey.entities.Note[]>([]);
const replies = ref<Misskey.entities.Note[]>([]);
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || appearNote.value.userId === $i?.id);
const canPakuru = computed(() => tmsStore.reactiveState.enablePakuru.value || tmsStore.reactiveState.enableNumberquote.value);
const pleaseLoginContext = computed(() => ({
type: 'lookup',
Expand Down Expand Up @@ -403,7 +401,7 @@ async function renote() {
pleaseLogin(undefined, pleaseLoginContext.value);
showMovedDialog();
const { menu } = await getRenoteMenu({ note: note.value, renoteButton, canRenote: canRenote.value });
const { menu } = await getRenoteMenu({ note: note.value, renoteButton });
os.popupMenu(menu, renoteButton.value);
}
Expand Down
38 changes: 1 addition & 37 deletions packages/frontend/src/pages/tms/settings/index.main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkSwitch>
</div>
</FormSection>
<FormSection>
<div class="_gaps">
<MkSwitch v-model="enablePakuru">
<template #label>{{ i18n.ts._tms._settings._pakuru.label }}</template>
<template #caption>{{ i18n.ts._tms._settings._pakuru.caption }}</template>
</MkSwitch>
<MkSwitch v-model="enableNumberquote">
<template #label>{{ i18n.ts._tms._settings._numberquote.label }}</template>
<template #caption>{{ i18n.ts._tms._settings._numberquote.caption }}</template>
</MkSwitch>
</div>
</FormSection>
</div>
</template>

<script lang="ts" setup>
import { computed, readonly, ref, watch } from 'vue';
import { i18n } from '@/i18n.js';
import { alert, confirm } from '@/os.js';
import { confirm } from '@/os.js';
import { unisonReload } from '@/scripts/unison-reload.js';
import { tmsStore } from '@/tms/store.js';
import FormSection from '@/components/form/section.vue';
Expand All @@ -86,30 +74,6 @@ const pullToRefreshSensitivity = computed({
reloadAsk();
},
});
const enablePakuru = computed({
get: () => tmsStore.reactiveState.enablePakuru.value,
set: async (newValue) => {
if (!enablePakuru.value && newValue) { // false -> true
await alert({
type: 'warning',
text: i18n.ts._tms._settings._pakuru.warning,
});
}
tmsStore.set('enablePakuru', newValue);
},
});
const enableNumberquote = computed({
get: () => tmsStore.reactiveState.enableNumberquote.value,
set: async (newValue) => {
if (!enableNumberquote.value && newValue) { // false -> true
await alert({
type: 'warning',
text: i18n.ts._tms._settings._numberquote.warning,
});
}
tmsStore.set('enableNumberquote', newValue);
},
});
//#endregion
const reloadAsk = async (): Promise<void> => {
Expand Down
Loading

0 comments on commit ba78678

Please sign in to comment.