Desktop notifications
This commit is contained in:
parent
e616ffc5d6
commit
fb48cc3b74
3 changed files with 15 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
|||
import api, { getLinks } from '../api'
|
||||
import Immutable from 'immutable';
|
||||
import IntlMessageFormat from 'intl-messageformat';
|
||||
|
||||
import { fetchRelationships } from './accounts';
|
||||
|
||||
|
@ -21,7 +22,7 @@ const fetchRelatedRelationships = (dispatch, notifications) => {
|
|||
}
|
||||
};
|
||||
|
||||
export function updateNotifications(notification) {
|
||||
export function updateNotifications(notification, intlMessages, intlLocale) {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: NOTIFICATIONS_UPDATE,
|
||||
|
@ -31,6 +32,12 @@ export function updateNotifications(notification) {
|
|||
});
|
||||
|
||||
fetchRelatedRelationships(dispatch, [notification]);
|
||||
|
||||
// Desktop notifications
|
||||
const title = new IntlMessageFormat(intlMessages[`notification.${notification.type}`], intlLocale).format({ name: notification.account.display_name.length > 0 ? notification.account.display_name : notification.account.username });
|
||||
const body = $('<p>').html(notification.status ? notification.status.content : '').text();
|
||||
|
||||
new Notification(title, { body });
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue