mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-29 18:06:15 -06:00
fix PR review suggestions
This commit is contained in:
parent
1168a1458d
commit
781d7b8584
3 changed files with 15 additions and 13 deletions
|
|
@ -25,7 +25,7 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/oauth"
|
||||
)
|
||||
|
||||
type StatusLink struct {
|
||||
type statusLink struct {
|
||||
User string `uri:"user" binding:"required"`
|
||||
ID string `uri:"id" binding:"required"`
|
||||
}
|
||||
|
|
@ -34,40 +34,42 @@ func (m *Module) threadTemplateHandler(c *gin.Context) {
|
|||
l := m.log.WithField("func", "threadTemplateGET")
|
||||
l.Trace("rendering thread template")
|
||||
|
||||
var statusLink StatusLink
|
||||
ctx := c.Request.Context()
|
||||
|
||||
if err := c.ShouldBindUri(&statusLink); err != nil {
|
||||
var uriParts statusLink
|
||||
|
||||
if err := c.ShouldBindUri(&uriParts); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "status not found"})
|
||||
return
|
||||
}
|
||||
|
||||
authed, err := oauth.Authed(c, false, false, false, false) // we don't really need an app here but we want everything else
|
||||
authed, err := oauth.Authed(c, false, false, false, false)
|
||||
if err != nil {
|
||||
l.Errorf("error authing status GET request: %s", err)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "status not found"})
|
||||
return
|
||||
}
|
||||
|
||||
instance, err := m.processor.InstanceGet(c.Request.Context(), m.config.Host)
|
||||
instance, err := m.processor.InstanceGet(ctx, m.config.Host)
|
||||
if err != nil {
|
||||
l.Debugf("error getting instance from processor: %s", err)
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "internal server error"})
|
||||
return
|
||||
}
|
||||
|
||||
status, err := m.processor.StatusGet(c.Request.Context(), authed, statusLink.ID)
|
||||
status, err := m.processor.StatusGet(ctx, authed, uriParts.ID)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "status not found"})
|
||||
return
|
||||
}
|
||||
|
||||
println(statusLink.User[:1], statusLink.User, status.Account.Username)
|
||||
if statusLink.User[:1] != "@" || statusLink.User[1:] != status.Account.Username {
|
||||
println(uriParts.User[:1], uriParts.User, status.Account.Username)
|
||||
if uriParts.User[:1] != "@" || uriParts.User[1:] != status.Account.Username {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "status not found"})
|
||||
return
|
||||
}
|
||||
|
||||
context, err := m.processor.StatusGetContext(c.Request.Context(), authed, statusLink.ID)
|
||||
context, err := m.processor.StatusGetContext(ctx, authed, uriParts.ID)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "status not found"})
|
||||
return
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
|
|||
Username: "admin",
|
||||
AvatarMediaAttachmentID: "",
|
||||
HeaderMediaAttachmentID: "",
|
||||
DisplayName: "Admin",
|
||||
DisplayName: "",
|
||||
Fields: []gtsmodel.Field{},
|
||||
Note: "",
|
||||
Memorial: false,
|
||||
|
|
@ -540,7 +540,7 @@ func NewTestAttachments() map[string]*gtsmodel.MediaAttachment {
|
|||
},
|
||||
},
|
||||
AccountID: "01F8MH1H7YV1Z7D2C8K2730QBF",
|
||||
Description: "",
|
||||
Description: "90's Trent Reznor turning to the camera",
|
||||
ScheduledStatusID: "",
|
||||
Blurhash: "LEDara58O=t5EMSOENEN9]}?aK%0",
|
||||
Processing: 2,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<a href="{{.Account.URL}}" class="avatar"><img src="{{.Account.Avatar}}"></a>
|
||||
<a href="{{.Account.URL}}" class="displayname">{{.Account.DisplayName}}</a>
|
||||
<a href="{{.Account.URL}}" class="displayname">{{if .Account.DisplayName}}{{.Account.DisplayName}}{{else}}{{.Account.Username}}{{end}}</a>
|
||||
<a href="{{.Account.URL}}" class="username">@{{.Account.Username}}</a>
|
||||
<div class="text">
|
||||
{{if .SpoilerText}}
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
{{range .}}
|
||||
<a href="{{.URL}}" target="_blank" title="{{.Description}}">
|
||||
{{if not .Description}}
|
||||
<div class="no-image-desc" aria-hidden="true" >(!)<span>Missing image description</span></div>
|
||||
<div class="no-image-desc" aria-hidden="true" ><i class="fa fa-info-circle"></i><span>Missing image description</span></div>
|
||||
{{end}}
|
||||
<img src="{{.PreviewURL}}" alt="{{.Description}}"/>
|
||||
</a>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue