kopia lustrzana https://codeberg.org/nmkj/audon
fix cohost redirect
rodzic
8dc11e7f84
commit
db42f13ee4
8
user.go
8
user.go
|
@ -83,6 +83,7 @@ func redirectUserHandler(c echo.Context) error {
|
|||
opts := options.FindOne().SetSort(bson.D{{Key: "created_at", Value: -1}})
|
||||
var room Room
|
||||
|
||||
searchCohost := false
|
||||
if err := coll.FindOne(c.Request().Context(), bson.D{
|
||||
{Key: "host.audon_id", Value: user.AudonID},
|
||||
}, opts).Decode(&room); err == nil {
|
||||
|
@ -90,6 +91,12 @@ func redirectUserHandler(c echo.Context) error {
|
|||
// redirect to the hosting room if online
|
||||
return c.Redirect(http.StatusFound, fmt.Sprintf("/r/%s", room.RoomID))
|
||||
} else {
|
||||
searchCohost = true
|
||||
}
|
||||
} else {
|
||||
searchCohost = true
|
||||
}
|
||||
if searchCohost {
|
||||
// redirect to the first cohosting room if online
|
||||
status, err := user.GetCurrentRoomStatus(c.Request().Context())
|
||||
if err != nil {
|
||||
|
@ -102,7 +109,6 @@ func redirectUserHandler(c echo.Context) error {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
query := make(url.Values)
|
||||
query.Add("url", user.RemoteURL)
|
||||
|
|
Ładowanie…
Reference in New Issue