From fd6970f6fefcbba662b302c9f2f062ccf47ed04d Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 5 Mar 2021 14:20:50 +0100 Subject: [PATCH] background -> logo --- docs/db_struct.sql | 2 +- docs/migration.sql | 2 +- src/api_data/conversation_api.rs | 4 ++-- src/controllers/conversations_controller.rs | 4 ++-- src/data/conversation.rs | 2 +- src/data/new_conversation.rs | 2 +- src/helpers/conversations_helper.rs | 8 ++++---- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/db_struct.sql b/docs/db_struct.sql index 222c546..0d64e2c 100644 --- a/docs/db_struct.sql +++ b/docs/db_struct.sql @@ -66,7 +66,7 @@ CREATE TABLE `comunic_conversations_list` ( `creation_time` int DEFAULT NULL, `can_everyone_add_members` tinyint DEFAULT '1', `color` varchar(6) DEFAULT NULL, - `background` varchar(255) DEFAULT NULL, + `logo` varchar(255) DEFAULT NULL, `group_id` int DEFAULT NULL, `last_activity` int DEFAULT NULL, PRIMARY KEY (`id`) diff --git a/docs/migration.sql b/docs/migration.sql index 9169a18..a30f166 100644 --- a/docs/migration.sql +++ b/docs/migration.sql @@ -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 add column color varchar(6), - add column background varchar(255), + add column logo varchar(255), add group_id int; \ No newline at end of file diff --git a/src/api_data/conversation_api.rs b/src/api_data/conversation_api.rs index 8ed784e..2071656 100644 --- a/src/api_data/conversation_api.rs +++ b/src/api_data/conversation_api.rs @@ -21,7 +21,7 @@ pub struct ConversationAPI { last_activity: u64, name: Option, color: Option, - background: Option, + logo: Option, group_id: Option, members: Vec, can_everyone_add_members: bool, @@ -51,7 +51,7 @@ impl ConversationAPI { members: conv.members.iter().map(ConversationMembersAPI::new).collect(), can_everyone_add_members: conv.can_everyone_add_members, color: conv.color.clone(), - background: conv.background.clone(), + logo: conv.logo.clone(), group_id: conv.group_id.as_ref().map(|i| i.id()), can_have_call: calls_helper::can_have_call(conv), diff --git a/src/controllers/conversations_controller.rs b/src/controllers/conversations_controller.rs index 75582bd..4ac514d 100644 --- a/src/controllers/conversations_controller.rs +++ b/src/controllers/conversations_controller.rs @@ -61,7 +61,7 @@ pub fn create(r: &mut HttpRequestHandler) -> RequestResult { can_everyone_add_members: r.post_bool_opt("canEveryoneAddMembers", true), color: r.post_color_opt("color")?, group_id: None, - background: None,// TODO : add support for background + logo: None,// TODO : add support for logo }; // Create the conversation @@ -191,7 +191,7 @@ pub fn find_private(r: &mut HttpRequestHandler) -> RequestResult { members: vec![r.user_id()?, other_user], can_everyone_add_members: true, color: r.post_color_opt("color")?, - background: None, + logo: None, group_id: None, }; let conv_id = conversations_helper::create(&new_conv)?; diff --git a/src/data/conversation.rs b/src/data/conversation.rs index a408ea6..1e455d0 100644 --- a/src/data/conversation.rs +++ b/src/data/conversation.rs @@ -34,7 +34,7 @@ pub struct Conversation { pub id: ConvID, pub name: Option, pub color: Option, - pub background: Option, + pub logo: Option, pub creation_time: u64, pub group_id: Option, pub can_everyone_add_members: bool, diff --git a/src/data/new_conversation.rs b/src/data/new_conversation.rs index 074543c..bad0c1a 100644 --- a/src/data/new_conversation.rs +++ b/src/data/new_conversation.rs @@ -11,7 +11,7 @@ pub struct NewConversation { pub name: Option, pub group_id: Option, pub color: Option, - pub background: Option, + pub logo: Option, pub owner_following: bool, pub members: Vec, pub can_everyone_add_members: bool diff --git a/src/helpers/conversations_helper.rs b/src/helpers/conversations_helper.rs index 3abe203..ce432c6 100644 --- a/src/helpers/conversations_helper.rs +++ b/src/helpers/conversations_helper.rs @@ -24,7 +24,7 @@ pub fn create(conv: &NewConversation) -> Res { .add_u64("last_activity", time()) .add_u64("creation_time", time()) .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_opt_group_id("group_id", conv.group_id.clone()) .insert()? @@ -463,8 +463,8 @@ pub fn delete_conversation(conv: &Conversation) -> ResultBoxError<()> { .cond_conv_id("conv_id", conv.id) .exec()?; - // Delete associated background image, if any - if let Some(image) = &conv.background { + // Delete associated logo image, if any + if let Some(image) = &conv.logo { delete_user_data_file_if_exists(image)?; } @@ -503,7 +503,7 @@ fn db_to_conversation_info(row: &database::RowResult) -> ResultBoxError