plugins: warn the user that content may not be safe for work

This commit is contained in:
David Cormier 2013-10-13 14:49:38 -04:00
parent a1123ddad0
commit 3f56c80f56
2 changed files with 5 additions and 3 deletions

View file

@ -129,7 +129,7 @@ $ openssl req -nodes -newkey rsa:2048 -keyout relay.pem -x509 -days 365 -out rel
</div> </div>
<div ng-hide="metadata.visible"> <div ng-hide="metadata.visible">
<a ng-click="metadata.visible = true">Show additional content</a> <a ng-click="metadata.visible = true">Show additional content</a> <span ng-show="metadata.nsfw">(possibly nsfw)</span>
</div> </div>
</div> </div>
</td> </td>

View file

@ -57,16 +57,18 @@ plugins.service('plugins', ['userPlugins', '$sce', function(userPlugins, $sce)
var content = []; var content = [];
for (var i = 0; i < plugins.length; i++) { for (var i = 0; i < plugins.length; i++) {
var nsfw = false;
var visible = true; var visible = true;
if (message.match(nsfwRegexp)) { if (message.match(nsfwRegexp)) {
var nsfw = true;
var visible = false; var visible = false;
} }
var pluginContent = plugins[i].contentForMessage(message); var pluginContent = plugins[i].contentForMessage(message);
if (pluginContent) { if (pluginContent) {
var pluginContent = {'visible': visible, var pluginContent = {'visible': visible,
'content': $sce.trustAsHtml(pluginContent) } 'content': $sce.trustAsHtml(pluginContent),
'nsfw': nsfw }
content.push(pluginContent); content.push(pluginContent);