Add birthday reminder notification
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
409cb3819e
commit
d6f0023cc9
|
@ -109,6 +109,10 @@ export const NOTIFICATION_SETTINGS_REQUEST = 'NOTIFICATION_SETTINGS_REQUEST';
|
||||||
export const NOTIFICATION_SETTINGS_SUCCESS = 'NOTIFICATION_SETTINGS_SUCCESS';
|
export const NOTIFICATION_SETTINGS_SUCCESS = 'NOTIFICATION_SETTINGS_SUCCESS';
|
||||||
export const NOTIFICATION_SETTINGS_FAIL = 'NOTIFICATION_SETTINGS_FAIL';
|
export const NOTIFICATION_SETTINGS_FAIL = 'NOTIFICATION_SETTINGS_FAIL';
|
||||||
|
|
||||||
|
export const BIRTHDAY_REMINDERS_FETCH_REQUEST = 'BIRTHDAY_REMINDERS_FETCH_REQUEST';
|
||||||
|
export const BIRTHDAY_REMINDERS_FETCH_SUCCESS = 'BIRTHDAY_REMINDERS_FETCH_SUCCESS';
|
||||||
|
export const BIRTHDAY_REMINDERS_FETCH_FAIL = 'BIRTHDAY_REMINDERS_FETCH_FAIL';
|
||||||
|
|
||||||
export function createAccount(params) {
|
export function createAccount(params) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch({ type: ACCOUNT_CREATE_REQUEST, params });
|
dispatch({ type: ACCOUNT_CREATE_REQUEST, params });
|
||||||
|
@ -1030,3 +1034,26 @@ export function accountLookup(acct, cancelToken) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function fetchBirthdayReminders(day, month) {
|
||||||
|
return (dispatch, getState) => {
|
||||||
|
if (!isLoggedIn(getState)) return;
|
||||||
|
|
||||||
|
const me = getState().get('me');
|
||||||
|
|
||||||
|
dispatch({ type: BIRTHDAY_REMINDERS_FETCH_REQUEST, day, month, id: me });
|
||||||
|
|
||||||
|
api(getState).get('/api/v1/pleroma/birthday_reminders', { params: { day, month } }).then(response => {
|
||||||
|
dispatch(importFetchedAccounts(response.data));
|
||||||
|
dispatch({
|
||||||
|
type: BIRTHDAY_REMINDERS_FETCH_SUCCESS,
|
||||||
|
accounts: response.data,
|
||||||
|
day,
|
||||||
|
month,
|
||||||
|
id: me,
|
||||||
|
});
|
||||||
|
}).catch(error => {
|
||||||
|
dispatch({ type: BIRTHDAY_REMINDERS_FETCH_FAIL, day, month, id: me });
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -100,6 +100,10 @@ export const defaultSettings = ImmutableMap({
|
||||||
move: false,
|
move: false,
|
||||||
'pleroma:emoji_reaction': false,
|
'pleroma:emoji_reaction': false,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
birthdays: ImmutableMap({
|
||||||
|
show: true,
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
community: ImmutableMap({
|
community: ImmutableMap({
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import React from 'react';
|
||||||
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
import { injectIntl, FormattedMessage } from 'react-intl';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { fetchBirthdayReminders } from 'soapbox/actions/accounts';
|
||||||
|
import { openModal } from 'soapbox/actions/modal';
|
||||||
|
import Icon from 'soapbox/components/icon';
|
||||||
|
import { makeGetAccount } from 'soapbox/selectors';
|
||||||
|
|
||||||
|
const mapStateToProps = (state, props) => {
|
||||||
|
const me = state.get('me');
|
||||||
|
const getAccount = makeGetAccount();
|
||||||
|
|
||||||
|
const birthdays = state.getIn(['user_lists', 'birthday_reminders', me]);
|
||||||
|
|
||||||
|
if (birthdays && birthdays.size > 0) {
|
||||||
|
return {
|
||||||
|
birthdays,
|
||||||
|
account: getAccount(state, birthdays.first()),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
birthdays,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default @connect(mapStateToProps)
|
||||||
|
@injectIntl
|
||||||
|
class BirthdayReminders extends ImmutablePureComponent {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
birthdays: ImmutablePropTypes.orderedSet,
|
||||||
|
intl: PropTypes.object.isRequired,
|
||||||
|
dispatch: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
const { dispatch } = this.props;
|
||||||
|
|
||||||
|
const date = new Date();
|
||||||
|
|
||||||
|
const day = date.getDate();
|
||||||
|
const month = date.getMonth() + 1;
|
||||||
|
|
||||||
|
dispatch(fetchBirthdayReminders(day, month));
|
||||||
|
}
|
||||||
|
|
||||||
|
handleOpenBirthdaysModal = () => {
|
||||||
|
const { dispatch } = this.props;
|
||||||
|
|
||||||
|
dispatch(openModal('BIRTHDAYS'));
|
||||||
|
}
|
||||||
|
|
||||||
|
renderMessage() {
|
||||||
|
const { birthdays, account } = this.props;
|
||||||
|
|
||||||
|
const link = (
|
||||||
|
<bdi>
|
||||||
|
<Link
|
||||||
|
className='notification__display-name'
|
||||||
|
title={account.get('acct')}
|
||||||
|
to={`/@${account.get('acct')}`}
|
||||||
|
dangerouslySetInnerHTML={{ __html: account.get('display_name_html') }}
|
||||||
|
/>
|
||||||
|
</bdi>
|
||||||
|
);
|
||||||
|
|
||||||
|
if (birthdays.size === 1) {
|
||||||
|
return <FormattedMessage id='notification.birthday' defaultMessage='{name} has birthday today' values={{ name: link }} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<FormattedMessage
|
||||||
|
id='notification.birthday_plural'
|
||||||
|
defaultMessage='{name} and {more} have birthday today'
|
||||||
|
values={{
|
||||||
|
name: link,
|
||||||
|
more: (
|
||||||
|
<span type='button' role='presentation' onClick={this.handleOpenBirthdaysModal}>
|
||||||
|
<FormattedMessage
|
||||||
|
id='notification.birthday.more'
|
||||||
|
defaultMessage='{count} more {count, plural, one {friend} other {friends}}'
|
||||||
|
values={{ count: birthdays.size - 1 }}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { birthdays } = this.props;
|
||||||
|
|
||||||
|
if (!birthdays || birthdays.size === 0) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='notification notification-birthday focusable'>
|
||||||
|
<div className='notification__message'>
|
||||||
|
<div className='notification__icon-wrapper'>
|
||||||
|
<Icon src={require('@tabler/icons/icons/ballon.svg')} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span>
|
||||||
|
{this.renderMessage()}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -24,6 +24,7 @@ class ColumnSettings extends React.PureComponent {
|
||||||
onClear: PropTypes.func.isRequired,
|
onClear: PropTypes.func.isRequired,
|
||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
supportsEmojiReacts: PropTypes.bool,
|
supportsEmojiReacts: PropTypes.bool,
|
||||||
|
supportsBirthDates: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
onPushChange = (path, checked) => {
|
onPushChange = (path, checked) => {
|
||||||
|
@ -39,7 +40,7 @@ class ColumnSettings extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { intl, settings, pushSettings, onChange, onClear, onClose, supportsEmojiReacts } = this.props;
|
const { intl, settings, pushSettings, onChange, onClear, onClose, supportsEmojiReacts, supportsBirthDates } = this.props;
|
||||||
|
|
||||||
const filterShowStr = <FormattedMessage id='notifications.column_settings.filter_bar.show' defaultMessage='Show' />;
|
const filterShowStr = <FormattedMessage id='notifications.column_settings.filter_bar.show' defaultMessage='Show' />;
|
||||||
const filterAdvancedStr = <FormattedMessage id='notifications.column_settings.filter_bar.advanced' defaultMessage='Display all categories' />;
|
const filterAdvancedStr = <FormattedMessage id='notifications.column_settings.filter_bar.advanced' defaultMessage='Display all categories' />;
|
||||||
|
@ -50,6 +51,7 @@ class ColumnSettings extends React.PureComponent {
|
||||||
const soundSettings = [['sounds', 'follow'], ['sounds', 'favourite'], ['sounds', 'pleroma:emoji_reaction'], ['sounds', 'mention'], ['sounds', 'reblog'], ['sounds', 'poll'], ['sounds', 'move']];
|
const soundSettings = [['sounds', 'follow'], ['sounds', 'favourite'], ['sounds', 'pleroma:emoji_reaction'], ['sounds', 'mention'], ['sounds', 'reblog'], ['sounds', 'poll'], ['sounds', 'move']];
|
||||||
const showPushSettings = pushSettings.get('browserSupport') && pushSettings.get('isSubscribed');
|
const showPushSettings = pushSettings.get('browserSupport') && pushSettings.get('isSubscribed');
|
||||||
const pushStr = showPushSettings && <FormattedMessage id='notifications.column_settings.push' defaultMessage='Push notifications' />;
|
const pushStr = showPushSettings && <FormattedMessage id='notifications.column_settings.push' defaultMessage='Push notifications' />;
|
||||||
|
const birthdaysStr = <FormattedMessage id='notifications.column_settings.birthdays.show' defaultMessage='Show birthday reminders' />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='column-settings'>
|
<div className='column-settings'>
|
||||||
|
@ -84,6 +86,17 @@ class ColumnSettings extends React.PureComponent {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{supportsBirthDates &&
|
||||||
|
<div role='group' aria-labelledby='notifications-filter-bar'>
|
||||||
|
<span id='notifications-filter-bar' className='column-settings__section'>
|
||||||
|
<FormattedMessage id='notifications.column_settings.birthdays.category' defaultMessage='Birthdays' />
|
||||||
|
</span>
|
||||||
|
<div className='column-settings__row'>
|
||||||
|
<SettingToggle id='show-filter-bar' prefix='notifications' settings={settings} settingPath={['birthdays', 'show']} onChange={onChange} label={birthdaysStr} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<div role='group' aria-labelledby='notifications-follow'>
|
<div role='group' aria-labelledby='notifications-follow'>
|
||||||
<span id='notifications-follow' className='column-settings__section'><FormattedMessage id='notifications.column_settings.follow' defaultMessage='New followers:' /></span>
|
<span id='notifications-follow' className='column-settings__section'><FormattedMessage id='notifications.column_settings.follow' defaultMessage='New followers:' /></span>
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ const mapStateToProps = state => {
|
||||||
settings: getSettings(state).get('notifications'),
|
settings: getSettings(state).get('notifications'),
|
||||||
pushSettings: state.get('push_notifications'),
|
pushSettings: state.get('push_notifications'),
|
||||||
supportsEmojiReacts: features.emojiReacts,
|
supportsEmojiReacts: features.emojiReacts,
|
||||||
|
supportsBirthDates: features.birthDates,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,10 @@ import { connect } from 'react-redux';
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
|
|
||||||
import { getSettings } from 'soapbox/actions/settings';
|
import { getSettings } from 'soapbox/actions/settings';
|
||||||
|
import BirthdayReminders from 'soapbox/components/birthday_reminders';
|
||||||
import SubNavigation from 'soapbox/components/sub_navigation';
|
import SubNavigation from 'soapbox/components/sub_navigation';
|
||||||
import PlaceholderNotification from 'soapbox/features/placeholder/components/placeholder_notification';
|
import PlaceholderNotification from 'soapbox/features/placeholder/components/placeholder_notification';
|
||||||
|
import { getFeatures } from 'soapbox/utils/features';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
expandNotifications,
|
expandNotifications,
|
||||||
|
@ -45,14 +47,21 @@ const getNotifications = createSelector([
|
||||||
return notifications.filter(item => item !== null && allowedType === item.get('type'));
|
return notifications.filter(item => item !== null && allowedType === item.get('type'));
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => {
|
||||||
showFilterBar: getSettings(state).getIn(['notifications', 'quickFilter', 'show']),
|
const settings = getSettings(state);
|
||||||
|
const instance = state.get('instance');
|
||||||
|
const features = getFeatures(instance);
|
||||||
|
|
||||||
|
return {
|
||||||
|
showFilterBar: settings.getIn(['notifications', 'quickFilter', 'show']),
|
||||||
notifications: getNotifications(state),
|
notifications: getNotifications(state),
|
||||||
isLoading: state.getIn(['notifications', 'isLoading'], true),
|
isLoading: state.getIn(['notifications', 'isLoading'], true),
|
||||||
isUnread: state.getIn(['notifications', 'unread']) > 0,
|
isUnread: state.getIn(['notifications', 'unread']) > 0,
|
||||||
hasMore: state.getIn(['notifications', 'hasMore']),
|
hasMore: state.getIn(['notifications', 'hasMore']),
|
||||||
totalQueuedNotificationsCount: state.getIn(['notifications', 'totalQueuedNotificationsCount'], 0),
|
totalQueuedNotificationsCount: state.getIn(['notifications', 'totalQueuedNotificationsCount'], 0),
|
||||||
});
|
showBirthdayReminders: settings.getIn(['notifications', 'birthdays', 'show']) && settings.getIn(['notifications', 'quickFilter', 'active']) === 'all' && features.birthDates,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export default @connect(mapStateToProps)
|
export default @connect(mapStateToProps)
|
||||||
@injectIntl
|
@injectIntl
|
||||||
|
@ -68,6 +77,7 @@ class Notifications extends React.PureComponent {
|
||||||
hasMore: PropTypes.bool,
|
hasMore: PropTypes.bool,
|
||||||
dequeueNotifications: PropTypes.func,
|
dequeueNotifications: PropTypes.func,
|
||||||
totalQueuedNotificationsCount: PropTypes.number,
|
totalQueuedNotificationsCount: PropTypes.number,
|
||||||
|
showBirthdayReminders: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
@ -137,7 +147,7 @@ class Notifications extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { intl, notifications, isLoading, hasMore, showFilterBar, totalQueuedNotificationsCount } = this.props;
|
const { intl, notifications, isLoading, hasMore, showFilterBar, totalQueuedNotificationsCount, showBirthdayReminders } = this.props;
|
||||||
const emptyMessage = <FormattedMessage id='empty_column.notifications' defaultMessage="You don't have any notifications yet. Interact with others to start the conversation." />;
|
const emptyMessage = <FormattedMessage id='empty_column.notifications' defaultMessage="You don't have any notifications yet. Interact with others to start the conversation." />;
|
||||||
|
|
||||||
let scrollableContent = null;
|
let scrollableContent = null;
|
||||||
|
@ -164,6 +174,8 @@ class Notifications extends React.PureComponent {
|
||||||
onMoveDown={this.handleMoveDown}
|
onMoveDown={this.handleMoveDown}
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
|
||||||
|
if (showBirthdayReminders) scrollableContent = scrollableContent.unshift(<BirthdayReminders key='birthdays' />);
|
||||||
} else {
|
} else {
|
||||||
scrollableContent = null;
|
scrollableContent = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import React from 'react';
|
||||||
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
import { injectIntl, FormattedMessage, defineMessages } from 'react-intl';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
|
import IconButton from 'soapbox/components/icon_button';
|
||||||
|
import LoadingIndicator from 'soapbox/components/loading_indicator';
|
||||||
|
import ScrollableList from 'soapbox/components/scrollable_list';
|
||||||
|
import AccountContainer from 'soapbox/containers/account_container';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
close: { id: 'lightbox.close', defaultMessage: 'Close' },
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapStateToProps = (state) => {
|
||||||
|
const me = state.get('me');
|
||||||
|
|
||||||
|
return {
|
||||||
|
accountIds: state.getIn(['user_lists', 'birthday_reminders', me]),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default @connect(mapStateToProps)
|
||||||
|
@injectIntl
|
||||||
|
class BirthdaysModal extends React.PureComponent {
|
||||||
|
|
||||||
|
static contextTypes = {
|
||||||
|
router: PropTypes.object,
|
||||||
|
};
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
intl: PropTypes.object.isRequired,
|
||||||
|
accountIds: ImmutablePropTypes.orderedSet,
|
||||||
|
};
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.unlistenHistory = this.context.router.history.listen((_, action) => {
|
||||||
|
if (action === 'PUSH') {
|
||||||
|
this.onClickClose(null, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
if (this.unlistenHistory) {
|
||||||
|
this.unlistenHistory();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onClickClose = (_, noPop) => {
|
||||||
|
this.props.onClose('BIRTHDAYS', noPop);
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { intl, accountIds } = this.props;
|
||||||
|
|
||||||
|
let body;
|
||||||
|
|
||||||
|
if (!accountIds) {
|
||||||
|
body = <LoadingIndicator />;
|
||||||
|
} else {
|
||||||
|
const emptyMessage = <FormattedMessage id='status.reblogs.empty' defaultMessage='No one has reposted this post yet. When someone does, they will show up here.' />;
|
||||||
|
|
||||||
|
body = (
|
||||||
|
<ScrollableList
|
||||||
|
scrollKey='reblogs'
|
||||||
|
emptyMessage={emptyMessage}
|
||||||
|
>
|
||||||
|
{accountIds.map(id =>
|
||||||
|
<AccountContainer key={id} id={id} withNote={false} />,
|
||||||
|
)}
|
||||||
|
</ScrollableList>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='modal-root__modal reactions-modal'>
|
||||||
|
<div className='compose-modal__header'>
|
||||||
|
<h3 className='compose-modal__header__title'>
|
||||||
|
<FormattedMessage id='column.birthdays' defaultMessage='Birthdays' />
|
||||||
|
</h3>
|
||||||
|
<IconButton
|
||||||
|
className='compose-modal__close'
|
||||||
|
title={intl.formatMessage(messages.close)}
|
||||||
|
src={require('@tabler/icons/icons/x.svg')}
|
||||||
|
onClick={this.onClickClose} size={20}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{body}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -26,6 +26,7 @@ import {
|
||||||
FavouritesModal,
|
FavouritesModal,
|
||||||
ReblogsModal,
|
ReblogsModal,
|
||||||
MentionsModal,
|
MentionsModal,
|
||||||
|
BirthdaysModal,
|
||||||
} from '../../../features/ui/util/async-components';
|
} from '../../../features/ui/util/async-components';
|
||||||
import BundleContainer from '../containers/bundle_container';
|
import BundleContainer from '../containers/bundle_container';
|
||||||
|
|
||||||
|
@ -57,6 +58,7 @@ const MODAL_COMPONENTS = {
|
||||||
'FAVOURITES': FavouritesModal,
|
'FAVOURITES': FavouritesModal,
|
||||||
'REACTIONS': ReactionsModal,
|
'REACTIONS': ReactionsModal,
|
||||||
'MENTIONS': MentionsModal,
|
'MENTIONS': MentionsModal,
|
||||||
|
'BIRTHDAYS': BirthdaysModal,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class ModalRoot extends React.PureComponent {
|
export default class ModalRoot extends React.PureComponent {
|
||||||
|
|
|
@ -214,6 +214,10 @@ export function MentionsModal() {
|
||||||
return import(/* webpackChunkName: "features/ui" */'../components/mentions_modal');
|
return import(/* webpackChunkName: "features/ui" */'../components/mentions_modal');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function BirthdaysModal() {
|
||||||
|
return import(/* webpackChunkName: "features/ui" */'../components/birthdays_modal');
|
||||||
|
}
|
||||||
|
|
||||||
export function ListEditor() {
|
export function ListEditor() {
|
||||||
return import(/* webpackChunkName: "features/list_editor" */'../../list_editor');
|
return import(/* webpackChunkName: "features/list_editor" */'../../list_editor');
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {
|
||||||
FOLLOW_REQUEST_AUTHORIZE_SUCCESS,
|
FOLLOW_REQUEST_AUTHORIZE_SUCCESS,
|
||||||
FOLLOW_REQUEST_REJECT_SUCCESS,
|
FOLLOW_REQUEST_REJECT_SUCCESS,
|
||||||
PINNED_ACCOUNTS_FETCH_SUCCESS,
|
PINNED_ACCOUNTS_FETCH_SUCCESS,
|
||||||
|
BIRTHDAY_REMINDERS_FETCH_SUCCESS,
|
||||||
} from '../actions/accounts';
|
} from '../actions/accounts';
|
||||||
import {
|
import {
|
||||||
BLOCKS_FETCH_SUCCESS,
|
BLOCKS_FETCH_SUCCESS,
|
||||||
|
@ -55,6 +56,7 @@ const initialState = ImmutableMap({
|
||||||
groups: ImmutableMap(),
|
groups: ImmutableMap(),
|
||||||
groups_removed_accounts: ImmutableMap(),
|
groups_removed_accounts: ImmutableMap(),
|
||||||
pinned: ImmutableMap(),
|
pinned: ImmutableMap(),
|
||||||
|
birthday_reminders: ImmutableMap(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const normalizeList = (state, type, id, accounts, next) => {
|
const normalizeList = (state, type, id, accounts, next) => {
|
||||||
|
@ -131,6 +133,8 @@ export default function userLists(state = initialState, action) {
|
||||||
return state.updateIn(['groups_removed_accounts', action.groupId, 'items'], list => list.filterNot(item => item === action.id));
|
return state.updateIn(['groups_removed_accounts', action.groupId, 'items'], list => list.filterNot(item => item === action.id));
|
||||||
case PINNED_ACCOUNTS_FETCH_SUCCESS:
|
case PINNED_ACCOUNTS_FETCH_SUCCESS:
|
||||||
return normalizeList(state, 'pinned', action.id, action.accounts, action.next);
|
return normalizeList(state, 'pinned', action.id, action.accounts, action.next);
|
||||||
|
case BIRTHDAY_REMINDERS_FETCH_SUCCESS:
|
||||||
|
return state.setIn(['birthday_reminders', action.id], ImmutableOrderedSet(action.accounts.map(item => item.id)));
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,3 +89,18 @@
|
||||||
padding-bottom: 8px !important;
|
padding-bottom: 8px !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.notification-birthday span[type="button"] {
|
||||||
|
&:focus,
|
||||||
|
&:hover,
|
||||||
|
&:active {
|
||||||
|
text-decoration: underline;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.columns-area .notification-birthday {
|
||||||
|
.notification__message {
|
||||||
|
padding-top: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -391,6 +391,9 @@ If it's not documented, it's because I inherited it from Mastodon and I don't kn
|
||||||
mention: true,
|
mention: true,
|
||||||
poll: true,
|
poll: true,
|
||||||
reblog: true
|
reblog: true
|
||||||
|
},
|
||||||
|
birthdays: {
|
||||||
|
show: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
theme: 'azure',
|
theme: 'azure',
|
||||||
|
|
Loading…
Reference in New Issue