2021-04-17 20:07:23 +05:30
|
|
|
import * as Sentry from '@sentry/browser';
|
2021-01-03 14:25:43 +05:30
|
|
|
import { sanitize } from '~/lib/dompurify';
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
// We currently load + parse the data from the issue app and related merge request
|
|
|
|
let cachedParsedData;
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
export const parseIssuableData = (el) => {
|
2019-07-07 11:18:12 +05:30
|
|
|
try {
|
2020-11-24 15:15:51 +05:30
|
|
|
if (cachedParsedData) return cachedParsedData;
|
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
const parsedData = JSON.parse(el.dataset.initial);
|
2020-11-24 15:15:51 +05:30
|
|
|
parsedData.initialTitleHtml = sanitize(parsedData.initialTitleHtml);
|
|
|
|
parsedData.initialDescriptionHtml = sanitize(parsedData.initialDescriptionHtml);
|
|
|
|
|
|
|
|
cachedParsedData = parsedData;
|
|
|
|
|
|
|
|
return parsedData;
|
2019-07-07 11:18:12 +05:30
|
|
|
} catch (e) {
|
2021-01-03 14:25:43 +05:30
|
|
|
Sentry.captureException(e);
|
2019-07-07 11:18:12 +05:30
|
|
|
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
};
|