mirror of
https://github.com/notherealmarco/WASAPhoto.git
synced 2025-05-05 12:22:35 +02: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" = ?
|
AND "followed" = ?
|
||||||
LIMIT ?
|
LIMIT ?
|
||||||
OFFSET ?`, uid, requesting_uid, limit, start_index)
|
OFFSET ?`, requesting_uid, uid, limit, start_index)
|
||||||
|
|
||||||
followers, err := db.uidNameQuery(rows, err)
|
followers, err := db.uidNameQuery(rows, err)
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ func (db *appdbimpl) GetUserFollowers(uid string, requesting_uid string, start_i
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get user following
|
// 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
|
// user may exist but have no followers
|
||||||
exists, err := db.UserExistsNotBanned(uid, requesting_uid)
|
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
|
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"
|
WHERE "follows"."followed" = "users"."uid"
|
||||||
|
|
||||||
AND "follows"."followed" NOT IN (
|
AND "follows"."followed" NOT IN (
|
||||||
|
@ -161,7 +161,7 @@ func (db *appdbimpl) GetUserFollowing(uid string, requesting_uid string, start_i
|
||||||
|
|
||||||
AND "follower" = ?
|
AND "follower" = ?
|
||||||
LIMIT ?
|
LIMIT ?
|
||||||
OFFSET ?`, uid, requesting_uid, offset, start_index)
|
OFFSET ?`, requesting_uid, uid, limit, start_index)
|
||||||
|
|
||||||
following, err := db.uidNameQuery(rows, err)
|
following, err := db.uidNameQuery(rows, err)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue