add channel set desc

This commit is contained in:
2026-05-02 13:01:14 +02:00
parent 40cb7736c2
commit cb003d235f
2 changed files with 25 additions and 0 deletions
+24
View File
@@ -870,3 +870,27 @@ func HandleChannelSetName(response http.ResponseWriter, request *http.Request) {
response.WriteHeader(http.StatusAccepted)
}
func HandleChannelSetDescription(response http.ResponseWriter, request *http.Request) {
_, hub, _, _, ok := hubPermissionContext(response, request, normal, types.PermissionSetChannelDescription)
if !ok {
return
}
newDescription := request.FormValue("description")
channelId, err := convertions.StringToUint8(request.FormValue("id"))
if err != nil {
http.Error(response, "invalid channel id", http.StatusBadRequest)
return
}
hub.Mu.Lock()
channel := hub.Channels[channelId]
if channel == nil {
http.Error(response, "no such channel", http.StatusNotFound)
return
}
channel.Description = newDescription
hub.Mu.Unlock()
response.WriteHeader(http.StatusAccepted)
}