From d3f9e72801d9c394f17a526f149aa767ac59b46a Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 27 Oct 2019 12:41:33 +0100 Subject: [PATCH] Fix reply content with mentions --- blueprints/admin.py | 10 ++++++++++ blueprints/api.py | 4 ++-- templates/layout.html | 3 +-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/blueprints/admin.py b/blueprints/admin.py index 223da82..34fe0a0 100644 --- a/blueprints/admin.py +++ b/blueprints/admin.py @@ -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( diff --git a/blueprints/api.py b/blueprints/api.py index 0db0431..c001737 100644 --- a/blueprints/api.py +++ b/blueprints/api.py @@ -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, diff --git a/templates/layout.html b/templates/layout.html index 6216424..7f386c6 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -40,8 +40,7 @@ dt, dd { font-size: 0.9em; } {% if unread_notifications_count %} ({{unread_notifications_count}}) {% endif %} - +
  • DMs
  • Lists
  • Bookmarks
  • Lookup