mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-22 13:29:21 +00:00
background -> logo
This commit is contained in:
parent
17e50ed59b
commit
fd6970f6fe
@ -66,7 +66,7 @@ CREATE TABLE `comunic_conversations_list` (
|
|||||||
`creation_time` int DEFAULT NULL,
|
`creation_time` int DEFAULT NULL,
|
||||||
`can_everyone_add_members` tinyint DEFAULT '1',
|
`can_everyone_add_members` tinyint DEFAULT '1',
|
||||||
`color` varchar(6) DEFAULT NULL,
|
`color` varchar(6) DEFAULT NULL,
|
||||||
`background` varchar(255) DEFAULT NULL,
|
`logo` varchar(255) DEFAULT NULL,
|
||||||
`group_id` int DEFAULT NULL,
|
`group_id` int DEFAULT NULL,
|
||||||
`last_activity` int DEFAULT NULL,
|
`last_activity` int DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
|
@ -23,5 +23,5 @@ alter table comunic_conversations_list drop column user_id;
|
|||||||
alter table comunic_conversations_list rename column last_active to last_activity;
|
alter table comunic_conversations_list rename column last_active to last_activity;
|
||||||
alter table comunic_conversations_list
|
alter table comunic_conversations_list
|
||||||
add column color varchar(6),
|
add column color varchar(6),
|
||||||
add column background varchar(255),
|
add column logo varchar(255),
|
||||||
add group_id int;
|
add group_id int;
|
@ -21,7 +21,7 @@ pub struct ConversationAPI {
|
|||||||
last_activity: u64,
|
last_activity: u64,
|
||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
color: Option<String>,
|
color: Option<String>,
|
||||||
background: Option<String>,
|
logo: Option<String>,
|
||||||
group_id: Option<u64>,
|
group_id: Option<u64>,
|
||||||
members: Vec<ConversationMembersAPI>,
|
members: Vec<ConversationMembersAPI>,
|
||||||
can_everyone_add_members: bool,
|
can_everyone_add_members: bool,
|
||||||
@ -51,7 +51,7 @@ impl ConversationAPI {
|
|||||||
members: conv.members.iter().map(ConversationMembersAPI::new).collect(),
|
members: conv.members.iter().map(ConversationMembersAPI::new).collect(),
|
||||||
can_everyone_add_members: conv.can_everyone_add_members,
|
can_everyone_add_members: conv.can_everyone_add_members,
|
||||||
color: conv.color.clone(),
|
color: conv.color.clone(),
|
||||||
background: conv.background.clone(),
|
logo: conv.logo.clone(),
|
||||||
group_id: conv.group_id.as_ref().map(|i| i.id()),
|
group_id: conv.group_id.as_ref().map(|i| i.id()),
|
||||||
|
|
||||||
can_have_call: calls_helper::can_have_call(conv),
|
can_have_call: calls_helper::can_have_call(conv),
|
||||||
|
@ -61,7 +61,7 @@ pub fn create(r: &mut HttpRequestHandler) -> RequestResult {
|
|||||||
can_everyone_add_members: r.post_bool_opt("canEveryoneAddMembers", true),
|
can_everyone_add_members: r.post_bool_opt("canEveryoneAddMembers", true),
|
||||||
color: r.post_color_opt("color")?,
|
color: r.post_color_opt("color")?,
|
||||||
group_id: None,
|
group_id: None,
|
||||||
background: None,// TODO : add support for background
|
logo: None,// TODO : add support for logo
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create the conversation
|
// Create the conversation
|
||||||
@ -191,7 +191,7 @@ pub fn find_private(r: &mut HttpRequestHandler) -> RequestResult {
|
|||||||
members: vec![r.user_id()?, other_user],
|
members: vec![r.user_id()?, other_user],
|
||||||
can_everyone_add_members: true,
|
can_everyone_add_members: true,
|
||||||
color: r.post_color_opt("color")?,
|
color: r.post_color_opt("color")?,
|
||||||
background: None,
|
logo: None,
|
||||||
group_id: None,
|
group_id: None,
|
||||||
};
|
};
|
||||||
let conv_id = conversations_helper::create(&new_conv)?;
|
let conv_id = conversations_helper::create(&new_conv)?;
|
||||||
|
@ -34,7 +34,7 @@ pub struct Conversation {
|
|||||||
pub id: ConvID,
|
pub id: ConvID,
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
pub color: Option<String>,
|
pub color: Option<String>,
|
||||||
pub background: Option<String>,
|
pub logo: Option<String>,
|
||||||
pub creation_time: u64,
|
pub creation_time: u64,
|
||||||
pub group_id: Option<GroupID>,
|
pub group_id: Option<GroupID>,
|
||||||
pub can_everyone_add_members: bool,
|
pub can_everyone_add_members: bool,
|
||||||
|
@ -11,7 +11,7 @@ pub struct NewConversation {
|
|||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
pub group_id: Option<GroupID>,
|
pub group_id: Option<GroupID>,
|
||||||
pub color: Option<String>,
|
pub color: Option<String>,
|
||||||
pub background: Option<String>,
|
pub logo: Option<String>,
|
||||||
pub owner_following: bool,
|
pub owner_following: bool,
|
||||||
pub members: Vec<UserID>,
|
pub members: Vec<UserID>,
|
||||||
pub can_everyone_add_members: bool
|
pub can_everyone_add_members: bool
|
||||||
|
@ -24,7 +24,7 @@ pub fn create(conv: &NewConversation) -> Res<ConvID> {
|
|||||||
.add_u64("last_activity", time())
|
.add_u64("last_activity", time())
|
||||||
.add_u64("creation_time", time())
|
.add_u64("creation_time", time())
|
||||||
.add_opt_str("color", Option::from(&conv.color))
|
.add_opt_str("color", Option::from(&conv.color))
|
||||||
.add_opt_str("background", Option::from(&conv.background))
|
.add_opt_str("logo", Option::from(&conv.logo))
|
||||||
.add_legacy_bool("can_everyone_add_members", conv.can_everyone_add_members)
|
.add_legacy_bool("can_everyone_add_members", conv.can_everyone_add_members)
|
||||||
.add_opt_group_id("group_id", conv.group_id.clone())
|
.add_opt_group_id("group_id", conv.group_id.clone())
|
||||||
.insert()?
|
.insert()?
|
||||||
@ -463,8 +463,8 @@ pub fn delete_conversation(conv: &Conversation) -> ResultBoxError<()> {
|
|||||||
.cond_conv_id("conv_id", conv.id)
|
.cond_conv_id("conv_id", conv.id)
|
||||||
.exec()?;
|
.exec()?;
|
||||||
|
|
||||||
// Delete associated background image, if any
|
// Delete associated logo image, if any
|
||||||
if let Some(image) = &conv.background {
|
if let Some(image) = &conv.logo {
|
||||||
delete_user_data_file_if_exists(image)?;
|
delete_user_data_file_if_exists(image)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -503,7 +503,7 @@ fn db_to_conversation_info(row: &database::RowResult) -> ResultBoxError<Conversa
|
|||||||
Ok(Conversation {
|
Ok(Conversation {
|
||||||
id: conv_id,
|
id: conv_id,
|
||||||
color: row.get_optional_str("color")?,
|
color: row.get_optional_str("color")?,
|
||||||
background: row.get_optional_str("background")?,
|
logo: row.get_optional_str("logo")?,
|
||||||
name: row.get_optional_str("name")?,
|
name: row.get_optional_str("name")?,
|
||||||
members: get_list_members(conv_id)?,
|
members: get_list_members(conv_id)?,
|
||||||
can_everyone_add_members: row.get_legacy_bool("can_everyone_add_members")?,
|
can_everyone_add_members: row.get_legacy_bool("can_everyone_add_members")?,
|
||||||
|
Loading…
Reference in New Issue
Block a user