prepareStatus: nsfw tag parsing.

This commit is contained in:
Roger Braun 2016-11-13 22:40:33 +01:00
parent 5888697c0d
commit 59647798b9
2 changed files with 28 additions and 2 deletions

View file

@ -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]