1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-21 00:45:18 +00:00

Can change conversation name

This commit is contained in:
2020-06-15 14:30:01 +02:00
parent 0f856e93cb
commit 8a2b618648
3 changed files with 37 additions and 0 deletions

View File

@ -98,5 +98,25 @@ pub fn update_settings(r: &mut HttpRequestHandler) -> RequestResult {
conversations_helper::set_members(conv_id, &members, is_moderator)?;
}
// Change moderator settings
if r.has_post_parameter("name") || r.has_post_parameter("canEveryoneAddMembers") {
if !is_moderator {
r.forbidden("You are not allowed to perform changes on this conversation!".to_string())?;
}
// Change conversation name
if r.has_post_parameter("name") {
let name = r.post_string_opt("name", 0, true)?;
let name = if name.eq("false") || name.is_empty() {
None
} else {
// TODO : remove HTML nodes
Some(name)
};
conversations_helper::set_name(conv_id, name)?;
}
}
r.success("Conversation information successfully updated!")
}