summaryrefslogtreecommitdiff
path: root/activitypub/outbox/outbox.go
diff options
context:
space:
mode:
Diffstat (limited to 'activitypub/outbox/outbox.go')
-rw-r--r--activitypub/outbox/outbox.go26
1 files changed, 12 insertions, 14 deletions
diff --git a/activitypub/outbox/outbox.go b/activitypub/outbox/outbox.go
index 53369a7af..cf9c2da46 100644
--- a/activitypub/outbox/outbox.go
+++ b/activitypub/outbox/outbox.go
@@ -112,20 +112,18 @@ func SendPublicMessage(textContent string) error {
tagProp := streams.NewActivityStreamsTagProperty()
- // Iterate through the post text and find #Hashtags.
- words := strings.Split(originalContent, " ")
- for _, word := range words {
- if strings.HasPrefix(word, "#") {
- tagWithoutHashtag := strings.TrimPrefix(word, "#")
-
- // Replace the instances of the tag with a link to the tag page.
- tagHTML := getHashtagLinkHTMLFromTagString(tagWithoutHashtag)
- textContent = strings.ReplaceAll(textContent, word, tagHTML)
-
- // Create Hashtag object for the tag.
- hashtag := apmodels.MakeHashtag(tagWithoutHashtag)
- tagProp.AppendTootHashtag(hashtag)
- }
+ hashtagStrings := utils.GetHashtagsFromText(originalContent)
+
+ for _, hashtag := range hashtagStrings {
+ tagWithoutHashtag := strings.TrimPrefix(hashtag, "#")
+
+ // Replace the instances of the tag with a link to the tag page.
+ tagHTML := getHashtagLinkHTMLFromTagString(tagWithoutHashtag)
+ textContent = strings.ReplaceAll(textContent, hashtag, tagHTML)
+
+ // Create Hashtag object for the tag.
+ hashtag := apmodels.MakeHashtag(tagWithoutHashtag)
+ tagProp.AppendTootHashtag(hashtag)
}
activity, _, note, noteID := createBaseOutboundMessage(textContent)