summaryrefslogtreecommitdiff
path: root/internal/ap
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-08-29 12:03:08 +0200
committerLibravatar GitHub <noreply@github.com>2021-08-29 12:03:08 +0200
commit53507ac2a32a785b5467b1e58d033780d8e02693 (patch)
tree1c48ac9f5fc47e65450d53d8d26d0dee30753687 /internal/ap
parentReplace federating DB locks map, add a cleanup goroutine (#166) (diff)
downloadgotosocial-53507ac2a32a785b5467b1e58d033780d8e02693.tar.xz
Mention fixup (#167)
* rework mention creation a bit * rework mention creation a bit * tidy up status dereferencing * start adding tests for dereferencing * fixups * fix * review changes
Diffstat (limited to 'internal/ap')
-rw-r--r--internal/ap/extract.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/internal/ap/extract.go b/internal/ap/extract.go
index 1ee0e008e..f8453c9c0 100644
--- a/internal/ap/extract.go
+++ b/internal/ap/extract.go
@@ -242,8 +242,9 @@ func ExtractImageURL(i WithImage) (*url.URL, error) {
// ExtractSummary extracts the summary/content warning of an interface.
func ExtractSummary(i WithSummary) (string, error) {
summaryProp := i.GetActivityStreamsSummary()
- if summaryProp == nil {
- return "", errors.New("summary property was nil")
+ if summaryProp == nil || summaryProp.Len() == 0 {
+ // no summary to speak of
+ return "", nil
}
for iter := summaryProp.Begin(); iter != summaryProp.End(); iter = iter.Next() {
@@ -544,12 +545,12 @@ func ExtractMentions(i WithTag) ([]*gtsmodel.Mention, error) {
mentionable, ok := t.(Mentionable)
if !ok {
- continue
+ return nil, errors.New("mention was not convertable to ap.Mentionable")
}
mention, err := ExtractMention(mentionable)
if err != nil {
- continue
+ return nil, err
}
mentions = append(mentions, mention)