Skip to content

Commit

Permalink
Add simple_timeline_menu setting
Browse files Browse the repository at this point in the history
  • Loading branch information
kmycode committed Sep 18, 2023
1 parent e4e9a9f commit c0af1b0
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 18 deletions.
42 changes: 24 additions & 18 deletions app/javascript/mastodon/components/status_action_bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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 });

Expand All @@ -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 });
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/mastodon/initial_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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');
Expand Down
4 changes: 4 additions & 0 deletions app/models/concerns/has_user_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/models/user_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/serializers/initial_state_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions app/views/settings/preferences/appearance/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions config/locales/simple_form.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions config/locales/simple_form.ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: システムのデフォルトフォントを使う
Expand Down

0 comments on commit c0af1b0

Please sign in to comment.