summaryrefslogtreecommitdiff
path: root/internal/processing/account/get.go
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-07-11 16:22:21 +0200
committerLibravatar GitHub <noreply@github.com>2021-07-11 16:22:21 +0200
commit846057f0d696fded87d105dec1245e9ba32763ce (patch)
tree9a4914c07bcf189a3eea0a2c091567c56cdf4963 /internal/processing/account/get.go
parentfavourites GET implementation (#95) (diff)
downloadgotosocial-846057f0d696fded87d105dec1245e9ba32763ce.tar.xz
Block/unblock (#96)
* remote + local block logic, incl. federation * improve blocking stuff * fiddle with display of blocked profiles * go fmt
Diffstat (limited to 'internal/processing/account/get.go')
-rw-r--r--internal/processing/account/get.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/internal/processing/account/get.go b/internal/processing/account/get.go
index aba1ed14a..b937ace5b 100644
--- a/internal/processing/account/get.go
+++ b/internal/processing/account/get.go
@@ -45,9 +45,19 @@ func (p *processor) Get(requestingAccount *gtsmodel.Account, targetAccountID str
p.log.WithField("func", "AccountGet").Debugf("dereferencing account: %s", err)
}
- var mastoAccount *apimodel.Account
+ var blocked bool
var err error
- if requestingAccount != nil && targetAccount.ID == requestingAccount.ID {
+ if requestingAccount != nil {
+ blocked, err = p.db.Blocked(requestingAccount.ID, targetAccountID)
+ if err != nil {
+ return nil, fmt.Errorf("error checking account block: %s", err)
+ }
+ }
+
+ var mastoAccount *apimodel.Account
+ if blocked {
+ mastoAccount, err = p.tc.AccountToMastoBlocked(targetAccount)
+ } else if requestingAccount != nil && targetAccount.ID == requestingAccount.ID {
mastoAccount, err = p.tc.AccountToMastoSensitive(targetAccount)
} else {
mastoAccount, err = p.tc.AccountToMastoPublic(targetAccount)