Browse Source

Refine unescapeHTML (#2977)

master
Yamagishi Kazutoshi 7 years ago
committed by Eugen Rochko
parent
commit
7ff84cb07e
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      app/javascript/mastodon/actions/notifications.js

+ 5
- 2
app/javascript/mastodon/actions/notifications.js View File

@ -1,7 +1,6 @@
import api, { getLinks } from '../api' import api, { getLinks } from '../api'
import Immutable from 'immutable'; import Immutable from 'immutable';
import IntlMessageFormat from 'intl-messageformat'; import IntlMessageFormat from 'intl-messageformat';
import { unescape } from 'lodash';
import { fetchRelationships } from './accounts'; import { fetchRelationships } from './accounts';
export const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE'; export const NOTIFICATIONS_UPDATE = 'NOTIFICATIONS_UPDATE';
@ -25,7 +24,11 @@ const fetchRelatedRelationships = (dispatch, notifications) => {
} }
}; };
const unescapeHTML = (html) => unescape(html).replace(/<\/?\w+(?:\s[^>]*)?>/g, '');
const unescapeHTML = (html) => {
const wrapper = document.createElement('div');
wrapper.innerHTML = html;
return wrapper.textContent;
}
export function updateNotifications(notification, intlMessages, intlLocale) { export function updateNotifications(notification, intlMessages, intlLocale) {
return (dispatch, getState) => { return (dispatch, getState) => {

Loading…
Cancel
Save