Pull patronUrl from /api/patron/v1/instance

This commit is contained in:
Alex Gleason 2020-07-04 14:21:58 -05:00
parent 0dc085411c
commit 82c07f84b4
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 6 additions and 9 deletions

View file

@ -39,13 +39,11 @@ const messages = defineMessages({
const mapStateToProps = state => {
const me = state.get('me');
const getAccount = makeGetAccount();
const patronEnabled = state.getIn(['soapbox', 'extensions', 'patron', 'enabled']);
const patronUrl = state.getIn(['soapbox', 'extensions', 'patron', 'baseUrl']);
return {
account: getAccount(state, me),
sidebarOpen: state.get('sidebar').sidebarOpen,
patronUrl: patronEnabled && patronUrl,
donateUrl: state.getIn(['patron', 'url']),
isStaff: isStaff(state.getIn(['accounts', me])),
};
};
@ -77,7 +75,7 @@ class SidebarMenu extends ImmutablePureComponent {
}
render() {
const { sidebarOpen, onClose, intl, account, onClickLogOut, patronUrl, isStaff } = this.props;
const { sidebarOpen, onClose, intl, account, onClickLogOut, donateUrl, isStaff } = this.props;
if (!account) return null;
const acct = account.get('acct');
@ -129,8 +127,8 @@ class SidebarMenu extends ImmutablePureComponent {
<Icon id='envelope' />
<span className='sidebar-menu-item__title'>{intl.formatMessage(messages.messages)}</span>
</NavLink>
{patronUrl ?
<a className='sidebar-menu-item' href={patronUrl} onClick={onClose}>
{donateUrl ?
<a className='sidebar-menu-item' href={donateUrl} onClick={onClose}>
<Icon id='dollar' />
<span className='sidebar-menu-item__title'>{intl.formatMessage(messages.donate)}</span>
</a>

View file

@ -22,7 +22,7 @@ class FundingPanel extends ImmutablePureComponent {
}
render() {
const { patron, patronUrl } = this.props;
const { patron } = this.props;
if (patron.isEmpty()) return null;
const amount = patron.getIn(['funding', 'amount']);
@ -53,7 +53,7 @@ class FundingPanel extends ImmutablePureComponent {
<div className='funding-panel__description'>
{goal_text}
</div>
{patronUrl && <a className='button' href={patronUrl}>Donate</a>}
<a className='button' href={patron.get('url')}>Donate</a>
</div>
</div>
);
@ -64,7 +64,6 @@ class FundingPanel extends ImmutablePureComponent {
const mapStateToProps = state => {
return {
patron: state.get('patron'),
patronUrl: state.getIn(['soapbox', 'extensions', 'patron', 'baseUrl']),
};
};