summaryrefslogtreecommitdiffstats
path: root/activities
diff options
context:
space:
mode:
Diffstat (limited to 'activities')
-rw-r--r--activities/models/post.py3
-rw-r--r--activities/views/compose.py7
2 files changed, 8 insertions, 2 deletions
diff --git a/activities/models/post.py b/activities/models/post.py
index d3365e7..aa4be16 100644
--- a/activities/models/post.py
+++ b/activities/models/post.py
@@ -276,7 +276,7 @@ class Post(StatorModel):
def replacer(match):
precursor = match.group(1)
- handle = match.group(2)
+ handle = match.group(2).lower()
if handle in possible_matches:
return f'{precursor}<a href="{possible_matches[handle]}">@{handle}</a>'
else:
@@ -383,6 +383,7 @@ class Post(StatorModel):
mention_hits = cls.mention_regex.findall(content)
mentions = set()
for precursor, handle in mention_hits:
+ handle = handle.lower()
if "@" in handle:
username, domain = handle.split("@", 1)
else:
diff --git a/activities/views/compose.py b/activities/views/compose.py
index 313fe74..b4ddcf5 100644
--- a/activities/views/compose.py
+++ b/activities/views/compose.py
@@ -84,7 +84,12 @@ class Compose(FormView):
initial["visibility"] = Post.Visibilities.unlisted
else:
initial["visibility"] = self.reply_to.visibility
- initial["text"] = f"@{self.reply_to.author.handle} "
+ # Build a set of mentions for the content to start as
+ mentioned = {self.reply_to.author}
+ mentioned.update(self.reply_to.mentions.all())
+ initial["text"] = "".join(
+ f"@{identity.handle} " for identity in mentioned
+ )
return initial
def form_valid(self, form):