1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2024-12-28 14:38:52 +00:00

Check if users exists before adding them to a conversation

This commit is contained in:
Pierre HUBERT 2020-06-15 11:09:16 +02:00
parent 8527ae9c50
commit 0f856e93cb

View File

@ -84,6 +84,13 @@ pub fn update_settings(r: &mut HttpRequestHandler) -> RequestResult {
r.forbidden("You can not update the list of members of this conversation!".to_string())?;
}
// Check if the members of the conversation really exists
for member in &members {
if !user_helper::exists(member.clone())? {
r.not_found(format!("User {} not found!", member))?;
}
}
if !members.contains(&r.user_id()?) {
members.push(r.user_id()?);
}