Add a way to hide sensitive content once it's displayed

This commit is contained in:
Thomas Sileo 2019-08-16 12:04:23 +02:00
parent a9fa483bcc
commit 558fb9c310
2 changed files with 16 additions and 0 deletions

View file

@ -29,9 +29,11 @@ from config import ID
from config import KEY
from config import ME
from config import USER_AGENT
from core.db import find_one_activity
from core.db import update_many_activities
from core.meta import Box
from core.meta import MetaKey
from core.meta import by_object_id
from core.meta import flag
from core.meta import upsert
from core.tasks import Tasks
@ -160,6 +162,7 @@ def post_to_inbox(activity: ap.BaseActivity) -> None:
actor.has_type(ap.ActivityType.APPLICATION)
and actor.id.endswith("/relay")
and activity.has_type(ap.ActivityType.ANNOUNCE)
and not find_one_activity(by_object_id(activity.get_object_id()))
and not DB.replies.find_one({"remote_id": activity.id})
):
Tasks.process_reply(activity.get_object_id())

View file

@ -156,12 +156,25 @@
<div style="clear:both">
<form action="{{redir}}" class="action-form" method="GET" style="display:inline-block">
<input type="hidden" name="show_sensitive" value="{{perma_id}}">
{% if request.path == url_for("admin.admin_lookup") %}
<input type="hidden" name="url" value="{{obj.id}}">
{% endif %}
<button type="submit" class="bar-item-reverse">display sensitive content</button>
</form>
</div>
{% else %}
{% if obj.sensitive %}
<div style="clear:both;margin-bottom: 20px;">
<form action="{{redir}}" class="action-form" method="GET" style="display:inline-block">
{% if request.path == url_for("admin.admin_lookup") %}
<input type="hidden" name="url" value="{{obj.id}}">
{% endif %}
<button type="submit" class="bar-item-reverse">hide sensitive content</button>
</form>
</div>
{% endif %}
{% if obj.attachment | not_only_imgs %}
<h3 class="l">Attachments</h3>
<ul style="padding:0;">