mirror of
https://github.com/notherealmarco/WASAPhoto.git
synced 2025-03-13 13:35:23 +01:00
Fix GetUserFollowers returning wrong user's followers
This commit is contained in:
parent
7812304be8
commit
c0ba5011b5
1 changed files with 4 additions and 4 deletions
|
@ -125,7 +125,7 @@ func (db *appdbimpl) GetUserFollowers(uid string, requesting_uid string, start_i
|
|||
|
||||
AND "followed" = ?
|
||||
LIMIT ?
|
||||
OFFSET ?`, uid, requesting_uid, limit, start_index)
|
||||
OFFSET ?`, requesting_uid, uid, limit, start_index)
|
||||
|
||||
followers, err := db.uidNameQuery(rows, err)
|
||||
|
||||
|
@ -137,7 +137,7 @@ func (db *appdbimpl) GetUserFollowers(uid string, requesting_uid string, start_i
|
|||
}
|
||||
|
||||
// Get user following
|
||||
func (db *appdbimpl) GetUserFollowing(uid string, requesting_uid string, start_index int, offset int) (QueryResult, *[]structures.UIDName, error) {
|
||||
func (db *appdbimpl) GetUserFollowing(uid string, requesting_uid string, start_index int, limit int) (QueryResult, *[]structures.UIDName, error) {
|
||||
|
||||
// user may exist but have no followers
|
||||
exists, err := db.UserExistsNotBanned(uid, requesting_uid)
|
||||
|
@ -150,7 +150,7 @@ func (db *appdbimpl) GetUserFollowing(uid string, requesting_uid string, start_i
|
|||
return ERR_NOT_FOUND, nil, nil
|
||||
}
|
||||
|
||||
rows, err := db.c.Query(`SELECT "followed", "user"."name" FROM "follows", "users"
|
||||
rows, err := db.c.Query(`SELECT "followed", "users"."name" FROM "follows", "users"
|
||||
WHERE "follows"."followed" = "users"."uid"
|
||||
|
||||
AND "follows"."followed" NOT IN (
|
||||
|
@ -161,7 +161,7 @@ func (db *appdbimpl) GetUserFollowing(uid string, requesting_uid string, start_i
|
|||
|
||||
AND "follower" = ?
|
||||
LIMIT ?
|
||||
OFFSET ?`, uid, requesting_uid, offset, start_index)
|
||||
OFFSET ?`, requesting_uid, uid, limit, start_index)
|
||||
|
||||
following, err := db.uidNameQuery(rows, err)
|
||||
|
||||
|
|
Loading…
Reference in a new issue