mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: support changing the workspace icon (#4898)
This commit is contained in:
@ -179,7 +179,27 @@ impl UserManager {
|
||||
.patch_workspace(workspace_id, new_workspace_name, new_workspace_icon)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
// save the icon and name to sqlite db
|
||||
let uid = self.user_id()?;
|
||||
let conn = self.db_connection(uid)?;
|
||||
let mut user_workspace = match self.get_user_workspace(uid, workspace_id) {
|
||||
Some(user_workspace) => user_workspace,
|
||||
None => {
|
||||
return Err(FlowyError::record_not_found().with_context(format!(
|
||||
"Expected to find user workspace with id: {}, but not found",
|
||||
workspace_id
|
||||
)));
|
||||
},
|
||||
};
|
||||
|
||||
if let Some(new_workspace_name) = new_workspace_name {
|
||||
user_workspace.name = new_workspace_name.to_string();
|
||||
}
|
||||
if let Some(new_workspace_icon) = new_workspace_icon {
|
||||
user_workspace.icon = new_workspace_icon.to_string();
|
||||
}
|
||||
|
||||
save_user_workspaces(uid, conn, &[user_workspace])
|
||||
}
|
||||
|
||||
pub async fn delete_workspace(&self, workspace_id: &str) -> FlowyResult<()> {
|
||||
@ -312,6 +332,7 @@ pub fn save_user_workspaces(
|
||||
user_workspace_table::name.eq(&user_workspace.name),
|
||||
user_workspace_table::created_at.eq(&user_workspace.created_at),
|
||||
user_workspace_table::database_storage_id.eq(&user_workspace.database_storage_id),
|
||||
user_workspace_table::icon.eq(&user_workspace.icon),
|
||||
))
|
||||
.execute(conn)
|
||||
.and_then(|rows| {
|
||||
|
Reference in New Issue
Block a user