[Glitch] Add support for poll ending notifications

Port front-end parts of 3a92885a86 to glitch-soc
master
Thibaut Girka 6 years ago
parent 7d026aa079
commit 9c620fc5c8
  1. 2
      app/javascript/flavours/glitch/actions/notifications.js
  2. 9
      app/javascript/flavours/glitch/components/status_prepend.js
  3. 21
      app/javascript/flavours/glitch/features/notifications/components/notification.js
  4. 3
      app/javascript/flavours/glitch/reducers/settings.js

@ -106,7 +106,7 @@ const excludeTypesFromSettings = state => state.getIn(['settings', 'notification
const excludeTypesFromFilter = filter => { const excludeTypesFromFilter = filter => {
const allTypes = ImmutableList(['follow', 'favourite', 'reblog', 'mention']); const allTypes = ImmutableList(['follow', 'favourite', 'reblog', 'mention', 'poll']);
return allTypes.filterNot(item => item === filter).toJS(); return allTypes.filterNot(item => item === filter).toJS();
}; };

@ -62,6 +62,13 @@ export default class StatusPrepend extends React.PureComponent {
values={{ name : link }} values={{ name : link }}
/> />
); );
case 'poll':
return (
<FormattedMessage
id='notification.poll'
defaultMessage='Your poll has ended'
/>
);
} }
return null; return null;
} }
@ -75,7 +82,7 @@ export default class StatusPrepend extends React.PureComponent {
<div className={type === 'reblogged_by' || type === 'featured' ? 'status__prepend-icon-wrapper' : 'notification__favourite-icon-wrapper'}> <div className={type === 'reblogged_by' || type === 'featured' ? 'status__prepend-icon-wrapper' : 'notification__favourite-icon-wrapper'}>
<i <i
className={`fa fa-fw fa-${ className={`fa fa-fw fa-${
type === 'favourite' ? 'star star-icon' : (type === 'featured' ? 'thumb-tack' : 'retweet') type === 'favourite' ? 'star star-icon' : (type === 'featured' ? 'thumb-tack' : (type === 'poll' ? 'tasks' : 'retweet'))
} status__prepend-icon`} } status__prepend-icon`}
/> />
</div> </div>

@ -108,6 +108,27 @@ export default class Notification extends ImmutablePureComponent {
withDismiss withDismiss
/> />
); );
case 'poll':
return (
<StatusContainer
containerId={notification.get('id')}
hidden={hidden}
id={notification.get('status')}
account={notification.get('account')}
prepend='poll'
muted
notification={notification}
onMoveDown={onMoveDown}
onMoveUp={onMoveUp}
onMention={onMention}
getScrollPosition={getScrollPosition}
updateScrollBottom={updateScrollBottom}
cachedMediaWidth={this.props.cachedMediaWidth}
cacheMediaWidth={this.props.cacheMediaWidth}
onUnmount={this.props.onUnmount}
withDismiss
/>
);
default: default:
return null; return null;
} }

@ -33,6 +33,7 @@ const initialState = ImmutableMap({
favourite: true, favourite: true,
reblog: true, reblog: true,
mention: true, mention: true,
poll: true,
}), }),
quickFilter: ImmutableMap({ quickFilter: ImmutableMap({
@ -46,6 +47,7 @@ const initialState = ImmutableMap({
favourite: true, favourite: true,
reblog: true, reblog: true,
mention: true, mention: true,
poll: true,
}), }),
sounds: ImmutableMap({ sounds: ImmutableMap({
@ -53,6 +55,7 @@ const initialState = ImmutableMap({
favourite: true, favourite: true,
reblog: true, reblog: true,
mention: true, mention: true,
poll: true,
}), }),
}), }),

Loading…
Cancel
Save