summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2025-04-14 10:22:05 +0000
committerLibravatar GitHub <noreply@github.com>2025-04-14 11:22:05 +0100
commita07ca92752588adcb282144b75dc25fcc1db5cc2 (patch)
tree022931b69e247c2f1d7fc5673a29f2da0ece4bd4 /internal
parent[feature/frontend] Add visibility icon for posts (#4005) (diff)
downloadgotosocial-a07ca92752588adcb282144b75dc25fcc1db5cc2.tar.xz
don't panic on non-fully populated status edits, it may not always be possible (#4006)
Diffstat (limited to 'internal')
-rw-r--r--internal/gtsmodel/status.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/internal/gtsmodel/status.go b/internal/gtsmodel/status.go
index cdeccbebb..62458c2db 100644
--- a/internal/gtsmodel/status.go
+++ b/internal/gtsmodel/status.go
@@ -21,6 +21,7 @@ import (
"slices"
"time"
+ "github.com/superseriousbusiness/gotosocial/internal/log"
"github.com/superseriousbusiness/gotosocial/internal/util/xslices"
)
@@ -272,14 +273,15 @@ func (s *Status) IsLocalOnly() bool {
return s.Federated == nil || !*s.Federated
}
-// AllAttachmentIDs gathers ALL media attachment IDs from both the
-// receiving Status{}, and any historical Status{}.Edits. Note that
-// this function will panic if Status{}.Edits is not populated.
+// AllAttachmentIDs gathers ALL media attachment IDs from both
+// the receiving Status{}, and any historical Status{}.Edits.
func (s *Status) AllAttachmentIDs() []string {
var total int
- if len(s.EditIDs) != len(s.Edits) {
- panic("status edits not populated")
+ // Check if this is being correctly
+ // called on fully populated status.
+ if !s.EditsPopulated() {
+ log.Warnf(nil, "status edits not populated for %s", s.URI)
}
// Get count of attachment IDs.