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

Can register / unregister a conversation

This commit is contained in:
2021-02-06 08:55:14 +01:00
parent fad21381ed
commit cf6063feef
5 changed files with 26 additions and 3 deletions

View File

@ -13,6 +13,7 @@ use crate::api_data::http_error::HttpError;
use crate::constants::PASSWORD_MIN_LENGTH;
use crate::controllers::routes::RequestResult;
use crate::data::comment::Comment;
use crate::data::conversation::ConvID;
use crate::data::custom_emoji::CustomEmoji;
use crate::data::error::{ExecError, ResultBoxError};
use crate::data::group::GroupAccessLevel;
@ -424,7 +425,7 @@ pub trait BaseRequestHandler {
}
/// Get & return the ID of the conversation included in the POST request
fn post_conv_id(&mut self, name: &str) -> ResultBoxError<u64> {
fn post_conv_id(&mut self, name: &str) -> ResultBoxError<ConvID> {
let conv_id = self.post_u64(name)?;
if !conversations_helper::does_user_belongs_to(&self.user_id()?, conv_id)? {

View File

@ -4,9 +4,11 @@
use crate::data::user::UserID;
pub type ConvID = u64;
#[derive(Debug, PartialEq, Eq)]
pub struct Conversation {
pub id: u64,
pub id: ConvID,
pub owner_id: UserID,
pub name: Option<String>,
pub members: Vec<UserID>,