mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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
This commit is contained in:
@@ -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,
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user