diff --git a/app/controllers/api/v1/reports_controller.rb b/app/controllers/api/v1/reports_controller.rb
index 8ff6c8fe5..300c9faa3 100644
--- a/app/controllers/api/v1/reports_controller.rb
+++ b/app/controllers/api/v1/reports_controller.rb
@@ -23,6 +23,6 @@ class Api::V1::ReportsController < Api::BaseController
end
def report_params
- params.permit(:account_id, :comment, :category, :forward, status_ids: [], rule_ids: [])
+ params.permit(:account_id, :comment, :category, :forward, forward_to_domains: [], status_ids: [], rule_ids: [])
end
end
diff --git a/app/helpers/accounts_helper.rb b/app/helpers/accounts_helper.rb
index b8277ee17..e16458d7d 100644
--- a/app/helpers/accounts_helper.rb
+++ b/app/helpers/accounts_helper.rb
@@ -22,7 +22,7 @@ module AccountsHelper
def account_action_button(account)
return if account.memorial? || account.moved?
- link_to ActivityPub::TagManager.instance.url_for(account), class: 'button logo-button', target: '_new' do
+ link_to ActivityPub::TagManager.instance.url_for(account), class: 'button', target: '_new' do
safe_join([logo_as_symbol, t('accounts.follow')])
end
end
diff --git a/app/javascript/mastodon/features/account/components/header.jsx b/app/javascript/mastodon/features/account/components/header.jsx
index d95184cdb..ececb86c0 100644
--- a/app/javascript/mastodon/features/account/components/header.jsx
+++ b/app/javascript/mastodon/features/account/components/header.jsx
@@ -264,14 +264,14 @@ class Header extends ImmutablePureComponent {
if (signedIn && !account.get('relationship')) { // Wait until the relationship is loaded
actionBtn = '';
} else if (account.getIn(['relationship', 'requested'])) {
- actionBtn = ;
+ actionBtn = ;
} else if (!account.getIn(['relationship', 'blocking'])) {
- actionBtn = ;
+ actionBtn = ;
} else if (account.getIn(['relationship', 'blocking'])) {
- actionBtn = ;
+ actionBtn = ;
}
} else {
- actionBtn = ;
+ actionBtn = ;
}
if (account.get('moved') && !account.getIn(['relationship', 'following'])) {
diff --git a/app/javascript/mastodon/features/directory/components/account_card.jsx b/app/javascript/mastodon/features/directory/components/account_card.jsx
index 795979530..0306b63d3 100644
--- a/app/javascript/mastodon/features/directory/components/account_card.jsx
+++ b/app/javascript/mastodon/features/directory/components/account_card.jsx
@@ -160,16 +160,16 @@ class AccountCard extends ImmutablePureComponent {
if (!account.get('relationship')) { // Wait until the relationship is loaded
actionBtn = '';
} else if (account.getIn(['relationship', 'requested'])) {
- actionBtn = ;
+ actionBtn = ;
} else if (account.getIn(['relationship', 'muting'])) {
- actionBtn = ;
+ actionBtn = ;
} else if (!account.getIn(['relationship', 'blocking'])) {
- actionBtn = ;
+ actionBtn = ;
} else if (account.getIn(['relationship', 'blocking'])) {
- actionBtn = ;
+ actionBtn = ;
}
} else {
- actionBtn = ;
+ actionBtn = ;
}
return (
diff --git a/app/javascript/mastodon/features/explore/statuses.jsx b/app/javascript/mastodon/features/explore/statuses.jsx
index 3271929db..043492fb8 100644
--- a/app/javascript/mastodon/features/explore/statuses.jsx
+++ b/app/javascript/mastodon/features/explore/statuses.jsx
@@ -52,6 +52,7 @@ class Statuses extends PureComponent {
state.get('statuses'),
+ (_, statusIds) => statusIds,
+ ],
+ (statusesMap, statusIds) => statusIds.map((statusId) => statusesMap.getIn([statusId, 'in_reply_to_account_id'])),
+ {
+ resultEqualityCheck: shallowEqual,
+ }
+);
- static propTypes = {
- onSubmit: PropTypes.func.isRequired,
- comment: PropTypes.string.isRequired,
- onChangeComment: PropTypes.func.isRequired,
- intl: PropTypes.object.isRequired,
- isSubmitting: PropTypes.bool,
- forward: PropTypes.bool,
- isRemote: PropTypes.bool,
- domain: PropTypes.string,
- onChangeForward: PropTypes.func.isRequired,
- };
+const Comment = ({ comment, domain, statusIds, isRemote, isSubmitting, selectedDomains, onSubmit, onChangeComment, onToggleDomain }) => {
+ const intl = useIntl();
- handleClick = () => {
- const { onSubmit } = this.props;
- onSubmit();
- };
+ const dispatch = useAppDispatch();
+ const loadedRef = useRef(false);
- handleChange = e => {
- const { onChangeComment } = this.props;
- onChangeComment(e.target.value);
- };
+ const handleClick = useCallback(() => onSubmit(), [onSubmit]);
+ const handleChange = useCallback((e) => onChangeComment(e.target.value), [onChangeComment]);
+ const handleToggleDomain = useCallback(e => onToggleDomain(e.target.value, e.target.checked), [onToggleDomain]);
- handleKeyDown = e => {
+ const handleKeyDown = useCallback((e) => {
if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) {
- this.handleClick();
+ handleClick();
}
- };
+ }, [handleClick]);
- handleForwardChange = e => {
- const { onChangeForward } = this.props;
- onChangeForward(e.target.checked);
- };
+ // Memoize accountIds since we don't want it to trigger `useEffect` on each render
+ const accountIds = useAppSelector((state) => domain ? selectRepliedToAccountIds(state, statusIds) : ImmutableList());
- render () {
- const { comment, isRemote, forward, domain, isSubmitting, intl } = this.props;
+ // While we could memoize `availableDomains`, it is pretty inexpensive to recompute
+ const accountsMap = useAppSelector((state) => state.get('accounts'));
+ const availableDomains = domain ? OrderedSet([domain]).union(accountIds.map((accountId) => accountsMap.getIn([accountId, 'acct'], '').split('@')[1]).filter(domain => !!domain)) : OrderedSet();
- return (
- <>
-
+ useEffect(() => {
+ if (loadedRef.current) {
+ return;
+ }
-
+ loadedRef.current = true;
- {isRemote && (
- <>
-
+ // First, pre-select known domains
+ availableDomains.forEach((domain) => {
+ onToggleDomain(domain, true);
+ });
-