summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2024-05-21 17:23:20 +0900
committerGitHub <noreply@github.com>2024-05-21 17:23:20 +0900
commit6a637db36b8a0c32774b5da5e40236c5f14a59e8 (patch)
tree011cbb7758665bd6328304b99513e496f81b2cae
parentdeps: AiScript VSCodeのバージョンを上げる (#13851) (diff)
downloadmisskey-6a637db36b8a0c32774b5da5e40236c5f14a59e8.tar.gz
misskey-6a637db36b8a0c32774b5da5e40236c5f14a59e8.tar.bz2
misskey-6a637db36b8a0c32774b5da5e40236c5f14a59e8.zip
enhance(frontend): 通常のノートでも、お気に入りに登録したチャンネルにリノートできるように (#13855)
* enhance(frontend): チャンネルにリノートできるように * Update Changelog
-rw-r--r--CHANGELOG.md1
-rw-r--r--locales/index.d.ts12
-rw-r--r--locales/ja-JP.yml3
-rw-r--r--packages/frontend/src/scripts/get-note-menu.ts38
4 files changed, 54 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ecacefe84e..9bdc1d135a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -41,6 +41,7 @@
- Enhance: 通報のコメント内のリンクをクリックした際、ウィンドウで開くように
- Enhance: `Ui:C:postForm` および `Ui:C:postFormButton` に `localOnly` と `visibility` を設定できるように
- Enhance: AiScriptを0.18.0にバージョンアップ
+- Enhance: 通常のノートでも、お気に入りに登録したチャンネルにリノートできるように
- Fix: 一部のページ内リンクが正しく動作しない問題を修正
- Fix: 周年の実績が閏年を考慮しない問題を修正
- Fix: ローカルURLのプレビューポップアップが左上に表示される
diff --git a/locales/index.d.ts b/locales/index.d.ts
index 779a5d2c3f..70741b6460 100644
--- a/locales/index.d.ts
+++ b/locales/index.d.ts
@@ -449,6 +449,10 @@ export interface Locale extends ILocale {
*/
"renoted": string;
/**
+ * {name} にリノートしました。
+ */
+ "renotedToX": ParameterizedString<"name">;
+ /**
* この投稿はリノートできません。
*/
"cantRenote": string;
@@ -469,6 +473,14 @@ export interface Locale extends ILocale {
*/
"inChannelQuote": string;
/**
+ * チャンネルにリノート
+ */
+ "renoteToChannel": string;
+ /**
+ * 他のチャンネルにリノート
+ */
+ "renoteToOtherChannel": string;
+ /**
* ピン留めされたノート
*/
"pinnedNote": string;
diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index 8f17215802..b5808f7541 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -108,11 +108,14 @@ enterEmoji: "絵文字を入力"
renote: "リノート"
unrenote: "リノート解除"
renoted: "リノートしました。"
+renotedToX: "{name} にリノートしました。"
cantRenote: "この投稿はリノートできません。"
cantReRenote: "リノートをリノートすることはできません。"
quote: "引用"
inChannelRenote: "チャンネル内リノート"
inChannelQuote: "チャンネル内引用"
+renoteToChannel: "チャンネルにリノート"
+renoteToOtherChannel: "他のチャンネルにリノート"
pinnedNote: "ピン留めされたノート"
pinned: "ピン留め"
you: "あなた"
diff --git a/packages/frontend/src/scripts/get-note-menu.ts b/packages/frontend/src/scripts/get-note-menu.ts
index 2cd21c1edc..e7c9a848e0 100644
--- a/packages/frontend/src/scripts/get-note-menu.ts
+++ b/packages/frontend/src/scripts/get-note-menu.ts
@@ -518,6 +518,7 @@ export function getRenoteMenu(props: {
const channelRenoteItems: MenuItem[] = [];
const normalRenoteItems: MenuItem[] = [];
+ const normalExternalChannelRenoteItems: MenuItem[] = [];
if (appearNote.channel) {
channelRenoteItems.push(...[{
@@ -596,12 +597,49 @@ export function getRenoteMenu(props: {
});
},
}]);
+
+ normalExternalChannelRenoteItems.push({
+ type: 'parent',
+ icon: 'ti ti-repeat',
+ text: appearNote.channel ? i18n.ts.renoteToOtherChannel : i18n.ts.renoteToChannel,
+ children: async () => {
+ const channels = await misskeyApi('channels/my-favorites', {
+ limit: 30,
+ });
+ return channels.filter((channel) => {
+ if (!appearNote.channelId) return true;
+ return channel.id !== appearNote.channelId;
+ }).map((channel) => ({
+ text: channel.name,
+ action: () => {
+ const el = props.renoteButton.value;
+ if (el) {
+ const rect = el.getBoundingClientRect();
+ const x = rect.left + (el.offsetWidth / 2);
+ const y = rect.top + (el.offsetHeight / 2);
+ os.popup(MkRippleEffect, { x, y }, {}, 'end');
+ }
+
+ if (!props.mock) {
+ misskeyApi('notes/create', {
+ renoteId: appearNote.id,
+ channelId: channel.id,
+ }).then(() => {
+ os.toast(i18n.tsx.renotedToX({ name: channel.name }));
+ });
+ }
+ },
+ }));
+ },
+ });
}
const renoteItems = [
...normalRenoteItems,
...(channelRenoteItems.length > 0 && normalRenoteItems.length > 0) ? [{ type: 'divider' }] as MenuItem[] : [],
...channelRenoteItems,
+ ...(normalExternalChannelRenoteItems.length > 0 && (normalRenoteItems.length > 0 || channelRenoteItems.length > 0)) ? [{ type: 'divider' }] as MenuItem[] : [],
+ ...normalExternalChannelRenoteItems,
];
return {