[feature] Web profile pages for accounts (#449)

* add default avatars

* allow webModule to error

* return errWithCode from account get

* add AccountGetLocalByUsername

* check nil requesting account

* add timestampShort function for just month/year

* move loading logic to New + add default avatars

* add profile page view

* update swagger docs

* add excludeReblogs to GetAccountStatuses

* ignore casing when selecting local account by username

* appropriate redirects

* css fiddling

* add 'about' heading

* adjust thread page to work with routing

* return AP representation if requested + authorized

* simplify auth check

* go fmt

* golangci-lint ignore math/rand
This commit is contained in:
tobi
2022-04-15 14:33:01 +02:00
committed by GitHub
parent a7e9dee33d
commit 26683b3d49
33 changed files with 1484 additions and 88 deletions

View File

@@ -60,6 +60,12 @@ import (
// default: false
// in: query
// required: false
// - name: exclude_reblogs
// type: boolean
// description: Exclude statuses that are a reblog/boost of another status.
// default: false
// in: query
// required: false
// - name: max_id
// type: string
// description: |-
@@ -75,7 +81,7 @@ import (
// required: false
// - name: pinned_only
// type: boolean
// description: Show only pinned statuses. In other words,e xclude statuses that are not pinned to the given account ID.
// description: Show only pinned statuses. In other words, exclude statuses that are not pinned to the given account ID.
// default: false
// in: query
// required: false
@@ -149,13 +155,25 @@ func (m *Module) AccountStatusesGETHandler(c *gin.Context) {
if excludeRepliesString != "" {
i, err := strconv.ParseBool(excludeRepliesString)
if err != nil {
l.Debugf("error parsing replies string: %s", err)
l.Debugf("error parsing exclude replies string: %s", err)
c.JSON(http.StatusBadRequest, gin.H{"error": "couldn't parse exclude replies query param"})
return
}
excludeReplies = i
}
excludeReblogs := false
excludeReblogsString := c.Query(ExcludeReblogsKey)
if excludeReblogsString != "" {
i, err := strconv.ParseBool(excludeReblogsString)
if err != nil {
l.Debugf("error parsing exclude reblogs string: %s", err)
c.JSON(http.StatusBadRequest, gin.H{"error": "couldn't parse exclude reblogs query param"})
return
}
excludeReblogs = i
}
maxID := ""
maxIDString := c.Query(MaxIDKey)
if maxIDString != "" {
@@ -204,7 +222,7 @@ func (m *Module) AccountStatusesGETHandler(c *gin.Context) {
publicOnly = i
}
statuses, errWithCode := m.processor.AccountStatusesGet(c.Request.Context(), authed, targetAcctID, limit, excludeReplies, maxID, minID, pinnedOnly, mediaOnly, publicOnly)
statuses, errWithCode := m.processor.AccountStatusesGet(c.Request.Context(), authed, targetAcctID, limit, excludeReplies, excludeReblogs, maxID, minID, pinnedOnly, mediaOnly, publicOnly)
if errWithCode != nil {
l.Debugf("error from processor account statuses get: %s", errWithCode)
c.JSON(errWithCode.Code(), gin.H{"error": errWithCode.Safe()})