[Glitch] Fix “Unblock” and “Unmute” actions being disabled when blocked
Port dd27c7b917 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -138,6 +138,8 @@ export const FollowButton: React.FC<{
|
|||||||
: messages.follow;
|
: messages.follow;
|
||||||
|
|
||||||
let label;
|
let label;
|
||||||
|
let disabled =
|
||||||
|
relationship?.blocked_by || account?.suspended || !!account?.moved;
|
||||||
|
|
||||||
if (!signedIn) {
|
if (!signedIn) {
|
||||||
label = intl.formatMessage(followMessage);
|
label = intl.formatMessage(followMessage);
|
||||||
@@ -147,12 +149,16 @@ export const FollowButton: React.FC<{
|
|||||||
label = <LoadingIndicator />;
|
label = <LoadingIndicator />;
|
||||||
} else if (relationship.muting && withUnmute) {
|
} else if (relationship.muting && withUnmute) {
|
||||||
label = intl.formatMessage(messages.unmute);
|
label = intl.formatMessage(messages.unmute);
|
||||||
|
disabled = false;
|
||||||
} else if (relationship.following) {
|
} else if (relationship.following) {
|
||||||
label = intl.formatMessage(messages.unfollow);
|
label = intl.formatMessage(messages.unfollow);
|
||||||
|
disabled = false;
|
||||||
} else if (relationship.blocking) {
|
} else if (relationship.blocking) {
|
||||||
label = intl.formatMessage(messages.unblock);
|
label = intl.formatMessage(messages.unblock);
|
||||||
|
disabled = false;
|
||||||
} else if (relationship.requested) {
|
} else if (relationship.requested) {
|
||||||
label = intl.formatMessage(messages.followRequestCancel);
|
label = intl.formatMessage(messages.followRequestCancel);
|
||||||
|
disabled = false;
|
||||||
} else if (relationship.followed_by && !account?.locked) {
|
} else if (relationship.followed_by && !account?.locked) {
|
||||||
label = intl.formatMessage(messages.followBack);
|
label = intl.formatMessage(messages.followBack);
|
||||||
} else {
|
} else {
|
||||||
@@ -187,11 +193,7 @@ export const FollowButton: React.FC<{
|
|||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
disabled={
|
disabled={disabled}
|
||||||
relationship?.blocked_by ||
|
|
||||||
(!(relationship?.following || relationship?.requested) &&
|
|
||||||
(account?.suspended || !!account?.moved))
|
|
||||||
}
|
|
||||||
secondary={following || relationship?.blocking}
|
secondary={following || relationship?.blocking}
|
||||||
compact={compact}
|
compact={compact}
|
||||||
className={classNames(className, { 'button--destructive': following })}
|
className={classNames(className, { 'button--destructive': following })}
|
||||||
|
|||||||
Reference in New Issue
Block a user