Fix to invert button behavior with Shift key

This commit is contained in:
noellabo 2021-06-18 19:46:05 +09:00
parent d3ef510fd6
commit 059cb8f8f7
12 changed files with 19 additions and 19 deletions

View file

@ -41,7 +41,7 @@ class Account extends ImmutablePureComponent {
}; };
handleFollow = (e) => { handleFollow = (e) => {
if ((e && e.shiftKey) || !follow_button_to_list_adder) { if ((e && e.shiftKey) ^ !follow_button_to_list_adder) {
this.props.onFollow(this.props.account); this.props.onFollow(this.props.account);
} else { } else {
this.props.onAddToList(this.props.account); this.props.onAddToList(this.props.account);
@ -49,7 +49,7 @@ class Account extends ImmutablePureComponent {
} }
handleSubscribe = (e) => { handleSubscribe = (e) => {
if ((e && e.shiftKey) || !follow_button_to_list_adder) { if ((e && e.shiftKey) ^ !follow_button_to_list_adder) {
this.props.onSubscribe(this.props.account); this.props.onSubscribe(this.props.account);
} else { } else {
this.props.onAddToList(this.props.account); this.props.onAddToList(this.props.account);

View file

@ -36,7 +36,7 @@ class AccountActionBar extends ImmutablePureComponent {
] ]
handleFollow = (e) => { handleFollow = (e) => {
if ((e && e.shiftKey) || !follow_button_to_list_adder) { if ((e && e.shiftKey) ^ !follow_button_to_list_adder) {
this.props.onFollow(this.props.account); this.props.onFollow(this.props.account);
} else { } else {
this.props.onAddToList(this.props.account); this.props.onAddToList(this.props.account);
@ -44,7 +44,7 @@ class AccountActionBar extends ImmutablePureComponent {
} }
handleSubscribe = (e) => { handleSubscribe = (e) => {
if ((e && e.shiftKey) || !follow_button_to_list_adder) { if ((e && e.shiftKey) ^ !follow_button_to_list_adder) {
this.props.onSubscribe(this.props.account); this.props.onSubscribe(this.props.account);
} else { } else {
this.props.onAddToList(this.props.account); this.props.onAddToList(this.props.account);

View file

@ -111,7 +111,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
}, },
onReblog (status, e) { onReblog (status, e) {
if ((e && e.shiftKey) || !boostModal) { if ((e && e.shiftKey) ^ !boostModal) {
this.onModalReblog(status); this.onModalReblog(status);
} else { } else {
dispatch(initBoostModal({ status, onReblog: this.onModalReblog })); dispatch(initBoostModal({ status, onReblog: this.onModalReblog }));

View file

@ -129,7 +129,7 @@ class Header extends ImmutablePureComponent {
} }
handleFollow = (e) => { handleFollow = (e) => {
if ((e && e.shiftKey) || !follow_button_to_list_adder) { if ((e && e.shiftKey) ^ !follow_button_to_list_adder) {
this.props.onFollow(this.props.account); this.props.onFollow(this.props.account);
} else { } else {
this.props.onAddToList(this.props.account); this.props.onAddToList(this.props.account);
@ -137,7 +137,7 @@ class Header extends ImmutablePureComponent {
} }
handleSubscribe = (e) => { handleSubscribe = (e) => {
if ((e && e.shiftKey) || !follow_button_to_list_adder) { if ((e && e.shiftKey) ^ !follow_button_to_list_adder) {
this.props.onSubscribe(this.props.account); this.props.onSubscribe(this.props.account);
} else { } else {
this.props.onAddToList(this.props.account); this.props.onAddToList(this.props.account);

View file

@ -36,7 +36,7 @@ export default class Header extends ImmutablePureComponent {
}; };
handleFollow = (e) => { handleFollow = (e) => {
if ((e && e.shiftKey) || !follow_button_to_list_adder) { if ((e && e.shiftKey) ^ !follow_button_to_list_adder) {
this.props.onFollow(this.props.account); this.props.onFollow(this.props.account);
} else { } else {
this.props.onAddToList(this.props.account); this.props.onAddToList(this.props.account);
@ -44,7 +44,7 @@ export default class Header extends ImmutablePureComponent {
} }
handleSubscribe = (e) => { handleSubscribe = (e) => {
if ((e && e.shiftKey) || !follow_button_to_list_adder) { if ((e && e.shiftKey) ^ !follow_button_to_list_adder) {
this.props.onSubscribe(this.props.account); this.props.onSubscribe(this.props.account);
} else { } else {
this.props.onAddToList(this.props.account); this.props.onAddToList(this.props.account);

View file

@ -168,7 +168,7 @@ class AccountCard extends ImmutablePureComponent {
} }
handleFollow = (e) => { handleFollow = (e) => {
if ((e && e.shiftKey) || !follow_button_to_list_adder) { if ((e && e.shiftKey) ^ !follow_button_to_list_adder) {
this.props.onFollow(this.props.account); this.props.onFollow(this.props.account);
} else { } else {
this.props.onAddToList(this.props.account); this.props.onAddToList(this.props.account);
@ -176,7 +176,7 @@ class AccountCard extends ImmutablePureComponent {
}; };
handleSubscribe = (e) => { handleSubscribe = (e) => {
if ((e && e.shiftKey) || !follow_button_to_list_adder) { if ((e && e.shiftKey) ^ !follow_button_to_list_adder) {
this.props.onSubscribe(this.props.account); this.props.onSubscribe(this.props.account);
} else { } else {
this.props.onAddToList(this.props.account); this.props.onAddToList(this.props.account);

View file

@ -179,7 +179,7 @@ class AccountCard extends ImmutablePureComponent {
}; };
handleFollow = (e) => { handleFollow = (e) => {
if ((e && e.shiftKey) || !follow_button_to_list_adder) { if ((e && e.shiftKey) ^ !follow_button_to_list_adder) {
this.props.onFollow(this.props.account); this.props.onFollow(this.props.account);
} else { } else {
this.props.onAddToList(this.props.account); this.props.onAddToList(this.props.account);
@ -187,7 +187,7 @@ class AccountCard extends ImmutablePureComponent {
}; };
handleSubscribe = (e) => { handleSubscribe = (e) => {
if ((e && e.shiftKey) || !follow_button_to_list_adder) { if ((e && e.shiftKey) ^ !follow_button_to_list_adder) {
this.props.onSubscribe(this.props.account); this.props.onSubscribe(this.props.account);
} else { } else {
this.props.onAddToList(this.props.account); this.props.onAddToList(this.props.account);

View file

@ -178,7 +178,7 @@ class GroupDetail extends ImmutablePureComponent {
}; };
handleFollow = (e) => { handleFollow = (e) => {
if ((e && e.shiftKey) || !follow_button_to_list_adder) { if ((e && e.shiftKey) ^ !follow_button_to_list_adder) {
this.props.onFollow(this.props.account); this.props.onFollow(this.props.account);
} else { } else {
this.props.onAddToList(this.props.account); this.props.onAddToList(this.props.account);
@ -186,7 +186,7 @@ class GroupDetail extends ImmutablePureComponent {
}; };
handleSubscribe = (e) => { handleSubscribe = (e) => {
if ((e && e.shiftKey) || !follow_button_to_list_adder) { if ((e && e.shiftKey) ^ !follow_button_to_list_adder) {
this.props.onSubscribe(this.props.account); this.props.onSubscribe(this.props.account);
} else { } else {
this.props.onAddToList(this.props.account); this.props.onAddToList(this.props.account);

View file

@ -47,7 +47,7 @@ const mapDispatchToProps = dispatch => ({
if (status.get('reblogged')) { if (status.get('reblogged')) {
dispatch(unreblog(status)); dispatch(unreblog(status));
} else { } else {
if (e.shiftKey || !boostModal) { if (e.shiftKey ^ !boostModal) {
this.onModalReblog(status); this.onModalReblog(status);
} else { } else {
dispatch(initBoostModal({ status, onReblog: this.onModalReblog })); dispatch(initBoostModal({ status, onReblog: this.onModalReblog }));

View file

@ -105,7 +105,7 @@ class Footer extends ImmutablePureComponent {
if (status.get('reblogged')) { if (status.get('reblogged')) {
dispatch(unreblog(status)); dispatch(unreblog(status));
} else if ((e && e.shiftKey) || !boostModal) { } else if ((e && e.shiftKey) ^ !boostModal) {
this._performReblog(status); this._performReblog(status);
} else { } else {
dispatch(initBoostModal({ status, onReblog: this._performReblog })); dispatch(initBoostModal({ status, onReblog: this._performReblog }));

View file

@ -86,7 +86,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
if (status.get('reblogged')) { if (status.get('reblogged')) {
dispatch(unreblog(status)); dispatch(unreblog(status));
} else { } else {
if (e.shiftKey || !boostModal) { if (e.shiftKey ^ !boostModal) {
this.onModalReblog(status); this.onModalReblog(status);
} else { } else {
dispatch(initBoostModal({ status, onReblog: this.onModalReblog })); dispatch(initBoostModal({ status, onReblog: this.onModalReblog }));

View file

@ -260,7 +260,7 @@ class Status extends ImmutablePureComponent {
if (status.get('reblogged')) { if (status.get('reblogged')) {
this.props.dispatch(unreblog(status)); this.props.dispatch(unreblog(status));
} else { } else {
if ((e && e.shiftKey) || !boostModal) { if ((e && e.shiftKey) ^ !boostModal) {
this.handleModalReblog(status); this.handleModalReblog(status);
} else { } else {
this.props.dispatch(initBoostModal({ status, onReblog: this.handleModalReblog })); this.props.dispatch(initBoostModal({ status, onReblog: this.handleModalReblog }));