feat(domain,application,infrastructure,backend,web-server,app-tauri,frontend): lot utilisateur #325 #326 — icônes projet avec watermark CLI custom et localisation FR/EN (QA verte)

Lot en un seul commit: les deux features partagent les mêmes contrats
(domain/settings.rs, DTO, commandes Tauri/HTTP, web-server) et les mêmes
surfaces UI — la séparation par fichiers était impossible sans chirurgie
de hunks risquant des états intermédiaires non compilables (convention
lot des batches #310-#313 et #315).

#325 — icône configurable par projet, watermark CLI custom:
- domaine: ProjectIconSet (devicon, simple-icons, lucide, idea),
  ProjectIconRef validé (nom ASCII 1..=64, -_. internes), champ icon
  optionnel sur ProjectSettings; sérialisation camelCase et try_from
  strict
- application: UpdateProjectSettings.execute accepte un patch
  theme_color OU icon (absent = inchangé, null = défaut produit), tests
  in-dependants avec store mémoire
- backend/app-tauri/web-server: ProjectIconRefDto, UpdateProjectSettingsRequestDto
  avec icon optionnel (désérialisation additive), commandes
  update_project_settings alignées Tauri/HTTP, tests DTO et HTTP
  (défaut null, set, clear, nom invalide rejeté)
- frontend: catalogue projectIcons (recherche EN), ProjectIconPicker en
  grille multi-lignes dans Paramètres projet, affichage de l'icône dans
  ProjectTabs et watermark grand format à faible opacité en fond de CLI
  custom; ports ProjectSettings.icon, Partial<ProjectSettings>,
  adapters tauri/mock/http et tests alignés

#326 — localisation FR/EN et traduction des textes IdeA:
- domaine: IdeaLanguage (fr | en), champ language optionnel sur
  IdeaUserSettings (absence = défaut produit, série additive validée)
- backend/web-server: UserSettingsDto.language, update_user_settings
  accepte language, tests HTTP alignés; fixtures structured_launch_d3
  mises à jour
- frontend: i18n/ (catalogue FR/EN, I18nProvider, scan anti-régression
  des sources visibles), GeneralSettings avec sélecteur de langue dans
  les paramètres, setupI18n dans vitest; migration de l'ensemble des
  textes hardcodés vers le catalogue sur toutes les surfaces (agents,
  layout, projets, tickets, sprints, web, plugins, permissions, git,
  templates, skills, mémoire, model servers, embedder, first-run,
  devices, scheduled tasks, workstate, dialogs), FR conservé par défaut;
  recherche d'icônes #325 en anglais conformément au ticket

QA verte sur feature/batch-325-326-project-icons-localisation. Aucun push.
This commit is contained in:
2026-09-11 21:53:56 +02:00
parent cd744b5f18
commit 1a1429f10e
157 changed files with 4531 additions and 3129 deletions

View File

@ -879,9 +879,14 @@ pub async fn update_project_settings(
.map(|value| value.map(domain::ThemeColor::new).transpose())
.transpose()
.map_err(|message| ErrorDto::from(AppError::Invalid(message)))?;
let icon = request
.icon
.map(|value| value.map(domain::ProjectIconRef::try_from).transpose())
.transpose()
.map_err(|message| ErrorDto::from(AppError::Invalid(message)))?;
state
.update_project_settings
.execute(&project, theme_color)
.execute(&project, theme_color, icon)
.await
.map(Into::into)
.map_err(Into::into)

View File

@ -2,7 +2,8 @@
use crate::AppError;
use domain::{
IdeaUserSettings, Project, ProjectSettings, ProjectSettingsStore, ThemeColor, UserSettingsStore,
IdeaUserSettings, Project, ProjectIconRef, ProjectSettings, ProjectSettingsStore, ThemeColor,
UserSettingsStore,
};
use std::sync::Arc;
@ -64,18 +65,109 @@ impl UpdateProjectSettings {
}
/// Applies the supplied fields and returns the accepted project settings.
///
/// An absent outer option leaves the colour unchanged; an explicit inner
/// `None` restores the product fallback.
/// An absent outer option leaves a field unchanged; an explicit inner
/// `None` restores that field's product fallback.
pub async fn execute(
&self,
project: &Project,
theme_color: Option<Option<ThemeColor>>,
icon: Option<Option<ProjectIconRef>>,
) -> Result<ProjectSettings, AppError> {
let mut settings = self.store.load(&project.root).await?;
let mut changed = false;
if let Some(theme_color) = theme_color {
settings.theme_color = theme_color;
changed = true;
}
if let Some(icon) = icon {
settings.icon = icon;
changed = true;
}
if changed {
self.store.save(&project.root, &settings).await?;
}
Ok(settings)
}
}
#[cfg(test)]
mod tests {
use super::*;
use async_trait::async_trait;
use domain::{ProjectIconSet, ProjectPath, RemoteRef, StoreError};
use std::sync::Mutex;
struct MemoryProjectSettings(Mutex<ProjectSettings>);
#[async_trait]
impl ProjectSettingsStore for MemoryProjectSettings {
async fn load(&self, _root: &ProjectPath) -> Result<ProjectSettings, StoreError> {
Ok(self.0.lock().unwrap().clone())
}
async fn save(
&self,
_root: &ProjectPath,
settings: &ProjectSettings,
) -> Result<(), StoreError> {
*self.0.lock().unwrap() = settings.clone();
Ok(())
}
}
fn project() -> Project {
Project::new(
domain::ProjectId::new_random(),
"Settings",
ProjectPath::new("/settings-project").unwrap(),
RemoteRef::Local,
0,
)
.unwrap()
}
#[tokio::test]
async fn project_settings_patch_updates_fields_independently_and_supports_clear() {
let store = Arc::new(MemoryProjectSettings(Mutex::new(ProjectSettings {
theme_color: Some(ThemeColor::new("#123456").unwrap()),
icon: Some(ProjectIconRef::new(ProjectIconSet::Devicon, "rust").unwrap()),
})));
let update = UpdateProjectSettings::new(store);
let project = project();
let icon = ProjectIconRef::new(ProjectIconSet::Lucide, "star").unwrap();
let after_icon = update
.execute(&project, None, Some(Some(icon.clone())))
.await
.unwrap();
assert_eq!(
after_icon.theme_color.as_ref().map(ThemeColor::as_str),
Some("#123456")
);
assert_eq!(after_icon.icon, Some(icon));
let after_theme = update
.execute(
&project,
Some(Some(ThemeColor::new("#ABCDEF").unwrap())),
None,
)
.await
.unwrap();
assert_eq!(
after_theme.theme_color.as_ref().map(ThemeColor::as_str),
Some("#ABCDEF")
);
assert_eq!(
after_theme.icon.as_ref().map(ProjectIconRef::name),
Some("star")
);
let cleared = update.execute(&project, None, Some(None)).await.unwrap();
assert!(cleared.icon.is_none());
assert_eq!(
cleared.theme_color.as_ref().map(ThemeColor::as_str),
Some("#ABCDEF")
);
}
}

View File

@ -899,6 +899,7 @@ fn launch_fixture_with_preference(interface: DefaultAgentTerminalInterface) -> L
.expect("fixture owns its launcher")
.with_user_settings(Arc::new(FixedUserSettings(IdeaUserSettings {
default_agent_terminal_interface: Some(interface),
language: None,
})));
fixture.launch = Arc::new(launch);
fixture
@ -949,6 +950,7 @@ async fn changing_global_preference_does_not_replace_an_existing_terminal() {
settings
.save(&IdeaUserSettings {
default_agent_terminal_interface: Some(DefaultAgentTerminalInterface::IdeaCli),
language: None,
})
.await
.unwrap();

View File

@ -3266,12 +3266,16 @@ pub struct UserSettingsDto {
/// Default interface for newly opened agent terminals.
#[serde(default)]
pub default_agent_terminal_interface: Option<domain::DefaultAgentTerminalInterface>,
/// Preferred interface language. Absence preserves the product default.
#[serde(default)]
pub language: Option<domain::IdeaLanguage>,
}
impl From<domain::IdeaUserSettings> for UserSettingsDto {
fn from(value: domain::IdeaUserSettings) -> Self {
Self {
default_agent_terminal_interface: value.default_agent_terminal_interface,
language: value.language,
}
}
}
@ -3280,10 +3284,38 @@ impl From<UserSettingsDto> for domain::IdeaUserSettings {
fn from(value: UserSettingsDto) -> Self {
Self {
default_agent_terminal_interface: value.default_agent_terminal_interface,
language: value.language,
}
}
}
/// Validated project icon wire reference.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ProjectIconRefDto {
/// Known icon catalogue.
pub set: domain::ProjectIconSet,
/// Stable icon name within the catalogue.
pub name: String,
}
impl From<domain::ProjectIconRef> for ProjectIconRefDto {
fn from(value: domain::ProjectIconRef) -> Self {
Self {
set: value.set(),
name: value.name().to_owned(),
}
}
}
impl TryFrom<ProjectIconRefDto> for domain::ProjectIconRef {
type Error = String;
fn try_from(value: ProjectIconRefDto) -> Result<Self, Self::Error> {
Self::new(value.set, value.name)
}
}
/// Project-owned settings wire contract.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
@ -3291,12 +3323,16 @@ pub struct ProjectSettingsDto {
/// Optional validated project theme colour.
#[serde(default)]
pub theme_color: Option<String>,
/// Optional validated project icon.
#[serde(default)]
pub icon: Option<ProjectIconRefDto>,
}
impl From<domain::ProjectSettings> for ProjectSettingsDto {
fn from(value: domain::ProjectSettings) -> Self {
Self {
theme_color: value.theme_color.map(|color| color.as_str().to_owned()),
icon: value.icon.map(Into::into),
}
}
}
@ -3308,6 +3344,8 @@ pub struct UpdateProjectSettingsRequestDto {
pub project_id: String,
/// Missing leaves the colour unchanged; null restores the product default.
pub theme_color: Option<Option<String>>,
/// Missing leaves the icon unchanged; null restores the product default.
pub icon: Option<Option<ProjectIconRefDto>>,
}
impl<'de> Deserialize<'de> for UpdateProjectSettingsRequestDto {
@ -3323,9 +3361,12 @@ impl<'de> Deserialize<'de> for UpdateProjectSettingsRequestDto {
take_required_string(object, "projectId").map_err(serde::de::Error::custom)?;
let theme_color = take_optional_value::<String>(object, "themeColor")
.map_err(serde::de::Error::custom)?;
let icon = take_optional_value::<ProjectIconRefDto>(object, "icon")
.map_err(serde::de::Error::custom)?;
Ok(Self {
project_id,
theme_color,
icon,
})
}
}
@ -6257,6 +6298,52 @@ mod tests {
use serde_json::json;
use uuid::Uuid;
#[test]
fn settings_dtos_are_additive_and_validate_language_and_icon_contracts() {
let legacy_user: UserSettingsDto = serde_json::from_value(json!({})).unwrap();
assert_eq!(legacy_user.language, None);
let english: UserSettingsDto = serde_json::from_value(json!({ "language": "en" })).unwrap();
assert_eq!(english.language, Some(domain::IdeaLanguage::En));
assert!(serde_json::from_value::<UserSettingsDto>(json!({ "language": "de" })).is_err());
let project_id = Uuid::from_u128(325).to_string();
let absent: UpdateProjectSettingsRequestDto = serde_json::from_value(json!({
"projectId": project_id
}))
.unwrap();
assert!(absent.theme_color.is_none());
assert!(absent.icon.is_none());
let clear: UpdateProjectSettingsRequestDto = serde_json::from_value(json!({
"projectId": project_id,
"icon": null
}))
.unwrap();
assert_eq!(clear.icon, Some(None));
let set: UpdateProjectSettingsRequestDto = serde_json::from_value(json!({
"projectId": project_id,
"icon": { "set": "simple-icons", "name": "github" }
}))
.unwrap();
let icon: domain::ProjectIconRef = set.icon.unwrap().unwrap().try_into().unwrap();
assert_eq!(icon.set(), domain::ProjectIconSet::SimpleIcons);
assert_eq!(icon.name(), "github");
let invalid_name = ProjectIconRefDto {
set: domain::ProjectIconSet::Lucide,
name: "two words".to_owned(),
};
assert!(domain::ProjectIconRef::try_from(invalid_name).is_err());
assert!(
serde_json::from_value::<UpdateProjectSettingsRequestDto>(json!({
"projectId": project_id,
"icon": { "set": "font-awesome", "name": "star" }
}))
.is_err()
);
}
#[test]
fn slash_command_requests_accept_optional_project_scope() {
let project_id = Uuid::from_u128(321).to_string();

View File

@ -267,7 +267,10 @@ pub use scheduled_task::{
Weekday, MIN_SCHEDULE_INTERVAL_MINUTES,
};
pub use settings::{DefaultAgentTerminalInterface, IdeaUserSettings, ProjectSettings, ThemeColor};
pub use settings::{
DefaultAgentTerminalInterface, IdeaLanguage, IdeaUserSettings, ProjectIconRef, ProjectIconSet,
ProjectSettings, ThemeColor, MAX_PROJECT_ICON_NAME_LEN,
};
pub use orchestrator::{
OrchestratorCommand, OrchestratorError, OrchestratorRequest, OrchestratorVisibility,

View File

@ -12,6 +12,16 @@ pub enum DefaultAgentTerminalInterface {
IdeaCli,
}
/// User-selected IdeA interface language.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum IdeaLanguage {
/// French interface.
Fr,
/// English interface.
En,
}
/// Global, machine-local IdeA preferences.
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
@ -19,6 +29,83 @@ pub struct IdeaUserSettings {
/// Default for newly launched human-facing agent terminals.
#[serde(default)]
pub default_agent_terminal_interface: Option<DefaultAgentTerminalInterface>,
/// Preferred interface language. Absence preserves the product default.
#[serde(default)]
pub language: Option<IdeaLanguage>,
}
/// Supported icon catalogue for project visual identity.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum ProjectIconSet {
/// Devicon language and platform catalogue.
Devicon,
/// Simple Icons brand catalogue.
SimpleIcons,
/// Lucide general-purpose icon catalogue.
Lucide,
/// IdeA-owned built-in icons.
Idea,
}
/// Maximum byte length of a stable project icon name.
pub const MAX_PROJECT_ICON_NAME_LEN: usize = 64;
/// Validated reference to one icon in a known catalogue.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", try_from = "UncheckedProjectIconRef")]
pub struct ProjectIconRef {
set: ProjectIconSet,
name: String,
}
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
struct UncheckedProjectIconRef {
set: ProjectIconSet,
name: String,
}
impl ProjectIconRef {
/// Builds a validated stable icon reference.
pub fn new(set: ProjectIconSet, name: impl Into<String>) -> Result<Self, String> {
let name = name.into();
let bytes = name.as_bytes();
let valid_name = !name.is_empty()
&& name.len() <= MAX_PROJECT_ICON_NAME_LEN
&& bytes.first().is_some_and(u8::is_ascii_alphanumeric)
&& bytes.last().is_some_and(u8::is_ascii_alphanumeric)
&& bytes
.iter()
.copied()
.all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'-' | b'_' | b'.'));
if !valid_name {
return Err(format!(
"project icon name must be 1..={MAX_PROJECT_ICON_NAME_LEN} ASCII letters, digits, '-', '_' or '.', starting and ending with a letter or digit"
));
}
Ok(Self { set, name })
}
/// Returns the owning icon catalogue.
#[must_use]
pub const fn set(&self) -> ProjectIconSet {
self.set
}
/// Returns the stable catalogue icon name.
#[must_use]
pub fn name(&self) -> &str {
&self.name
}
}
impl TryFrom<UncheckedProjectIconRef> for ProjectIconRef {
type Error = String;
fn try_from(value: UncheckedProjectIconRef) -> Result<Self, Self::Error> {
Self::new(value.set, value.name)
}
}
/// Strict project theme colour (`#RRGGBB`).
@ -66,4 +153,7 @@ pub struct ProjectSettings {
/// Optional visual theme colour; absence keeps the product fallback.
#[serde(default)]
pub theme_color: Option<ThemeColor>,
/// Optional validated icon used as the project's visual identity.
#[serde(default)]
pub icon: Option<ProjectIconRef>,
}

View File

@ -0,0 +1,93 @@
use domain::{
DefaultAgentTerminalInterface, IdeaLanguage, IdeaUserSettings, ProjectIconRef, ProjectIconSet,
ProjectSettings, ThemeColor, MAX_PROJECT_ICON_NAME_LEN,
};
#[test]
fn legacy_settings_documents_keep_additive_defaults() {
let user: IdeaUserSettings =
serde_json::from_str(r#"{"defaultAgentTerminalInterface":"ideaCli"}"#).unwrap();
assert_eq!(
user.default_agent_terminal_interface,
Some(DefaultAgentTerminalInterface::IdeaCli)
);
assert_eq!(user.language, None);
let project: ProjectSettings = serde_json::from_str(r##"{"themeColor":"#123ABC"}"##).unwrap();
assert_eq!(
project.theme_color.as_ref().map(ThemeColor::as_str),
Some("#123ABC")
);
assert_eq!(project.icon, None);
}
#[test]
fn language_roundtrips_as_stable_codes_and_rejects_unknown_values() {
for (language, wire) in [(IdeaLanguage::Fr, "fr"), (IdeaLanguage::En, "en")] {
let settings = IdeaUserSettings {
default_agent_terminal_interface: None,
language: Some(language),
};
let json = serde_json::to_string(&settings).unwrap();
assert_eq!(
serde_json::from_str::<serde_json::Value>(&json).unwrap()["language"],
wire
);
assert_eq!(
serde_json::from_str::<IdeaUserSettings>(&json).unwrap(),
settings
);
}
assert!(serde_json::from_str::<IdeaUserSettings>(r#"{"language":"de"}"#).is_err());
}
#[test]
fn project_icon_roundtrips_for_every_known_set() {
for (set, wire) in [
(ProjectIconSet::Devicon, "devicon"),
(ProjectIconSet::SimpleIcons, "simple-icons"),
(ProjectIconSet::Lucide, "lucide"),
(ProjectIconSet::Idea, "idea"),
] {
let settings = ProjectSettings {
theme_color: None,
icon: Some(ProjectIconRef::new(set, "arrow-up.circle_2").unwrap()),
};
let value = serde_json::to_value(&settings).unwrap();
assert_eq!(value["icon"]["set"], wire);
assert_eq!(value["icon"]["name"], "arrow-up.circle_2");
assert_eq!(
serde_json::from_value::<ProjectSettings>(value).unwrap(),
settings
);
}
}
#[test]
fn project_icon_rejects_unknown_sets_and_unstable_or_oversized_names() {
assert!(
serde_json::from_str::<ProjectIconRef>(r#"{"set":"font-awesome","name":"star"}"#).is_err()
);
for invalid in [
"",
" leading",
"two words",
"étoile",
"slash/name",
".",
"-star",
"star-",
] {
assert!(
ProjectIconRef::new(ProjectIconSet::Lucide, invalid).is_err(),
"accepted {invalid:?}"
);
}
assert!(ProjectIconRef::new(
ProjectIconSet::Idea,
"x".repeat(MAX_PROJECT_ICON_NAME_LEN + 1)
)
.is_err());
}

View File

@ -2,8 +2,9 @@ use std::path::PathBuf;
use std::sync::Arc;
use domain::{
DefaultAgentTerminalInterface, FileSystem, IdeaUserSettings, ProjectPath, ProjectSettings,
ProjectSettingsStore, ThemeColor, UserSettingsStore,
DefaultAgentTerminalInterface, FileSystem, IdeaLanguage, IdeaUserSettings, ProjectIconRef,
ProjectIconSet, ProjectPath, ProjectSettings, ProjectSettingsStore, ThemeColor,
UserSettingsStore,
};
use infrastructure::{FsProjectSettingsStore, FsUserSettingsStore, LocalFileSystem};
use uuid::Uuid;
@ -35,6 +36,7 @@ async fn global_user_preference_persists_outside_project() {
assert_eq!(store.load().await.unwrap(), IdeaUserSettings::default());
let settings = IdeaUserSettings {
default_agent_terminal_interface: Some(DefaultAgentTerminalInterface::IdeaCli),
language: Some(IdeaLanguage::En),
};
store.save(&settings).await.unwrap();
assert_eq!(
@ -59,12 +61,13 @@ async fn project_settings_missing_then_valid_round_trip() {
assert!(!tmp.0.join(".ideai/project-settings.json").exists());
let settings = ProjectSettings {
theme_color: Some(ThemeColor::new("#12AbEF").unwrap()),
icon: Some(ProjectIconRef::new(ProjectIconSet::Devicon, "cplusplus").unwrap()),
};
store.save(&tmp.root(), &settings).await.unwrap();
assert_eq!(store.load(&tmp.root()).await.unwrap(), settings);
assert_eq!(
std::fs::read_to_string(tmp.0.join(".ideai/project-settings.json")).unwrap(),
"{\n \"themeColor\": \"#12AbEF\"\n}\n"
"{\n \"themeColor\": \"#12AbEF\",\n \"icon\": {\n \"set\": \"devicon\",\n \"name\": \"cplusplus\"\n }\n}\n"
);
assert!(!tmp.0.join(".ideai/CONTEXT.md").exists());
}
@ -73,6 +76,7 @@ async fn project_settings_missing_then_valid_round_trip() {
async fn project_settings_are_isolated_and_missing_defaults_are_not_persisted() {
let first = TempDir::new();
let second = TempDir::new();
let third = TempDir::new();
let store = FsProjectSettingsStore::new(fs());
store
@ -80,16 +84,32 @@ async fn project_settings_are_isolated_and_missing_defaults_are_not_persisted()
&first.root(),
&ProjectSettings {
theme_color: Some(ThemeColor::new("#AA3366").unwrap()),
icon: Some(ProjectIconRef::new(ProjectIconSet::Devicon, "rust").unwrap()),
},
)
.await
.unwrap();
store
.save(
&second.root(),
&ProjectSettings {
theme_color: None,
icon: Some(ProjectIconRef::new(ProjectIconSet::SimpleIcons, "docker").unwrap()),
},
)
.await
.unwrap();
let second_settings = store.load(&second.root()).await.unwrap();
assert_eq!(second_settings.theme_color, None);
assert_eq!(
store.load(&second.root()).await.unwrap(),
ProjectSettings::default()
second_settings.icon.as_ref().map(ProjectIconRef::set),
Some(ProjectIconSet::SimpleIcons)
);
assert_eq!(
second_settings.icon.as_ref().map(ProjectIconRef::name),
Some("docker")
);
assert!(!second.0.join(".ideai/project-settings.json").exists());
assert_eq!(
store
.load(&first.root())
@ -100,6 +120,14 @@ async fn project_settings_are_isolated_and_missing_defaults_are_not_persisted()
.map(ThemeColor::as_str),
Some("#AA3366")
);
let first_icon = store.load(&first.root()).await.unwrap().icon.unwrap();
assert_eq!(first_icon.set(), ProjectIconSet::Devicon);
assert_eq!(first_icon.name(), "rust");
assert_eq!(
store.load(&third.root()).await.unwrap(),
ProjectSettings::default()
);
assert!(!third.0.join(".ideai/project-settings.json").exists());
}
#[test]

View File

@ -3931,9 +3931,14 @@ async fn invoke_update_project_settings(
.map(|value| value.map(domain::ThemeColor::new).transpose())
.transpose()
.map_err(|message| ErrorDto::from(AppError::Invalid(message)))?;
let icon = request
.icon
.map(|value| value.map(domain::ProjectIconRef::try_from).transpose())
.transpose()
.map_err(|message| ErrorDto::from(AppError::Invalid(message)))?;
let output: ProjectSettingsDto = state
.update_project_settings
.execute(&project, theme_color)
.execute(&project, theme_color, icon)
.await
.map_err(ErrorDto::from)?
.into();
@ -10630,16 +10635,18 @@ mod tests {
.await;
assert_eq!(status, StatusCode::OK);
assert_eq!(initial_user["defaultAgentTerminalInterface"], Value::Null);
assert_eq!(initial_user["language"], Value::Null);
let (status, saved_user) = invoke_request_for_test(
Arc::clone(&state),
&cookie,
"update_user_settings",
json!({ "request": { "defaultAgentTerminalInterface": "ideaCli" } }),
json!({ "request": { "defaultAgentTerminalInterface": "ideaCli", "language": "en" } }),
)
.await;
assert_eq!(status, StatusCode::OK);
assert_eq!(saved_user["defaultAgentTerminalInterface"], "ideaCli");
assert_eq!(saved_user["language"], "en");
let (status, initial_project) = invoke_request_for_test(
Arc::clone(&state),
@ -10650,16 +10657,25 @@ mod tests {
.await;
assert_eq!(status, StatusCode::OK);
assert_eq!(initial_project["themeColor"], Value::Null);
assert_eq!(initial_project["icon"], Value::Null);
let (status, saved_project) = invoke_request_for_test(
Arc::clone(&state),
&cookie,
"update_project_settings",
json!({ "request": { "projectId": project_id, "themeColor": "#AA3366" } }),
json!({
"request": {
"projectId": project_id,
"themeColor": "#AA3366",
"icon": { "set": "devicon", "name": "rust" }
}
}),
)
.await;
assert_eq!(status, StatusCode::OK);
assert_eq!(saved_project["themeColor"], "#AA3366");
assert_eq!(saved_project["icon"]["set"], "devicon");
assert_eq!(saved_project["icon"]["name"], "rust");
let (status, unchanged_project) = invoke_request_for_test(
Arc::clone(&state),
@ -10670,6 +10686,7 @@ mod tests {
.await;
assert_eq!(status, StatusCode::OK);
assert_eq!(unchanged_project["themeColor"], "#AA3366");
assert_eq!(unchanged_project["icon"]["name"], "rust");
let (status, reset_project) = invoke_request_for_test(
Arc::clone(&state),
@ -10680,6 +10697,18 @@ mod tests {
.await;
assert_eq!(status, StatusCode::OK);
assert_eq!(reset_project["themeColor"], Value::Null);
assert_eq!(reset_project["icon"]["name"], "rust");
let (status, cleared_icon) = invoke_request_for_test(
state,
&cookie,
"update_project_settings",
json!({ "request": { "projectId": project_id, "icon": null } }),
)
.await;
assert_eq!(status, StatusCode::OK);
assert_eq!(cleared_icon["themeColor"], Value::Null);
assert_eq!(cleared_icon["icon"], Value::Null);
}
#[tokio::test]