Add: #396 スタンプの数字を隠して表示する機能 (#412)

This commit is contained in:
KMY(雪あすか) 2024-01-03 22:10:13 +09:00 committed by GitHub
parent eee362b9e0
commit 8757ac7deb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 18 additions and 2 deletions

View file

@ -7,6 +7,8 @@ import classNames from 'classnames';
import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePropTypes from 'react-immutable-proptypes';
import { isHideItem } from 'mastodon/initial_state';
import EmojiView from './emoji_view'; import EmojiView from './emoji_view';
class EmojiReactionButton extends PureComponent { class EmojiReactionButton extends PureComponent {
@ -41,12 +43,14 @@ class EmojiReactionButton extends PureComponent {
'toggled': me, 'toggled': me,
}; };
const countView = count !== undefined && <span className='count'>{count}</span>;
return ( return (
<button className={classNames(classList)} type='button' onClick={this.onClick}> <button className={classNames(classList)} type='button' onClick={this.onClick}>
<span className='emoji'> <span className='emoji'>
<EmojiView name={name} url={url} staticUrl={staticUrl} /> <EmojiView name={name} url={url} staticUrl={staticUrl} />
</span> </span>
<span className='count'>{count}</span> {countView}
</button> </button>
); );
} }
@ -76,6 +80,8 @@ class StatusEmojiReactionsBar extends PureComponent {
render () { render () {
const { emojiReactions, myReactionOnly } = this.props; const { emojiReactions, myReactionOnly } = this.props;
const isShowCount = !isHideItem('emoji_reaction_count');
const emojiButtons = Array.from(emojiReactions) const emojiButtons = Array.from(emojiReactions)
.filter(emoji => emoji.get('count') !== 0) .filter(emoji => emoji.get('count') !== 0)
.filter(emoji => !myReactionOnly || emoji.get('me')) .filter(emoji => !myReactionOnly || emoji.get('me'))
@ -83,7 +89,7 @@ class StatusEmojiReactionsBar extends PureComponent {
<EmojiReactionButton <EmojiReactionButton
key={index} key={index}
name={emoji.get('name')} name={emoji.get('name')}
count={myReactionOnly ? 1 : emoji.get('count')} count={isShowCount ? (myReactionOnly ? 1 : emoji.get('count')) : undefined}
me={emoji.get('me')} me={emoji.get('me')}
url={emoji.get('url')} url={emoji.get('url')}
staticUrl={emoji.get('static_url')} staticUrl={emoji.get('static_url')}

View file

@ -5,6 +5,7 @@
* @typedef { 'blocking_quote' * @typedef { 'blocking_quote'
* | 'emoji_reaction_on_timeline' * | 'emoji_reaction_on_timeline'
* | 'emoji_reaction_unavailable_server' * | 'emoji_reaction_unavailable_server'
* | 'emoji_reaction_count'
* | 'favourite_menu' * | 'favourite_menu'
* | 'quote_in_home' * | 'quote_in_home'
* | 'quote_in_public' * | 'quote_in_public'

View file

@ -259,6 +259,10 @@ module User::HasSettings
settings['web.hide_emoji_reaction_unavailable_server'] settings['web.hide_emoji_reaction_unavailable_server']
end end
def setting_hide_emoji_reaction_count
settings['web.hide_emoji_reaction_count']
end
def setting_hide_favourite_menu def setting_hide_favourite_menu
settings['web.hide_favourite_menu'] settings['web.hide_favourite_menu']
end end

View file

@ -72,6 +72,7 @@ class UserSettings
setting :hide_blocking_quote, default: true setting :hide_blocking_quote, default: true
setting :hide_emoji_reaction_unavailable_server, default: false setting :hide_emoji_reaction_unavailable_server, default: false
setting :hide_favourite_menu, default: false setting :hide_favourite_menu, default: false
setting :hide_emoji_reaction_count, default: false
end end
namespace :notification_emails do namespace :notification_emails do

View file

@ -41,6 +41,7 @@ class InitialStateSerializer < ActiveModel::Serializer
object_account_user.setting_hide_recent_emojis ? 'recent_emojis' : nil, object_account_user.setting_hide_recent_emojis ? 'recent_emojis' : nil,
object_account_user.setting_hide_blocking_quote ? 'blocking_quote' : nil, object_account_user.setting_hide_blocking_quote ? 'blocking_quote' : nil,
object_account_user.setting_hide_emoji_reaction_unavailable_server ? 'emoji_reaction_unavailable_server' : nil, object_account_user.setting_hide_emoji_reaction_unavailable_server ? 'emoji_reaction_unavailable_server' : nil,
object_account_user.setting_hide_emoji_reaction_count ? 'emoji_reaction_count' : nil,
object_account_user.setting_show_emoji_reaction_on_timeline ? nil : 'emoji_reaction_on_timeline', object_account_user.setting_show_emoji_reaction_on_timeline ? nil : 'emoji_reaction_on_timeline',
object_account_user.setting_show_quote_in_home ? nil : 'quote_in_home', object_account_user.setting_show_quote_in_home ? nil : 'quote_in_home',
object_account_user.setting_show_quote_in_public ? nil : 'quote_in_public', object_account_user.setting_show_quote_in_public ? nil : 'quote_in_public',

View file

@ -46,6 +46,7 @@
= ff.input :'web.enable_emoji_reaction', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_enable_emoji_reaction'), hint: I18n.t('simple_form.hints.defaults.setting_enable_emoji_reaction') = ff.input :'web.enable_emoji_reaction', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_enable_emoji_reaction'), hint: I18n.t('simple_form.hints.defaults.setting_enable_emoji_reaction')
= ff.input :'web.show_emoji_reaction_on_timeline', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_emoji_reaction_on_timeline') = ff.input :'web.show_emoji_reaction_on_timeline', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_emoji_reaction_on_timeline')
= ff.input :'web.hide_emoji_reaction_unavailable_server', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_hide_emoji_reaction_unavailable_server') = ff.input :'web.hide_emoji_reaction_unavailable_server', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_hide_emoji_reaction_unavailable_server')
= ff.input :'web.hide_emoji_reaction_count', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_hide_emoji_reaction_count')
%h4= t 'appearance.saved_posts' %h4= t 'appearance.saved_posts'

View file

@ -269,6 +269,7 @@ en:
outside_only: Followings or followers only outside_only: Followings or followers only
setting_expand_spoilers: Always expand posts marked with content warnings setting_expand_spoilers: Always expand posts marked with content warnings
setting_hide_blocking_quote: Hide posts which have a quote written by the user you are blocking setting_hide_blocking_quote: Hide posts which have a quote written by the user you are blocking
setting_hide_emoji_reaction_count: Hide stamp count
setting_hide_emoji_reaction_unavailable_server: Hide stamp button from unavailable server setting_hide_emoji_reaction_unavailable_server: Hide stamp button from unavailable server
setting_hide_favourite_menu: Hide favourite menu setting_hide_favourite_menu: Hide favourite menu
setting_hide_followers_count: Hide followers count setting_hide_followers_count: Hide followers count

View file

@ -278,6 +278,7 @@ ja:
setting_enable_emoji_reaction: スタンプ機能を使用する setting_enable_emoji_reaction: スタンプ機能を使用する
setting_expand_spoilers: 閲覧注意としてマークされた投稿を常に展開する setting_expand_spoilers: 閲覧注意としてマークされた投稿を常に展開する
setting_hide_blocking_quote: ブロックしたユーザーの投稿を引用した投稿を隠す setting_hide_blocking_quote: ブロックしたユーザーの投稿を引用した投稿を隠す
setting_hide_emoji_reaction_count: 各スタンプの数を隠す
setting_hide_emoji_reaction_unavailable_server: スタンプに対応していないと思われるサーバーの投稿からスタンプボタンを隠す setting_hide_emoji_reaction_unavailable_server: スタンプに対応していないと思われるサーバーの投稿からスタンプボタンを隠す
setting_hide_favourite_menu: 右サイドメニューから「お気に入り」を隠す setting_hide_favourite_menu: 右サイドメニューから「お気に入り」を隠す
setting_hide_followers_count: フォロワー数を隠す setting_hide_followers_count: フォロワー数を隠す