summaryrefslogtreecommitdiff
path: root/internal/web/thread.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-09-04 14:41:42 +0200
committerLibravatar GitHub <noreply@github.com>2022-09-04 14:41:42 +0200
commit006c8b604b88fdddf1a2319e44aa37dd8777efd9 (patch)
treed1562a40f437005031405525a51a8003c2fd39d7 /internal/web/thread.go
parent[bugfix] Fix status fields `in_reply_to_id` and `in_reply_to_account_id` not ... (diff)
downloadgotosocial-006c8b604b88fdddf1a2319e44aa37dd8777efd9.tar.xz
[feature] Set default header and avatar for API accounts to GtS ones (#799)
* validate web-asset-base-dir * move default icons into converter * always ensure avatar + header on api accounts * update tests * add default header * don't return error from web module creation anymore * tidy a bit * use pngs for default avatars rather than svgs
Diffstat (limited to 'internal/web/thread.go')
-rw-r--r--internal/web/thread.go26
1 files changed, 0 insertions, 26 deletions
diff --git a/internal/web/thread.go b/internal/web/thread.go
index d3b92bde3..3db4952c7 100644
--- a/internal/web/thread.go
+++ b/internal/web/thread.go
@@ -23,7 +23,6 @@ import (
"encoding/json"
"errors"
"fmt"
- "math/rand"
"net/http"
"strings"
@@ -36,21 +35,6 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/oauth"
)
-var randAvatars = make(map[string]string)
-
-func (m *Module) ensureAvatar(status apimodel.Status) {
- if status.Account.Avatar == "" && len(m.defaultAvatars) > 0 {
- avatar, ok := randAvatars[status.Account.ID]
- if !ok {
- //nolint:gosec
- randomIndex := rand.Intn(len(m.defaultAvatars))
- avatar = m.defaultAvatars[randomIndex]
- randAvatars[status.Account.ID] = avatar
- }
- status.Account.Avatar = avatar
- }
-}
-
func (m *Module) threadGETHandler(c *gin.Context) {
ctx := c.Request.Context()
@@ -120,16 +104,6 @@ func (m *Module) threadGETHandler(c *gin.Context) {
return
}
- m.ensureAvatar(*status)
-
- for _, status := range context.Descendants {
- m.ensureAvatar(status)
- }
-
- for _, status := range context.Ancestors {
- m.ensureAvatar(status)
- }
-
c.HTML(http.StatusOK, "thread.tmpl", gin.H{
"instance": instance,
"status": status,