kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Subscriptions: add subscription option to account dropdown
rodzic
dd9b876f9c
commit
fd0380bc82
|
@ -54,6 +54,8 @@ const messages = defineMessages({
|
||||||
deleteUser: { id: 'admin.users.actions.delete_user', defaultMessage: 'Delete @{name}' },
|
deleteUser: { id: 'admin.users.actions.delete_user', defaultMessage: 'Delete @{name}' },
|
||||||
verifyUser: { id: 'admin.users.actions.verify_user', defaultMessage: 'Verify @{name}' },
|
verifyUser: { id: 'admin.users.actions.verify_user', defaultMessage: 'Verify @{name}' },
|
||||||
unverifyUser: { id: 'admin.users.actions.unverify_user', defaultMessage: 'Unverify @{name}' },
|
unverifyUser: { id: 'admin.users.actions.unverify_user', defaultMessage: 'Unverify @{name}' },
|
||||||
|
subscribe: { id: 'account.subscribe', defaultMessage: 'Subscribe to notifications from @{name}' },
|
||||||
|
unsubscribe: { id: 'account.unsubscribe', defaultMessage: 'Unsubscribe to notifications from @{name}' },
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
|
@ -158,6 +160,12 @@ class Header extends ImmutablePureComponent {
|
||||||
menu.push({ text: intl.formatMessage(messages.showReblogs, { name: account.get('username') }), action: this.props.onReblogToggle });
|
menu.push({ text: intl.formatMessage(messages.showReblogs, { name: account.get('username') }), action: this.props.onReblogToggle });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (account.getIn(['relationship', 'subscribing'])) {
|
||||||
|
menu.push({ text: intl.formatMessage(messages.unsubscribe, { name: account.get('username') }), action: this.props.onSubscriptionToggle });
|
||||||
|
} else {
|
||||||
|
menu.push({ text: intl.formatMessage(messages.subscribe, { name: account.get('username') }), action: this.props.onSubscriptionToggle });
|
||||||
|
}
|
||||||
|
|
||||||
menu.push({ text: intl.formatMessage(messages.add_or_remove_from_list), action: this.props.onAddToList });
|
menu.push({ text: intl.formatMessage(messages.add_or_remove_from_list), action: this.props.onAddToList });
|
||||||
// menu.push({ text: intl.formatMessage(account.getIn(['relationship', 'endorsed']) ? messages.unendorse : messages.endorse), action: this.props.onEndorseToggle });
|
// menu.push({ text: intl.formatMessage(account.getIn(['relationship', 'endorsed']) ? messages.unendorse : messages.endorse), action: this.props.onEndorseToggle });
|
||||||
menu.push(null);
|
menu.push(null);
|
||||||
|
|
|
@ -52,6 +52,10 @@ export default class Header extends ImmutablePureComponent {
|
||||||
this.props.onReblogToggle(this.props.account);
|
this.props.onReblogToggle(this.props.account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleSubscriptionToggle = () => {
|
||||||
|
this.props.onSubscriptionToggle(this.props.account);
|
||||||
|
}
|
||||||
|
|
||||||
handleMute = () => {
|
handleMute = () => {
|
||||||
this.props.onMute(this.props.account);
|
this.props.onMute(this.props.account);
|
||||||
}
|
}
|
||||||
|
@ -117,6 +121,7 @@ export default class Header extends ImmutablePureComponent {
|
||||||
onDirect={this.handleDirect}
|
onDirect={this.handleDirect}
|
||||||
onChat={this.handleChat}
|
onChat={this.handleChat}
|
||||||
onReblogToggle={this.handleReblogToggle}
|
onReblogToggle={this.handleReblogToggle}
|
||||||
|
onSubscriptionToggle={this.handleSubscriptionToggle}
|
||||||
onReport={this.handleReport}
|
onReport={this.handleReport}
|
||||||
onMute={this.handleMute}
|
onMute={this.handleMute}
|
||||||
onBlockDomain={this.handleBlockDomain}
|
onBlockDomain={this.handleBlockDomain}
|
||||||
|
|
|
@ -10,6 +10,9 @@ import {
|
||||||
unmuteAccount,
|
unmuteAccount,
|
||||||
// pinAccount,
|
// pinAccount,
|
||||||
// unpinAccount,
|
// unpinAccount,
|
||||||
|
subscribeAccount,
|
||||||
|
unsubscribeAccount,
|
||||||
|
|
||||||
} from '../../../actions/accounts';
|
} from '../../../actions/accounts';
|
||||||
import {
|
import {
|
||||||
mentionCompose,
|
mentionCompose,
|
||||||
|
@ -103,6 +106,14 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onSubscriptionToggle(account) {
|
||||||
|
if (account.getIn(['relationship', 'subscribing'])) {
|
||||||
|
dispatch(unsubscribeAccount(account.get('id')));
|
||||||
|
} else {
|
||||||
|
dispatch(subscribeAccount(account.get('id')));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// onEndorseToggle(account) {
|
// onEndorseToggle(account) {
|
||||||
// if (account.getIn(['relationship', 'endorsed'])) {
|
// if (account.getIn(['relationship', 'endorsed'])) {
|
||||||
// dispatch(unpinAccount(account.get('id')));
|
// dispatch(unpinAccount(account.get('id')));
|
||||||
|
|
|
@ -12,8 +12,8 @@ import {
|
||||||
} from 'soapbox/actions/accounts';
|
} from 'soapbox/actions/accounts';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
subscribe: { id: 'account.subscribe', defaultMessage: 'Subscribe to @{name} posts' },
|
subscribe: { id: 'account.subscribe', defaultMessage: 'Subscribe to notifications from @{name}' },
|
||||||
unsubscribe: { id: 'account.unsubscribe', defaultMessage: 'Unsubscribe @{name} posts' },
|
unsubscribe: { id: 'account.unsubscribe', defaultMessage: 'Unsubscribe to notifications from @{name}' },
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
|
|
Ładowanie…
Reference in New Issue