logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe
commit: 8e5d17a659b157f095ad3850ac3cdd2e537ac38b
parent: 7d93546d980aea499257b6b0b6dd6af6c60c26d0
Author: Roger Braun <roger@rogerbraun.net>
Date:   Sun, 18 Jun 2017 19:19:17 +0200

Use tags array in status if available.

Diffstat:

Msrc/modules/statuses.js10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/modules/statuses.js b/src/modules/statuses.js @@ -1,4 +1,4 @@ -import { remove, slice, sortBy, toInteger, each, find, flatten, maxBy, last, merge, max, isArray } from 'lodash' +import { includes, remove, slice, sortBy, toInteger, each, find, flatten, maxBy, last, merge, max, isArray } from 'lodash' import apiService from '../services/api/api.service.js' // import parse from '../services/status_parser/status_parser.js' @@ -68,11 +68,15 @@ export const defaultState = { } } +const isNsfw = (status) => { + const nsfwRegex = /#nsfw/i + return includes(status.tags, 'nsfw') || !!status.text.match(nsfwRegex) +} + export const prepareStatus = (status) => { // Parse nsfw tags if (status.nsfw === undefined) { - const nsfwRegex = /#nsfw/i - status.nsfw = !!status.text.match(nsfwRegex) + status.nsfw = isNsfw(status) } // Set deleted flag