mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-17 22:37:34 -06:00
get remote follows/accepts working
This commit is contained in:
parent
c7b4f847d8
commit
d69786ef17
16 changed files with 459 additions and 104 deletions
|
|
@ -242,6 +242,9 @@ func (ps *postgresService) GetAll(i interface{}) error {
|
|||
|
||||
func (ps *postgresService) Put(i interface{}) error {
|
||||
_, err := ps.conn.Model(i).Insert(i)
|
||||
if err != nil && strings.Contains(err.Error(), "duplicate key value violates unique constraint") {
|
||||
return db.ErrAlreadyExists{}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
@ -900,6 +903,10 @@ func (ps *postgresService) Follows(sourceAccount *gtsmodel.Account, targetAccoun
|
|||
return ps.conn.Model(>smodel.Follow{}).Where("account_id = ?", sourceAccount.ID).Where("target_account_id = ?", targetAccount.ID).Exists()
|
||||
}
|
||||
|
||||
func (ps *postgresService) FollowRequested(sourceAccount *gtsmodel.Account, targetAccount *gtsmodel.Account) (bool, error) {
|
||||
return ps.conn.Model(>smodel.FollowRequest{}).Where("account_id = ?", sourceAccount.ID).Where("target_account_id = ?", targetAccount.ID).Exists()
|
||||
}
|
||||
|
||||
func (ps *postgresService) Mutuals(account1 *gtsmodel.Account, account2 *gtsmodel.Account) (bool, error) {
|
||||
// make sure account 1 follows account 2
|
||||
f1, err := ps.conn.Model(>smodel.Follow{}).Where("account_id = ?", account1.ID).Where("target_account_id = ?", account2.ID).Exists()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue