From 59647798b97615d43710dde8f6c52894f39b8c4a Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Sun, 13 Nov 2016 22:40:33 +0100 Subject: prepareStatus: nsfw tag parsing. --- src/modules/statuses.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 6fe2558c..5e3a373a 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -114,6 +114,15 @@ export const findMaxId = (...args) => { return (maxBy(flatten(args), 'id') || {}).id } +export const prepareStatus = (status) => { + if (status.nsfw === undefined) { + const nsfwRegex = /#nsfw/i + status.nsfw = !!status.text.match(nsfwRegex) + } + + return status +} + export const mutations = { addNewStatuses (state, { statuses, showImmediately = false, timeline }) { const timelineObject = state.timelines[timeline] -- cgit v1.2.3-70-g09d2