mirror of
https://github.com/notherealmarco/WASAPhoto.git
synced 2025-05-05 12:22:35 +02:00
Fix profile view follow & ban status, Add ban status in GET profile API call
This commit is contained in:
parent
00e6b3de7b
commit
4c4481393d
8 changed files with 39 additions and 16 deletions
|
@ -54,12 +54,21 @@ func (db *appdbimpl) GetUserProfile(uid string, requesting_uid string) (QueryRes
|
|||
return ERR_INTERNAL, nil, err
|
||||
}
|
||||
|
||||
// Get ban status
|
||||
var ban_status bool
|
||||
err = db.c.QueryRow(`SELECT EXISTS (SELECT * FROM "bans" WHERE "user" = ? AND "ban" = ?)`, requesting_uid, uid).Scan(&ban_status)
|
||||
|
||||
if err != nil {
|
||||
return ERR_INTERNAL, nil, err
|
||||
}
|
||||
|
||||
return SUCCESS, &structures.UserProfile{
|
||||
UID: uid,
|
||||
Name: name,
|
||||
Following: following,
|
||||
Followers: followers,
|
||||
Followed: follow_status,
|
||||
Banned: ban_status,
|
||||
Photos: photos,
|
||||
}, nil
|
||||
}
|
||||
|
|
|
@ -290,15 +290,15 @@ func (db *appdbimpl) SearchByName(name string, requesting_uid string, start_inde
|
|||
(
|
||||
SELECT EXISTS(
|
||||
SELECT * FROM "follows" AS "f"
|
||||
WHERE "f"."follower" = "users"."uid"
|
||||
AND "f"."followed" = ?
|
||||
WHERE "f"."follower" = ?
|
||||
AND "f"."followed" = "users"."uid"
|
||||
)
|
||||
),
|
||||
(
|
||||
SELECT EXISTS(
|
||||
SELECT * FROM "bans" AS "b"
|
||||
WHERE "b"."user" = "users"."uid"
|
||||
AND "b"."ban" = ?
|
||||
WHERE "b"."user" = ?
|
||||
AND "b"."ban" = "users"."uid"
|
||||
)
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue