summaryrefslogtreecommitdiff
path: root/internal/typeutils/internaltofrontend.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-04-17 14:49:20 +0200
committerLibravatar GitHub <noreply@github.com>2024-04-17 13:49:20 +0100
commitcef9924d9a463df22da273cbca19735ec9e15243 (patch)
tree75271d1b4cd1ed8a91ec1d1a6360338866224a7f /internal/typeutils/internaltofrontend.go
parent[feature] Stub status history endpoint (#2847) (diff)
downloadgotosocial-cef9924d9a463df22da273cbca19735ec9e15243.tar.xz
[feature] Status source endpoint (#2848)
* [feature] statusSource endpoint * finish up
Diffstat (limited to 'internal/typeutils/internaltofrontend.go')
-rw-r--r--internal/typeutils/internaltofrontend.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go
index fa704a5bb..98e1a4611 100644
--- a/internal/typeutils/internaltofrontend.go
+++ b/internal/typeutils/internaltofrontend.go
@@ -792,6 +792,17 @@ func (c *Converter) StatusToWebStatus(
return webStatus, nil
}
+// StatusToAPIStatusSource returns the *apimodel.StatusSource of the given status.
+// Callers should check beforehand whether a requester has permission to view the
+// source of the status, and ensure they're passing only a local status into this function.
+func (c *Converter) StatusToAPIStatusSource(ctx context.Context, s *gtsmodel.Status) (*apimodel.StatusSource, error) {
+ return &apimodel.StatusSource{
+ ID: s.ID,
+ Text: s.Text,
+ SpoilerText: s.ContentWarning,
+ }, nil
+}
+
// statusToFrontend is a package internal function for
// parsing a status into its initial frontend representation.
//