* Remove: #955 フィルターのアクション`half_warn` * Add: 「フィルター対象投稿の投稿者名やアイコンを表示する」設定 * Fix test
This commit is contained in:
parent
22bf14e9f0
commit
67064de265
19 changed files with 49 additions and 45 deletions
|
@ -55,7 +55,7 @@ export function updateNotifications(notification, intlMessages, intlLocale) {
|
|||
if (['mention', 'status'].includes(notification.type) && notification.status.filtered) {
|
||||
const filters = notification.status.filtered.filter(result => result.filter.context.includes('notifications'));
|
||||
|
||||
if (filters.some(result => result.filter.filter_action_ex === 'hide')) {
|
||||
if (filters.some(result => result.filter.filter_action === 'hide')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -592,24 +592,26 @@ class Status extends ImmutablePureComponent {
|
|||
|
||||
<div className={classNames('status', `status-${status.get('visibility_ex')}`, { 'status-reply': !!status.get('in_reply_to_id'), 'status--in-thread': !!rootId, 'status--first-in-thread': previousId && (!connectUp || connectToRoot), muted: this.props.muted })} data-id={status.get('id')}>
|
||||
|
||||
<div onMouseUp={this.handleMouseUp} className='status__info'>
|
||||
<Link to={`/@${status.getIn(['account', 'acct'])}/${status.get('id')}`} className='status__relative-time'>
|
||||
{withQuote}
|
||||
{withReference}
|
||||
{withExpiration}
|
||||
{withLimited}
|
||||
<span className='status__visibility-icon'><VisibilityIcon visibility={status.get('visibility_ex')} /></span>
|
||||
<RelativeTimestamp timestamp={status.get('created_at')} />{status.get('edited_at') && <abbr title={intl.formatMessage(messages.edited, { date: intl.formatDate(status.get('edited_at'), { year: 'numeric', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }) })}> *</abbr>}
|
||||
</Link>
|
||||
{(!matchedFilters || expanded || isShowItem('avatar_on_filter')) && (
|
||||
<div onMouseUp={this.handleMouseUp} className='status__info'>
|
||||
<Link to={`/@${status.getIn(['account', 'acct'])}/${status.get('id')}`} className='status__relative-time'>
|
||||
{withQuote}
|
||||
{withReference}
|
||||
{withExpiration}
|
||||
{withLimited}
|
||||
<span className='status__visibility-icon'><VisibilityIcon visibility={status.get('visibility_ex')} /></span>
|
||||
<RelativeTimestamp timestamp={status.get('created_at')} />{status.get('edited_at') && <abbr title={intl.formatMessage(messages.edited, { date: intl.formatDate(status.get('edited_at'), { year: 'numeric', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }) })}> *</abbr>}
|
||||
</Link>
|
||||
|
||||
<Link to={`/@${status.getIn(['account', 'acct'])}`} title={status.getIn(['account', 'acct'])} data-hover-card-account={status.getIn(['account', 'id'])} className='status__display-name'>
|
||||
<div className='status__avatar'>
|
||||
{statusAvatar}
|
||||
</div>
|
||||
<Link to={`/@${status.getIn(['account', 'acct'])}`} title={status.getIn(['account', 'acct'])} data-hover-card-account={status.getIn(['account', 'id'])} className='status__display-name'>
|
||||
<div className='status__avatar'>
|
||||
{statusAvatar}
|
||||
</div>
|
||||
|
||||
<DisplayName account={status.get('account')} />
|
||||
</Link>
|
||||
</div>
|
||||
<DisplayName account={status.get('account')} />
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{matchedFilters && <FilterWarning title={matchedFilters.join(', ')} expanded={this.state.showDespiteFilter} onClick={this.handleFilterToggle} />}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
* | 'recent_emojis'
|
||||
* | 'relationships'
|
||||
* | 'status_reference_unavailable_server'
|
||||
* | 'avatar_on_filter'
|
||||
* } HideItemsDefinition
|
||||
*/
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ const normalizeFilter = (state, filter) => {
|
|||
title: filter.title,
|
||||
context: filter.context,
|
||||
filter_action: filter.filter_action,
|
||||
filter_action_ex: filter.filter_action_ex,
|
||||
keywords: filter.keywords,
|
||||
expires_at: filter.expires_at ? Date.parse(filter.expires_at) : null,
|
||||
with_quote: filter.with_quote,
|
||||
|
|
|
@ -36,7 +36,6 @@ export const makeGetStatus = () => {
|
|||
}
|
||||
|
||||
let filtered = false;
|
||||
let filterAction = 'warn';
|
||||
if ((accountReblog || accountBase).get('id') !== me && filters) {
|
||||
let filterResults = statusReblog?.get('filtered') || statusBase.get('filtered') || ImmutableList();
|
||||
const quoteFilterResults = statusQuote?.get('filtered');
|
||||
|
@ -47,13 +46,12 @@ export const makeGetStatus = () => {
|
|||
}
|
||||
}
|
||||
|
||||
if (filterResults.some((result) => filters.getIn([result.get('filter'), 'filter_action_ex']) === 'hide')) {
|
||||
if (filterResults.some((result) => filters.getIn([result.get('filter'), 'filter_action']) === 'hide')) {
|
||||
return null;
|
||||
}
|
||||
filterResults = filterResults.filter(result => filters.has(result.get('filter')));
|
||||
if (!filterResults.isEmpty()) {
|
||||
filtered = filterResults.map(result => filters.getIn([result.get('filter'), 'title']));
|
||||
filterAction = filterResults.some((result) => filters.getIn([result.get('filter'), 'filter_action_ex']) === 'warn') ? 'warn' : 'half_warn';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,8 +60,6 @@ export const makeGetStatus = () => {
|
|||
map.set('quote', statusQuote);
|
||||
map.set('account', accountBase);
|
||||
map.set('matched_filters', filtered);
|
||||
map.set('filter_action', filterAction);
|
||||
map.set('filter_action_ex', filterAction);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
|
|
@ -123,6 +123,10 @@ module User::HasSettings
|
|||
settings['web.show_relationships']
|
||||
end
|
||||
|
||||
def setting_show_avatar_on_filter
|
||||
settings['web.show_avatar_on_filter']
|
||||
end
|
||||
|
||||
def setting_allow_quote
|
||||
settings['allow_quote']
|
||||
end
|
||||
|
|
|
@ -38,7 +38,7 @@ class CustomFilter < ApplicationRecord
|
|||
include Expireable
|
||||
include Redisable
|
||||
|
||||
enum :action, { warn: 0, hide: 1, half_warn: 2 }, suffix: :action
|
||||
enum :action, { warn: 0, hide: 1 }, suffix: :action
|
||||
|
||||
belongs_to :account
|
||||
has_many :keywords, class_name: 'CustomFilterKeyword', inverse_of: :custom_filter, dependent: :destroy
|
||||
|
|
|
@ -83,6 +83,7 @@ class UserSettings
|
|||
setting :hide_status_reference_unavailable_server, default: false
|
||||
setting :hide_favourite_menu, default: false
|
||||
setting :hide_emoji_reaction_count, default: false
|
||||
setting :show_avatar_on_filter, default: true
|
||||
|
||||
setting_inverse_alias :'web.show_blocking_quote', :'web.hide_blocking_quote'
|
||||
setting_inverse_alias :'web.show_emoji_reaction_count', :'web.hide_emoji_reaction_count'
|
||||
|
|
|
@ -48,6 +48,7 @@ class InitialStateSerializer < ActiveModel::Serializer
|
|||
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_relationships ? nil : 'relationships',
|
||||
object_account_user.setting_show_avatar_on_filter ? nil : 'avatar_on_filter',
|
||||
].compact
|
||||
store[:enabled_visibilities] = enabled_visibilities
|
||||
store[:featured_tags] = object.current_account.featured_tags.pluck(:name)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class REST::FilterSerializer < ActiveModel::Serializer
|
||||
attributes :id, :title, :exclude_follows, :exclude_localusers, :with_quote, :with_profile, :context, :expires_at, :filter_action, :filter_action_ex
|
||||
attributes :id, :title, :exclude_follows, :exclude_localusers, :with_quote, :with_profile, :context, :expires_at, :filter_action
|
||||
has_many :keywords, serializer: REST::FilterKeywordSerializer, if: :rules_requested?
|
||||
has_many :statuses, serializer: REST::FilterStatusSerializer, if: :rules_requested?
|
||||
|
||||
|
@ -12,14 +12,4 @@ class REST::FilterSerializer < ActiveModel::Serializer
|
|||
def rules_requested?
|
||||
instance_options[:rules_requested]
|
||||
end
|
||||
|
||||
def filter_action
|
||||
return :warn if object.half_warn_action?
|
||||
|
||||
object.filter_action
|
||||
end
|
||||
|
||||
def filter_action_ex
|
||||
object.filter_action
|
||||
end
|
||||
end
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
.fields-group
|
||||
= f.input :filter_action,
|
||||
as: :radio_buttons,
|
||||
collection: %i(half_warn warn hide),
|
||||
collection: %i(warn hide),
|
||||
hint: t('simple_form.hints.filters.action'),
|
||||
include_blank: false,
|
||||
label_method: ->(action) { filter_action_label(action) },
|
||||
|
|
|
@ -141,6 +141,7 @@
|
|||
|
||||
.fields-group
|
||||
= ff.input :'web.expand_content_warnings', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_expand_spoilers')
|
||||
= ff.input :'web.show_avatar_on_filter', wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_show_avatar_on_filter')
|
||||
|
||||
.actions
|
||||
= f.button :button, t('generic.save_changes'), type: :submit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue