diff options
author | 2024-07-12 20:36:03 +0200 | |
---|---|---|
committer | 2024-07-12 20:36:03 +0200 | |
commit | aeb65bceae97611b8931de2e954df18afedd812f (patch) | |
tree | 74e6f7ecb86c8affcfef99994cbf21d9133a2b56 /internal/web/thread.go | |
parent | [feature] support processing of (many) more media types (#3090) (diff) | |
download | gotosocial-aeb65bceae97611b8931de2e954df18afedd812f.tar.xz |
[feature/frontend] Better visual separation between "main" thread and "replies" (#3093)
* [feature/frontend] Better web threading model
* fix test
* bwap
* tweaks
* more tweaks to wording
* typo
* indenting
* adjust wording
* aaa
Diffstat (limited to 'internal/web/thread.go')
-rw-r--r-- | internal/web/thread.go | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/internal/web/thread.go b/internal/web/thread.go index 492d40103..de3d1b361 100644 --- a/internal/web/thread.go +++ b/internal/web/thread.go @@ -20,7 +20,6 @@ package web import ( "context" "encoding/json" - "errors" "fmt" "net/http" "strings" @@ -101,34 +100,20 @@ func (m *Module) threadGETHandler(c *gin.Context) { return } - // Get the status itself from the processor using provided ID and authorization (if any). - status, errWithCode := m.processor.Status().WebGet(ctx, targetStatusID) + // Get the thread context. This will fetch the target status as well. + context, errWithCode := m.processor.Status().WebContextGet(ctx, targetStatusID) if errWithCode != nil { apiutil.WebErrorHandler(c, errWithCode, instanceGet) return } // Ensure status actually belongs to target account. - if status.GetAccountID() != targetAccount.ID { + if context.Status.GetAccountID() != targetAccount.ID { err := fmt.Errorf("target account %s does not own status %s", targetUsername, targetStatusID) apiutil.WebErrorHandler(c, gtserror.NewErrorNotFound(err), instanceGet) return } - // Don't render boosts/reblogs as top-level statuses. - if status.Reblog != nil { - err := errors.New("status is a boost wrapper / reblog") - apiutil.WebErrorHandler(c, gtserror.NewErrorNotFound(err), instanceGet) - return - } - - // Fill in the rest of the thread context. - context, errWithCode := m.processor.Status().WebContextGet(ctx, targetStatusID) - if errWithCode != nil { - apiutil.WebErrorHandler(c, errWithCode, instanceGet) - return - } - // Prepare stylesheets for thread. stylesheets := make([]string, 0, 5) @@ -159,11 +144,10 @@ func (m *Module) threadGETHandler(c *gin.Context) { page := apiutil.WebPage{ Template: "thread.tmpl", Instance: instance, - OGMeta: apiutil.OGBase(instance).WithStatus(status), + OGMeta: apiutil.OGBase(instance).WithStatus(context.Status), Stylesheets: stylesheets, Javascript: []string{jsFrontend}, Extra: map[string]any{ - "status": status, "context": context, }, } |