Possibility on marking tags as 'not safe for work'?
Solved
General Discussion
-
Hey, is there an option that when turned on shows a popup confirming that the tag is nsfw? I tried looking around and found a plugin but it's really old and it's only for categories.
thanks.
-
H hellowmellow marked this topic as a question on
-
You can do this with some custom JS in the ACP using the existing hooks in NodeBB.
When a tag is added in the composer we fire a hook called
action:tag.added
.$(window).trigger('action:tag.added', { cid: cid, tagEl: tagEl, tag: event.item });
Using this you can check the added tag against a list of nsfw tags and display a bootbox modal. If the user doesn't confirm you can remove it. See below for a sample implementation.(async function () { const nsfwTags = ['tag1', 'tag2', 'tag3']; const bootbox = await app.require('bootbox'); $(window).on('action:tag.added', function(ev, data) { if (nsfwTags.includes(data.tag)) { bootbox.confirm(`"${data.tag}" is a nsfw tag do you really want to add it?`, (ok) => { if (!ok) { data.tagEl.tagsinput('remove', data.tag); } }); } }); })();
This results in the below modal in the composer.
-
thanks will check this out. Appreciated.
-
H hellowmellow has marked this topic as solved on
Copyright © 2024 NodeBB | Contributors