Fix reply content with mentions

This commit is contained in:
Thomas Sileo 2019-10-27 12:41:33 +01:00
parent ba1bfe4943
commit d3f9e72801
3 changed files with 13 additions and 4 deletions

View file

@ -345,6 +345,16 @@ def admin_new() -> _Response:
domain = urlparse(actor.id).netloc
# FIXME(tsileo): if reply of reply, fetch all participants
content = f"@{actor.preferredUsername}@{domain} "
if reply.has_type(ap.ActivityType.CREATE):
reply = reply.get_object()
for mention in reply.get_mentions():
if mention.href in [actor.id, ID]:
continue
m = ap.fetch_remote_activity(mention.href)
if m.has_type(ap.ACTOR_TYPES):
d = urlparse(m.id).netloc
content += f"@{m.preferredUsername}@{d} "
thread = _build_thread(data)
return htmlify(

View file

@ -531,8 +531,8 @@ def api_new_note() -> _Response:
raw_note = dict(
attributedTo=MY_PERSON.id,
cc=list(set(cc)),
to=list(set(to)),
cc=list(set(cc) - set([MY_PERSON.id])),
to=list(set(to) - set([MY_PERSON.id])),
summary=summary,
content=content,
tag=tags,

View file

@ -40,8 +40,7 @@ dt, dd { font-size: 0.9em; }
{% if unread_notifications_count %}
({{unread_notifications_count}})
{% endif %}</a></li>
<!-- <li class="left"><a href="/admin/direct_messages"{% if request.path == url_for('admin.admin_direct_messages') %} class="selected" {% endif %}>DMs</a></li>
-->
<li class="left"><a href="/admin/direct_messages"{% if request.path == url_for('admin.admin_direct_messages') %} class="selected" {% endif %}>DMs</a></li>
<li class="left"><a href="/admin/lists"{% if request.path == url_for('admin.admin_lists') %} class="selected" {% endif %}>Lists</a></li>
<li class="left"><a href="/admin/bookmarks"{% if request.path == "/admin/bookmarks" %} class="selected" {% endif %}>Bookmarks</a></li>
<li class="left"><a href="/admin/lookup"{% if request.path == "/admin/lookup" %} class="selected" {% endif %}>Lookup</a></li>