mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-29 16:56:28 +00:00
Fix the way conversations without name are created
This commit is contained in:
parent
12da473024
commit
3b7c469ca4
@ -32,21 +32,14 @@ use crate::utils::user_data_utils::{delete_user_data_file_if_exists, user_data_p
|
|||||||
|
|
||||||
/// Create a new conversation
|
/// Create a new conversation
|
||||||
pub fn create(r: &mut HttpRequestHandler) -> RequestResult {
|
pub fn create(r: &mut HttpRequestHandler) -> RequestResult {
|
||||||
let name = r.post_string("name")?;
|
|
||||||
let mut members = r.post_users_id("users")?;
|
let mut members = r.post_users_id("users")?;
|
||||||
|
|
||||||
// Adapt name
|
|
||||||
let name = match name.as_str() {
|
|
||||||
"false" => None,
|
|
||||||
s => Some(s.to_string())
|
|
||||||
};
|
|
||||||
|
|
||||||
// Add current user ID if required
|
// Add current user ID if required
|
||||||
members.insert(r.user_id()?);
|
members.insert(r.user_id()?);
|
||||||
|
|
||||||
let conv = NewConversation {
|
let conv = NewConversation {
|
||||||
owner_id: r.user_id()?,
|
owner_id: r.user_id()?,
|
||||||
name,
|
name: r.post_string_optional("name"),
|
||||||
owner_following: r.post_bool("follow")?,
|
owner_following: r.post_bool("follow")?,
|
||||||
members,
|
members,
|
||||||
can_everyone_add_members: r.post_bool_opt("canEveryoneAddMembers", true),
|
can_everyone_add_members: r.post_bool_opt("canEveryoneAddMembers", true),
|
||||||
|
Loading…
Reference in New Issue
Block a user