diff options
author | 2021-09-11 13:19:06 +0200 | |
---|---|---|
committer | 2021-09-11 13:19:06 +0200 | |
commit | 9dc2255a8fab8ef0bc4b9f417c6131e4c468cb9c (patch) | |
tree | ae528bf14a3475bbea264ff26e5ffded3dfadf8a /internal/util/statustools.go | |
parent | Test both dbs (#205) (diff) | |
download | gotosocial-9dc2255a8fab8ef0bc4b9f417c6131e4c468cb9c.tar.xz |
kim is a reply guy (#208)
* bun debug
* bun trace logging hooks
* more tests
* fix up some stuffffff
* drop the frontend cache until a proper fix is made
* go fmt
Diffstat (limited to 'internal/util/statustools.go')
-rw-r--r-- | internal/util/statustools.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/internal/util/statustools.go b/internal/util/statustools.go index ca18577b0..95ce63a5b 100644 --- a/internal/util/statustools.go +++ b/internal/util/statustools.go @@ -25,38 +25,38 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/regexes" ) -// DeriveMentionsFromStatus takes a plaintext (ie., not html-formatted) status, +// DeriveMentionsFromText takes a plaintext (ie., not html-formatted) text, // and applies a regex to it to return a deduplicated list of accounts -// mentioned in that status. +// mentioned in that text. // // It will look for fully-qualified account names in the form "@user@example.org". // or the form "@username" for local users. -func DeriveMentionsFromStatus(status string) []string { +func DeriveMentionsFromText(text string) []string { mentionedAccounts := []string{} - for _, m := range regexes.MentionFinder.FindAllStringSubmatch(status, -1) { + for _, m := range regexes.MentionFinder.FindAllStringSubmatch(text, -1) { mentionedAccounts = append(mentionedAccounts, m[1]) } return UniqueStrings(mentionedAccounts) } -// DeriveHashtagsFromStatus takes a plaintext (ie., not html-formatted) status, +// DeriveHashtagsFromText takes a plaintext (ie., not html-formatted) text, // and applies a regex to it to return a deduplicated list of hashtags -// used in that status, without the leading #. The case of the returned +// used in that text, without the leading #. The case of the returned // tags will be lowered, for consistency. -func DeriveHashtagsFromStatus(status string) []string { +func DeriveHashtagsFromText(text string) []string { tags := []string{} - for _, m := range regexes.HashtagFinder.FindAllStringSubmatch(status, -1) { + for _, m := range regexes.HashtagFinder.FindAllStringSubmatch(text, -1) { tags = append(tags, strings.TrimPrefix(m[1], "#")) } return UniqueStrings(tags) } -// DeriveEmojisFromStatus takes a plaintext (ie., not html-formatted) status, +// DeriveEmojisFromText takes a plaintext (ie., not html-formatted) text, // and applies a regex to it to return a deduplicated list of emojis -// used in that status, without the surround ::. -func DeriveEmojisFromStatus(status string) []string { +// used in that text, without the surrounding `::` +func DeriveEmojisFromText(text string) []string { emojis := []string{} - for _, m := range regexes.EmojiFinder.FindAllStringSubmatch(status, -1) { + for _, m := range regexes.EmojiFinder.FindAllStringSubmatch(text, -1) { emojis = append(emojis, m[1]) } return UniqueStrings(emojis) |