From c0af1b0aafcdc8c7b1bc4ee791bff5c715dea197 Mon Sep 17 00:00:00 2001 From: KMY Date: Mon, 18 Sep 2023 11:46:26 +0900 Subject: [PATCH] Add simple_timeline_menu setting --- .../mastodon/components/status_action_bar.jsx | 42 +++++++++++-------- app/javascript/mastodon/initial_state.js | 2 + app/models/concerns/has_user_settings.rb | 4 ++ app/models/user_settings.rb | 1 + app/serializers/initial_state_serializer.rb | 1 + .../preferences/appearance/show.html.haml | 3 ++ config/locales/simple_form.en.yml | 1 + config/locales/simple_form.ja.yml | 1 + 8 files changed, 37 insertions(+), 18 deletions(-) diff --git a/app/javascript/mastodon/components/status_action_bar.jsx b/app/javascript/mastodon/components/status_action_bar.jsx index 2fb57c4debc615..d689b1ed0344b7 100644 --- a/app/javascript/mastodon/components/status_action_bar.jsx +++ b/app/javascript/mastodon/components/status_action_bar.jsx @@ -13,7 +13,7 @@ import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'mastodon/ import DropdownMenuContainer from '../containers/dropdown_menu_container'; import EmojiPickerDropdown from '../features/compose/containers/emoji_picker_dropdown_container'; -import { enableEmojiReaction , bookmarkCategoryNeeded, me } from '../initial_state'; +import { enableEmojiReaction , bookmarkCategoryNeeded, simpleTimelineMenu, me } from '../initial_state'; import { IconButton } from './icon_button'; @@ -289,24 +289,28 @@ class StatusActionBar extends ImmutablePureComponent { let menu = []; - menu.push({ text: intl.formatMessage(messages.open), action: this.handleOpen }); + if (!simpleTimelineMenu) { + menu.push({ text: intl.formatMessage(messages.open), action: this.handleOpen }); - if (publicStatus && isRemote) { - menu.push({ text: intl.formatMessage(messages.openOriginalPage), href: status.get('url') }); - } - - menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy }); - - if (publicStatus && 'share' in navigator) { - menu.push({ text: intl.formatMessage(messages.share), action: this.handleShareClick }); - } - - if (anonymousStatus && (signedIn || !isRemote)) { - menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed }); + if (publicStatus && isRemote) { + menu.push({ text: intl.formatMessage(messages.openOriginalPage), href: status.get('url') }); + } + + menu.push({ text: intl.formatMessage(messages.copy), action: this.handleCopy }); + + if (publicStatus && 'share' in navigator) { + menu.push({ text: intl.formatMessage(messages.share), action: this.handleShareClick }); + } + + if (anonymousStatus && (signedIn || !isRemote)) { + menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed }); + } } if (signedIn) { - menu.push(null); + if (!simpleTimelineMenu) { + menu.push(null); + } menu.push({ text: intl.formatMessage(status.get('reblogged') ? messages.cancelReblog : messages.reblog), action: this.handleReblogForceModalClick }); @@ -333,9 +337,11 @@ class StatusActionBar extends ImmutablePureComponent { menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick, dangerous: true }); menu.push({ text: intl.formatMessage(messages.redraft), action: this.handleRedraftClick, dangerous: true }); } else { - menu.push({ text: intl.formatMessage(messages.mention, { name: account.get('username') }), action: this.handleMentionClick }); - menu.push({ text: intl.formatMessage(messages.direct, { name: account.get('username') }), action: this.handleDirectClick }); - menu.push(null); + if (!simpleTimelineMenu) { + menu.push({ text: intl.formatMessage(messages.mention, { name: account.get('username') }), action: this.handleMentionClick }); + menu.push({ text: intl.formatMessage(messages.direct, { name: account.get('username') }), action: this.handleDirectClick }); + menu.push(null); + } if (relationship && relationship.get('muting')) { menu.push({ text: intl.formatMessage(messages.unmute, { name: account.get('username') }), action: this.handleMuteClick }); diff --git a/app/javascript/mastodon/initial_state.js b/app/javascript/mastodon/initial_state.js index 8b2a0df69bd6a0..902158bc77bb15 100644 --- a/app/javascript/mastodon/initial_state.js +++ b/app/javascript/mastodon/initial_state.js @@ -77,6 +77,7 @@ * @property {boolean} search_enabled * @property {boolean} trends_enabled * @property {boolean} show_emoji_reaction_on_timeline + * @property {string} simple_timeline_menu * @property {boolean} single_user_mode * @property {string} source_url * @property {string} streaming_api_base_url @@ -147,6 +148,7 @@ export const searchEnabled = getMeta('search_enabled'); export const trendsEnabled = getMeta('trends_enabled'); export const showEmojiReactionOnTimeline = getMeta('show_emoji_reaction_on_timeline'); export const showTrends = getMeta('show_trends'); +export const simpleTimelineMenu = getMeta('simple_timeline_menu'); export const singleUserMode = getMeta('single_user_mode'); export const source_url = getMeta('source_url'); export const timelinePreview = getMeta('timeline_preview'); diff --git a/app/models/concerns/has_user_settings.rb b/app/models/concerns/has_user_settings.rb index 8a5e1a0b12903e..674804c2956e0a 100644 --- a/app/models/concerns/has_user_settings.rb +++ b/app/models/concerns/has_user_settings.rb @@ -51,6 +51,10 @@ def setting_show_emoji_reaction_on_timeline settings['web.show_emoji_reaction_on_timeline'] end + def setting_simple_timeline_menu + settings['web.simple_timeline_menu'] + end + def setting_default_sensitive settings['default_sensitive'] end diff --git a/app/models/user_settings.rb b/app/models/user_settings.rb index ee7d2df42337c6..b16e89556b9099 100644 --- a/app/models/user_settings.rb +++ b/app/models/user_settings.rb @@ -64,6 +64,7 @@ class KeyError < Error; end setting :display_media, default: 'default', in: %w(default show_all hide_all) setting :display_media_expand, default: true setting :auto_play, default: true + setting :simple_timeline_menu, default: false end namespace :notification_emails do diff --git a/app/serializers/initial_state_serializer.rb b/app/serializers/initial_state_serializer.rb index f8a3f924f7228d..8f67f7e75416dd 100644 --- a/app/serializers/initial_state_serializer.rb +++ b/app/serializers/initial_state_serializer.rb @@ -60,6 +60,7 @@ def meta store[:use_pending_items] = object.current_account.user.setting_use_pending_items store[:show_trends] = Setting.trends && object.current_account.user.setting_trends store[:bookmark_category_needed] = object.current_account.user.setting_bookmark_category_needed + store[:simple_timeline_menu] = object.current_account.user.setting_simple_timeline_menu else store[:auto_play_gif] = Setting.auto_play_gif store[:display_media] = Setting.display_media diff --git a/app/views/settings/preferences/appearance/show.html.haml b/app/views/settings/preferences/appearance/show.html.haml index aaa24794fb15c2..fd41160c13b440 100644 --- a/app/views/settings/preferences/appearance/show.html.haml +++ b/app/views/settings/preferences/appearance/show.html.haml @@ -46,6 +46,9 @@ .fields-group = ff.input :'web.bookmark_category_needed', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_bookmark_category_needed'), hint: I18n.t('simple_form.hints.defaults.setting_bookmark_category_needed') + .fields-group + = ff.input :'web.simple_timeline_menu', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_simple_timeline_menu') + %h4= t 'appearance.discovery' .fields-group diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index f4e30c8fb931f5..355bdb4809ee93 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -270,6 +270,7 @@ en: setting_send_without_domain_blocks: Send your post to all server with administrator set as rejecting-post-server for protect you [DEPRECATED] setting_show_application: Disclose application used to send posts setting_show_emoji_reaction_on_timeline: Show all stamps on timeline + setting_simple_timeline_menu: Reduce post menu on timeline setting_stay_privacy: Not change privacy after post setting_stop_emoji_reaction_streaming: Disable stamp streamings setting_system_font_ui: Use system's default font diff --git a/config/locales/simple_form.ja.yml b/config/locales/simple_form.ja.yml index 1a225fcf7b0672..9c45732db96c88 100644 --- a/config/locales/simple_form.ja.yml +++ b/config/locales/simple_form.ja.yml @@ -285,6 +285,7 @@ ja: setting_send_without_domain_blocks: 管理人の設定した配送停止設定を拒否する (非推奨) setting_show_application: 送信したアプリを開示する setting_show_emoji_reaction_on_timeline: タイムライン上に他の人のつけたスタンプを表示する + setting_simple_timeline_menu: タイムライン上でメニューの項目を減らす setting_stay_privacy: 投稿時に公開範囲を保存する setting_stop_emoji_reaction_streaming: スタンプのストリーミングを停止する setting_system_font_ui: システムのデフォルトフォントを使う