Merge commit '6c381f20b1d52c96525cbd5c41b0c972c3394a48' into glitch-soc/merge-upstream

Conflicts:
- `app/models/user_settings.rb`:
  Upstream removed a setting textually adjacent to a glitch-soc-only setting.
  Removed the setting glitch-soc removed.
This commit is contained in:
Claire 2024-04-06 21:01:40 +02:00
commit 1d1c3a808a
14 changed files with 88 additions and 103 deletions

View File

@ -13,7 +13,6 @@ import {
import { openModal } from '../actions/modal'; import { openModal } from '../actions/modal';
import { initMuteModal } from '../actions/mutes'; import { initMuteModal } from '../actions/mutes';
import Account from '../components/account'; import Account from '../components/account';
import { unfollowModal } from '../initial_state';
import { makeGetAccount } from '../selectors'; import { makeGetAccount } from '../selectors';
const messages = defineMessages({ const messages = defineMessages({
@ -34,7 +33,6 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
onFollow (account) { onFollow (account) {
if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) { if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) {
if (unfollowModal) {
dispatch(openModal({ dispatch(openModal({
modalType: 'CONFIRM', modalType: 'CONFIRM',
modalProps: { modalProps: {
@ -43,9 +41,6 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
onConfirm: () => dispatch(unfollowAccount(account.get('id'))), onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
}, },
})); }));
} else {
dispatch(unfollowAccount(account.get('id')));
}
} else { } else {
dispatch(followAccount(account.get('id'))); dispatch(followAccount(account.get('id')));
} }

View File

@ -21,7 +21,6 @@ import { initDomainBlockModal, unblockDomain } from '../../../actions/domain_blo
import { openModal } from '../../../actions/modal'; import { openModal } from '../../../actions/modal';
import { initMuteModal } from '../../../actions/mutes'; import { initMuteModal } from '../../../actions/mutes';
import { initReport } from '../../../actions/reports'; import { initReport } from '../../../actions/reports';
import { unfollowModal } from '../../../initial_state';
import { makeGetAccount, getAccountHidden } from '../../../selectors'; import { makeGetAccount, getAccountHidden } from '../../../selectors';
import Header from '../components/header'; import Header from '../components/header';
@ -47,7 +46,6 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
onFollow (account) { onFollow (account) {
if (account.getIn(['relationship', 'following'])) { if (account.getIn(['relationship', 'following'])) {
if (unfollowModal) {
dispatch(openModal({ dispatch(openModal({
modalType: 'CONFIRM', modalType: 'CONFIRM',
modalProps: { modalProps: {
@ -56,11 +54,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
onConfirm: () => dispatch(unfollowAccount(account.get('id'))), onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
}, },
})); }));
} else {
dispatch(unfollowAccount(account.get('id')));
}
} else if (account.getIn(['relationship', 'requested'])) { } else if (account.getIn(['relationship', 'requested'])) {
if (unfollowModal) {
dispatch(openModal({ dispatch(openModal({
modalType: 'CONFIRM', modalType: 'CONFIRM',
modalProps: { modalProps: {
@ -69,9 +63,6 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
onConfirm: () => dispatch(unfollowAccount(account.get('id'))), onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
}, },
})); }));
} else {
dispatch(unfollowAccount(account.get('id')));
}
} else { } else {
dispatch(followAccount(account.get('id'))); dispatch(followAccount(account.get('id')));
} }

View File

@ -20,7 +20,7 @@ import { Avatar } from 'mastodon/components/avatar';
import { Button } from 'mastodon/components/button'; import { Button } from 'mastodon/components/button';
import { DisplayName } from 'mastodon/components/display_name'; import { DisplayName } from 'mastodon/components/display_name';
import { ShortNumber } from 'mastodon/components/short_number'; import { ShortNumber } from 'mastodon/components/short_number';
import { autoPlayGif, me, unfollowModal } from 'mastodon/initial_state'; import { autoPlayGif, me } from 'mastodon/initial_state';
import { makeGetAccount } from 'mastodon/selectors'; import { makeGetAccount } from 'mastodon/selectors';
const messages = defineMessages({ const messages = defineMessages({
@ -48,7 +48,6 @@ const makeMapStateToProps = () => {
const mapDispatchToProps = (dispatch, { intl }) => ({ const mapDispatchToProps = (dispatch, { intl }) => ({
onFollow(account) { onFollow(account) {
if (account.getIn(['relationship', 'following'])) { if (account.getIn(['relationship', 'following'])) {
if (unfollowModal) {
dispatch( dispatch(
openModal({ openModal({
modalType: 'CONFIRM', modalType: 'CONFIRM',
@ -64,11 +63,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
onConfirm: () => dispatch(unfollowAccount(account.get('id'))), onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
} }), } }),
); );
} else {
dispatch(unfollowAccount(account.get('id')));
}
} else if (account.getIn(['relationship', 'requested'])) { } else if (account.getIn(['relationship', 'requested'])) {
if (unfollowModal) {
dispatch(openModal({ dispatch(openModal({
modalType: 'CONFIRM', modalType: 'CONFIRM',
modalProps: { modalProps: {
@ -77,9 +72,6 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
onConfirm: () => dispatch(unfollowAccount(account.get('id'))), onConfirm: () => dispatch(unfollowAccount(account.get('id'))),
}, },
})); }));
} else {
dispatch(unfollowAccount(account.get('id')));
}
} else { } else {
dispatch(followAccount(account.get('id'))); dispatch(followAccount(account.get('id')));
} }

View File

@ -54,6 +54,7 @@ export default class ColumnSettings extends PureComponent {
render () { render () {
const { settings, pushSettings, onChange, onClear, alertsEnabled, browserSupport, browserPermission, onRequestNotificationPermission, notificationPolicy } = this.props; const { settings, pushSettings, onChange, onClear, alertsEnabled, browserSupport, browserPermission, onRequestNotificationPermission, notificationPolicy } = this.props;
const filterAdvancedStr = <FormattedMessage id='notifications.column_settings.filter_bar.advanced' defaultMessage='Display all categories' />;
const unreadMarkersShowStr = <FormattedMessage id='notifications.column_settings.unread_notifications.highlight' defaultMessage='Highlight unread notifications' />; const unreadMarkersShowStr = <FormattedMessage id='notifications.column_settings.unread_notifications.highlight' defaultMessage='Highlight unread notifications' />;
const alertStr = <FormattedMessage id='notifications.column_settings.alert' defaultMessage='Desktop notifications' />; const alertStr = <FormattedMessage id='notifications.column_settings.alert' defaultMessage='Desktop notifications' />;
const showStr = <FormattedMessage id='notifications.column_settings.show' defaultMessage='Show in column' />; const showStr = <FormattedMessage id='notifications.column_settings.show' defaultMessage='Show in column' />;
@ -116,6 +117,16 @@ export default class ColumnSettings extends PureComponent {
</div> </div>
</section> </section>
<section role='group' aria-labelledby='notifications-filter-bar'>
<h3 id='notifications-filter-bar'>
<FormattedMessage id='notifications.column_settings.filter_bar.category' defaultMessage='Quick filter bar' />
</h3>
<div className='column-settings__row'>
<SettingToggle id='advanced-filter-bar' prefix='notifications' settings={settings} settingPath={['quickFilter', 'advanced']} onChange={onChange} label={filterAdvancedStr} />
</div>
</section>
<section role='group' aria-labelledby='notifications-follow'> <section role='group' aria-labelledby='notifications-follow'>
<h3 id='notifications-follow'><FormattedMessage id='notifications.column_settings.follow' defaultMessage='New followers:' /></h3> <h3 id='notifications-follow'><FormattedMessage id='notifications.column_settings.follow' defaultMessage='New followers:' /></h3>

View File

@ -5,7 +5,7 @@ import FilterBar from '../components/filter_bar';
const makeMapStateToProps = state => ({ const makeMapStateToProps = state => ({
selectedFilter: state.getIn(['settings', 'notifications', 'quickFilter', 'active']), selectedFilter: state.getIn(['settings', 'notifications', 'quickFilter', 'active']),
advancedMode: false, advancedMode: state.getIn(['settings', 'notifications', 'quickFilter', 'advanced']),
}); });
const mapDispatchToProps = (dispatch) => ({ const mapDispatchToProps = (dispatch) => ({

View File

@ -38,7 +38,6 @@
* @property {string} title * @property {string} title
* @property {boolean} show_trends * @property {boolean} show_trends
* @property {boolean} trends_as_landing_page * @property {boolean} trends_as_landing_page
* @property {boolean} unfollow_modal
* @property {boolean} use_blurhash * @property {boolean} use_blurhash
* @property {boolean=} use_pending_items * @property {boolean=} use_pending_items
* @property {string} version * @property {string} version
@ -99,7 +98,6 @@ export const source_url = getMeta('source_url');
export const timelinePreview = getMeta('timeline_preview'); export const timelinePreview = getMeta('timeline_preview');
export const title = getMeta('title'); export const title = getMeta('title');
export const trendsAsLanding = getMeta('trends_as_landing_page'); export const trendsAsLanding = getMeta('trends_as_landing_page');
export const unfollowModal = getMeta('unfollow_modal');
export const useBlurhash = getMeta('use_blurhash'); export const useBlurhash = getMeta('use_blurhash');
export const usePendingItems = getMeta('use_pending_items'); export const usePendingItems = getMeta('use_pending_items');
export const version = getMeta('version'); export const version = getMeta('version');

View File

@ -484,6 +484,8 @@
"notifications.column_settings.admin.sign_up": "New sign-ups:", "notifications.column_settings.admin.sign_up": "New sign-ups:",
"notifications.column_settings.alert": "Desktop notifications", "notifications.column_settings.alert": "Desktop notifications",
"notifications.column_settings.favourite": "Favorites:", "notifications.column_settings.favourite": "Favorites:",
"notifications.column_settings.filter_bar.advanced": "Display all categories",
"notifications.column_settings.filter_bar.category": "Quick filter bar",
"notifications.column_settings.follow": "New followers:", "notifications.column_settings.follow": "New followers:",
"notifications.column_settings.follow_request": "New follow requests:", "notifications.column_settings.follow_request": "New follow requests:",
"notifications.column_settings.mention": "Mentions:", "notifications.column_settings.mention": "Mentions:",

View File

@ -27,10 +27,6 @@ module User::HasSettings
settings['default_sensitive'] settings['default_sensitive']
end end
def setting_unfollow_modal
settings['web.unfollow_modal']
end
def setting_boost_modal def setting_boost_modal
settings['web.reblog_modal'] settings['web.reblog_modal']
end end

View File

@ -31,7 +31,6 @@ class UserSettings
setting :disable_swiping, default: false setting :disable_swiping, default: false
setting :delete_modal, default: true setting :delete_modal, default: true
setting :reblog_modal, default: false setting :reblog_modal, default: false
setting :unfollow_modal, default: true
setting :favourite_modal, default: false setting :favourite_modal, default: false
setting :reduce_motion, default: false setting :reduce_motion, default: false
setting :expand_content_warnings, default: false setting :expand_content_warnings, default: false

View File

@ -31,7 +31,6 @@ class InitialStateSerializer < ActiveModel::Serializer
if object.current_account if object.current_account
store[:me] = object.current_account.id.to_s store[:me] = object.current_account.id.to_s
store[:unfollow_modal] = object_account_user.setting_unfollow_modal
store[:boost_modal] = object_account_user.setting_boost_modal store[:boost_modal] = object_account_user.setting_boost_modal
store[:favourite_modal] = object_account_user.setting_favourite_modal store[:favourite_modal] = object_account_user.setting_favourite_modal
store[:delete_modal] = object_account_user.setting_delete_modal store[:delete_modal] = object_account_user.setting_delete_modal

View File

@ -59,7 +59,6 @@
%h4= t 'appearance.confirmation_dialogs' %h4= t 'appearance.confirmation_dialogs'
.fields-group .fields-group
= ff.input :'web.unfollow_modal', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_unfollow_modal')
= ff.input :'web.reblog_modal', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_boost_modal') = ff.input :'web.reblog_modal', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_boost_modal')
= ff.input :'web.favourite_modal', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_favourite_modal'), glitch_only: true = ff.input :'web.favourite_modal', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_favourite_modal'), glitch_only: true
= ff.input :'web.delete_modal', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_delete_modal') = ff.input :'web.delete_modal', wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_delete_modal')

View File

@ -0,0 +1,24 @@
# frozen_string_literal: true
require 'rails_helper'
describe 'Severed relationships page' do
include ProfileStories
describe 'GET severed_relationships#index' do
before do
as_a_logged_in_user
event = Fabricate(:relationship_severance_event)
Fabricate.times(3, :severed_relationship, local_account: bob.account, relationship_severance_event: event)
Fabricate(:account_relationship_severance_event, account: bob.account, relationship_severance_event: event)
end
it 'returns http success' do
visit severed_relationships_path
expect(page).to have_title(I18n.t('settings.severed_relationships'))
expect(page).to have_link(href: following_severed_relationship_path(AccountRelationshipSeveranceEvent.first, format: :csv))
end
end
end

View File

@ -1,24 +0,0 @@
# frozen_string_literal: true
require 'rails_helper'
describe 'Severed relationships page' do
include RoutingHelper
describe 'GET severed_relationships#index' do
let(:user) { Fabricate(:user) }
let(:event) { Fabricate(:account_relationship_severance_event, account: user.account) }
before do
sign_in user
Fabricate.times(3, :severed_relationship, local_account: user.account, relationship_severance_event: event.relationship_severance_event)
end
it 'returns http success' do
get severed_relationships_path
expect(response).to have_http_status(200)
end
end
end

View File

@ -19,7 +19,7 @@ RSpec.describe BlockDomainService do
bystander.follow!(local_account) bystander.follow!(local_account)
end end
it 'creates a domain block, suspends remote accounts with appropriate suspension date, records severed relationships', :aggregate_failures do it 'creates a domain block, suspends remote accounts with appropriate suspension date, records severed relationships and sends notification', :aggregate_failures do
subject.call(DomainBlock.create!(domain: 'evil.org', severity: :suspend)) subject.call(DomainBlock.create!(domain: 'evil.org', severity: :suspend))
expect(DomainBlock.blocked?('evil.org')).to be true expect(DomainBlock.blocked?('evil.org')).to be true
@ -42,6 +42,9 @@ RSpec.describe BlockDomainService do
expect(severed_relationships.count).to eq 2 expect(severed_relationships.count).to eq 2
expect(severed_relationships[0].relationship_severance_event).to eq severed_relationships[1].relationship_severance_event expect(severed_relationships[0].relationship_severance_event).to eq severed_relationships[1].relationship_severance_event
expect(severed_relationships.map { |rel| [rel.account, rel.target_account] }).to contain_exactly([bystander, local_account], [local_account, bad_account]) expect(severed_relationships.map { |rel| [rel.account, rel.target_account] }).to contain_exactly([bystander, local_account], [local_account, bad_account])
# Sends severed relationships notification
expect(LocalNotificationWorker).to have_enqueued_sidekiq_job(local_account.id, anything, 'AccountRelationshipSeveranceEvent', 'severed_relationships')
end end
end end