fix hub bugs, add channel role permission endpoints
Covers: snake_case param renames, mutex RLock/Unlock mismatches, user.Hubs keyed by hub.Id, hub color using new_name, DELETE params sent as query, delete(target.Hubs, hub.Id), root/member role Id swap, and the three new PATCH /hub/channel/roles/* handlers.
This commit is contained in:
@@ -33,21 +33,21 @@ func HandleDm(response http.ResponseWriter, request *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
conn, ok := getConnectionWithResponseOnFail(response, request.FormValue("connectionid"), user)
|
||||
conn, ok := getConnectionWithResponseOnFail(response, request.FormValue("connection_id"), user)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
msgContent := request.FormValue("msgContent")
|
||||
attachedFile := request.FormValue("attachedFile")
|
||||
msgContent := request.FormValue("msg_content")
|
||||
attachedFile := request.FormValue("attached_file")
|
||||
|
||||
if msgContent == "" && attachedFile == "" {
|
||||
http.Error(response, "empty msgContent", http.StatusBadRequest)
|
||||
http.Error(response, "empty msg_content", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if attachedFile != "" && !strings.HasPrefix(attachedFile, string(minio.ConnectionFilePrefix)+conn.Id.String()+"/") {
|
||||
http.Error(response, "invalid attachedFile", http.StatusBadRequest)
|
||||
http.Error(response, "invalid attached_file", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ func HandleUserGetConnectionMessages(response http.ResponseWriter, request *http
|
||||
return
|
||||
}
|
||||
|
||||
conn, ok := getConnectionWithResponseOnFail(response, request.FormValue("connectionid"), user)
|
||||
conn, ok := getConnectionWithResponseOnFail(response, request.FormValue("connection_id"), user)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
@@ -268,7 +268,7 @@ func HandleUserDeleteConnection(response http.ResponseWriter, request *http.Requ
|
||||
return
|
||||
}
|
||||
|
||||
conn, ok := getConnectionWithResponseOnFail(response, request.FormValue("connectionid"), user)
|
||||
conn, ok := getConnectionWithResponseOnFail(response, request.FormValue("connection_id"), user)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
@@ -305,7 +305,7 @@ func HandleUserElevateConnection(response http.ResponseWriter, request *http.Req
|
||||
http.Error(response, "invalid token", http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
conn, ok := getConnectionWithResponseOnFail(response, request.FormValue("connectionid"), user)
|
||||
conn, ok := getConnectionWithResponseOnFail(response, request.FormValue("connection_id"), user)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
@@ -374,7 +374,7 @@ func HandleUserDeElevateConnection(response http.ResponseWriter, request *http.R
|
||||
return
|
||||
}
|
||||
|
||||
conn, ok := getConnectionWithResponseOnFail(response, request.FormValue("connectionid"), user)
|
||||
conn, ok := getConnectionWithResponseOnFail(response, request.FormValue("connection_id"), user)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user