Skip to content

Commit beba181

Browse files
committed
fix: use the requested user's did if no users requested
1 parent c7d5b28 commit beba181

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

twitterv1/user.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ func GetStatusesFollowers(c *fiber.Ctx) error {
485485

486486
func GetFollowers(c *fiber.Ctx) error {
487487
// auth
488-
_, pds, _, oauthToken, err := GetAuthFromReq(c)
488+
userDID, pds, _, oauthToken, err := GetAuthFromReq(c)
489489
if err != nil {
490490
return c.Status(fiber.StatusUnauthorized).SendString("OAuth token not found in Authorization header")
491491
}
@@ -495,7 +495,11 @@ func GetFollowers(c *fiber.Ctx) error {
495495
if actor == "" {
496496
actor = c.FormValue("screen_name")
497497
if actor == "" {
498-
c.Status(fiber.StatusBadRequest).SendString("No user provided")
498+
if userDID != nil {
499+
actor = *userDID
500+
} else {
501+
return c.Status(fiber.StatusBadRequest).SendString("No user provided")
502+
}
499503
}
500504
} else {
501505
id, err := strconv.ParseInt(actor, 10, 64)
@@ -657,7 +661,7 @@ func GetStatusesFollows(c *fiber.Ctx) error {
657661

658662
func GetFollows(c *fiber.Ctx) error {
659663
// auth
660-
_, pds, _, oauthToken, err := GetAuthFromReq(c)
664+
userDID, pds, _, oauthToken, err := GetAuthFromReq(c)
661665
if err != nil {
662666
return c.Status(fiber.StatusUnauthorized).SendString("OAuth token not found in Authorization header")
663667
}
@@ -667,7 +671,11 @@ func GetFollows(c *fiber.Ctx) error {
667671
if actor == "" {
668672
actor = c.FormValue("screen_name")
669673
if actor == "" {
670-
c.Status(fiber.StatusBadRequest).SendString("No user provided")
674+
if userDID != nil {
675+
actor = *userDID
676+
} else {
677+
return c.Status(fiber.StatusBadRequest).SendString("No user provided")
678+
}
671679
}
672680
} else {
673681
id, err := strconv.ParseInt(actor, 10, 64)

0 commit comments

Comments
 (0)