Add a setting to switch the non-standard buttons on the action bar

This commit is contained in:
noellabo 2020-07-01 19:05:49 +09:00
parent e63d057f37
commit 5182c8e3a8
11 changed files with 41 additions and 6 deletions

View file

@ -61,6 +61,8 @@ class Settings::PreferencesController < Settings::BaseController
:setting_show_followed_by,
:setting_follow_button_to_list_adder,
:setting_show_navigation_panel,
:setting_show_quote_button,
:setting_show_bookmark_button,
:setting_show_target,
notification_emails: %i(follow follow_request reblog favourite mention digest report pending_account trending_tag),
interactions: %i(must_be_follower must_be_following must_be_following_dm)

View file

@ -6,7 +6,7 @@ import IconButton from './icon_button';
import DropdownMenuContainer from '../containers/dropdown_menu_container';
import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { me, isStaff } from '../initial_state';
import { me, isStaff, show_bookmark_button, show_quote_button } from '../initial_state';
import classNames from 'classnames';
const messages = defineMessages({
@ -258,6 +258,9 @@ class StatusActionBar extends ImmutablePureComponent {
menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed });
}
if (!show_bookmark_button) {
menu.push({ text: intl.formatMessage(status.get('bookmarked') ? messages.removeBookmark : messages.bookmark), action: this.handleBookmarkClick });
}
menu.push(null);
if (writtenByMe && publicStatus && !expired) {
@ -345,9 +348,9 @@ class StatusActionBar extends ImmutablePureComponent {
<IconButton className='status__action-bar-button' disabled={expired} title={replyTitle} icon={status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) ? 'reply' : replyIcon} onClick={this.handleReplyClick} counter={status.get('replies_count')} obfuscateCount />
<IconButton className={classNames('status__action-bar-button', { reblogPrivate })} disabled={!publicStatus && !reblogPrivate || expired} active={status.get('reblogged')} pressed={status.get('reblogged')} title={reblogTitle} icon='retweet' onClick={this.handleReblogClick} />
<IconButton className='status__action-bar-button star-icon' animate disabled={!me && expired} active={status.get('favourited')} pressed={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} />
<IconButton className='status__action-bar-button' disabled={anonymousAccess || !publicStatus || expired} title={!publicStatus ? intl.formatMessage(messages.cannot_quote) : intl.formatMessage(messages.quote)} icon='quote-right' onClick={this.handleQuoteClick} />
{show_quote_button && <IconButton className='status__action-bar-button' disabled={anonymousAccess || !publicStatus || expired} title={!publicStatus ? intl.formatMessage(messages.cannot_quote) : intl.formatMessage(messages.quote)} icon='quote-right' onClick={this.handleQuoteClick} />}
{shareButton}
<IconButton className='status__action-bar-button bookmark-icon' disabled={!me && expired} active={status.get('bookmarked')} pressed={status.get('bookmarked')} title={intl.formatMessage(status.get('bookmarked') ? messages.removeBookmark : messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} />
{show_bookmark_button && <IconButton className='status__action-bar-button bookmark-icon' disabled={!me && expired} active={status.get('bookmarked')} pressed={status.get('bookmarked')} title={intl.formatMessage(status.get('bookmarked') ? messages.removeBookmark : messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} />}
<div className='status__action-bar-dropdown'>
<DropdownMenuContainer

View file

@ -5,7 +5,7 @@ import IconButton from '../../../components/icon_button';
import ImmutablePropTypes from 'react-immutable-proptypes';
import DropdownMenuContainer from '../../../containers/dropdown_menu_container';
import { defineMessages, injectIntl } from 'react-intl';
import { me, isStaff } from '../../../initial_state';
import { me, isStaff, show_quote_button } from '../../../initial_state';
import classNames from 'classnames';
const messages = defineMessages({
@ -299,7 +299,7 @@ class ActionBar extends React.PureComponent {
<div className='detailed-status__button'><IconButton disabled={expired} title={intl.formatMessage(messages.reply)} icon={status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) ? 'reply' : replyIcon} onClick={this.handleReplyClick} /></div>
<div className='detailed-status__button'><IconButton className={classNames({ reblogPrivate })} disabled={!publicStatus && !reblogPrivate || expired} active={status.get('reblogged')} title={reblogTitle} icon='retweet' onClick={this.handleReblogClick} /></div>
<div className='detailed-status__button'><IconButton className='star-icon' animate active={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} /></div>
<div className='detailed-status__button'><IconButton disabled={!publicStatus || expired} title={!publicStatus ? intl.formatMessage(messages.cannot_quote) : intl.formatMessage(messages.quote)} icon='quote-right' onClick={this.handleQuoteClick} /></div>
{show_quote_button && <div className='detailed-status__button'><IconButton disabled={!publicStatus || expired} title={!publicStatus ? intl.formatMessage(messages.cannot_quote) : intl.formatMessage(messages.quote)} icon='quote-right' onClick={this.handleQuoteClick} /></div>}
{shareButton}
<div className='detailed-status__button'><IconButton className='bookmark-icon' active={status.get('bookmarked')} title={intl.formatMessage(messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} /></div>

View file

@ -33,6 +33,8 @@ export const show_subscribe_button_on_timeline = getMeta('show_subscribe_button_
export const show_followed_by = getMeta('show_followed_by');
export const follow_button_to_list_adder = getMeta('follow_button_to_list_adder');
export const show_navigation_panel = getMeta('show_navigation_panel');
export const show_quote_button = getMeta('show_quote_button');
export const show_bookmark_button = getMeta('show_bookmark_button');
export const show_target = getMeta('show_target');
export default initialState;

View file

@ -45,6 +45,8 @@ class UserSettingsDecorator
user.settings['show_followed_by'] = show_followed_by_preference if change?('setting_show_followed_by')
user.settings['follow_button_to_list_adder'] = follow_button_to_list_adder_preference if change?('setting_follow_button_to_list_adder')
user.settings['show_navigation_panel'] = show_navigation_panel_preference if change?('setting_show_navigation_panel')
user.settings['show_quote_button'] = show_quote_button_preference if change?('setting_show_quote_button')
user.settings['show_bookmark_button'] = show_bookmark_button_preference if change?('setting_show_bookmark_button')
user.settings['show_target'] = show_target_preference if change?('setting_show_target')
end
@ -168,6 +170,14 @@ class UserSettingsDecorator
boolean_cast_setting 'setting_show_navigation_panel'
end
def show_quote_button_preference
boolean_cast_setting 'setting_show_quote_button'
end
def show_bookmark_button_preference
boolean_cast_setting 'setting_show_bookmark_button'
end
def show_target_preference
boolean_cast_setting 'setting_show_target'
end

View file

@ -128,7 +128,7 @@ class User < ApplicationRecord
:disable_swiping,
:show_follow_button_on_timeline, :show_subscribe_button_on_timeline, :show_target,
:show_follow_button_on_timeline, :show_subscribe_button_on_timeline, :show_followed_by, :show_target,
:follow_button_to_list_adder, :show_navigation_panel,
:follow_button_to_list_adder, :show_navigation_panel, :show_quote_button, :show_bookmark_button,
to: :settings, prefix: :setting, allow_nil: false
attr_reader :invite_code, :sign_in_token_attempt

View file

@ -47,6 +47,8 @@ class InitialStateSerializer < ActiveModel::Serializer
store[:show_followed_by] = object.current_account.user.setting_show_followed_by
store[:follow_button_to_list_adder] = object.current_account.user.setting_follow_button_to_list_adder
store[:show_navigation_panel] = object.current_account.user.setting_show_navigation_panel
store[:show_quote_button] = object.current_account.user.setting_show_quote_button
store[:show_bookmark_button] = object.current_account.user.setting_show_bookmark_button
store[:show_target] = object.current_account.user.setting_show_target
else
store[:auto_play_gif] = Setting.auto_play_gif

View file

@ -48,6 +48,12 @@
.fields-group
= f.input :setting_show_navigation_panel, as: :boolean, wrapper: :with_label
.fields-group
= f.input :setting_show_quote_button, as: :boolean, wrapper: :with_label
.fields-group
= f.input :setting_show_bookmark_button, as: :boolean, wrapper: :with_label
-# .fields-group
-# = f.input :setting_show_target, as: :boolean, wrapper: :with_label

View file

@ -55,8 +55,10 @@ en:
setting_hide_network: Who you follow and who follows you will be hidden on your profile
setting_noindex: Affects your public profile and post pages
setting_show_application: The application you use to post will be displayed in the detailed view of your posts
setting_show_bookmark_button: When turned off, the bookmark call will be in Mastodon's standard position (in the menu on the action bar)
setting_show_follow_button_on_timeline: You can easily check the follow status and build a follow list quickly
setting_show_navigation_panel: Show the navigation panel at the right end of the advanced UI
setting_show_quote_button: Selects whether to display the button on the action bar. It does not enable/disable the citation function.
setting_show_subscribe_button_on_timeline: You can easily check the status of your subscriptions and quickly build a subscription list
setting_show_followed_by: "The color of the follow button changes according to the follow status (gray: no follow relationship, yellow: followed, blue: following, green: mutual follow)"
setting_show_target: Enable the function to switch between posting target and follow / subscribe target
@ -184,8 +186,10 @@ en:
setting_noindex: Opt-out of search engine indexing
setting_reduce_motion: Reduce motion in animations
setting_show_application: Disclose application used to send posts
setting_show_bookmark_button: Show the bookmark button on the action bar
setting_show_follow_button_on_timeline: Show follow button on timeline
setting_show_navigation_panel: Show the navigation panel
setting_show_quote_button: Show the quote button on the action bar
setting_show_subscribe_button_on_timeline: Show subscribe button on timeline
setting_show_followed_by: Reflect the following status on the follow button
setting_show_target: Enable targeting features

View file

@ -55,8 +55,10 @@ ja:
setting_hide_network: フォローとフォロワーの情報がプロフィールページで見られないようにします
setting_noindex: 公開プロフィールおよび各投稿ページに影響します
setting_show_application: 投稿するのに使用したアプリが投稿の詳細ビューに表示されるようになります
setting_show_bookmark_button: オフにした場合、ブックマークの呼び出しはMastodon標準の位置となりますアクションバーのメニューの中
setting_show_follow_button_on_timeline: フォロー状態を確認し易くなり、素早くフォローリストを構築できます
setting_show_navigation_panel: 上級者向け UI の右端にナビゲーションパネルを表示します
setting_show_quote_button: アクションバーへボタンを表示するかどうかの設定です。引用機能の有効・無効を切り替えるものではありません
setting_show_subscribe_button_on_timeline: 購読状態を確認し易くなり、素早く購読リストを構築できます
setting_show_followed_by: フォロー状態に応じてフォローボタンの色が変わります(灰色:フォロー関係なし、黄色:フォローされている、青色:フォローしている、緑色:相互フォロー)
setting_show_target: 投稿対象と、フォロー・購読の対象を切り替える機能を有効にします
@ -184,8 +186,10 @@ ja:
setting_noindex: 検索エンジンによるインデックスを拒否する
setting_reduce_motion: アニメーションの動きを減らす
setting_show_application: 送信したアプリを開示する
setting_show_bookmark_button: ブックマークボタンをアクションバーに表示する
setting_show_follow_button_on_timeline: タイムライン上にフォローボタンを表示する
setting_show_navigation_panel: ナビゲーションパネルを表示する
setting_show_quote_button: 引用ボタンをアクションバーに表示する
setting_show_subscribe_button_on_timeline: タイムライン上に購読ボタンを表示する
setting_show_followed_by: 被フォロー状態をフォローボタンに反映する
setting_show_target: ターゲット機能を有効にする

View file

@ -44,6 +44,8 @@ defaults: &defaults
show_followed_by: false
follow_button_to_list_adder: false
show_navigation_panel: true
show_bookmark_button: true
show_quote_button: true
show_target: false
notification_emails:
follow: false