add new user set avatar and profile background
This commit is contained in:
+19
-19
@@ -90,22 +90,22 @@ func getHubUserIfValidWithResponseOnFail(ctx context.Context, response http.Resp
|
||||
return user, hubUser, hub, nil
|
||||
}
|
||||
|
||||
func getHubChannelIfValidWithResponseOnFail(ctx context.Context, response http.ResponseWriter, hub *types.Hub, hubUser *types.HubUser, channelId string) (
|
||||
*types.HubChannel, error) {
|
||||
channelUuid, err := convertions.StringToUuid(channelId)
|
||||
if err != nil {
|
||||
http.Error(response, "invalid channelid", http.StatusBadRequest)
|
||||
return nil, errors.New("invalid channelid")
|
||||
}
|
||||
channel, ok := hub.Channels[channelUuid]
|
||||
if !ok {
|
||||
http.Error(response, "invalid channelid", http.StatusBadRequest)
|
||||
return nil, errors.New("invalid channelid")
|
||||
}
|
||||
|
||||
if !haveHubUserPermissionsOnChannel(types.CachedUserCanView, hubUser, channel) {
|
||||
return nil, errors.New("invalid channelid")
|
||||
}
|
||||
|
||||
return channel, nil
|
||||
}
|
||||
//func getHubChannelIfValidWithResponseOnFail(ctx context.Context, response http.ResponseWriter, hub *types.Hub, hubUser *types.HubUser, channelId string) (
|
||||
// *types.HubChannel, error) {
|
||||
// channelUuid, err := convertions.StringToUuid(channelId)
|
||||
// if err != nil {
|
||||
// http.Error(response, "invalid channelid", http.StatusBadRequest)
|
||||
// return nil, errors.New("invalid channelid")
|
||||
// }
|
||||
// channel, ok := hub.Channels[channelUuid]
|
||||
// if !ok {
|
||||
// http.Error(response, "invalid channelid", http.StatusBadRequest)
|
||||
// return nil, errors.New("invalid channelid")
|
||||
// }
|
||||
//
|
||||
// if !haveHubUserPermissionsOnChannel(types.CachedUserCanView, hubUser, channel) {
|
||||
// return nil, errors.New("invalid channelid")
|
||||
// }
|
||||
//
|
||||
// return channel, nil
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user