From 4f26f14e56e50833c3bab4a9f5ac8d5e323b2f10 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 6 Sep 2026 14:52:50 +0100 Subject: [PATCH 01/30] postit: unify action status bar with severity across settings/activities/circles/rdv --- src/PostIt/PostIt/Controls/StatusBar.axaml | 22 +++++++ src/PostIt/PostIt/Controls/StatusBar.axaml.cs | 11 ++++ .../ViewModels/ActivitiesPageViewModel.cs | 8 +++ .../PostIt/ViewModels/CirclesPageViewModel.cs | 8 +++ .../Commands/BillingCommandPageViewModel.cs | 8 +++ .../PostIt/ViewModels/Settings/Settings.cs | 18 ++++++ src/PostIt/PostIt/ViewModels/StatusNotice.cs | 58 +++++++++++++++++++ src/PostIt/PostIt/Views/ActivitiesPage.axaml | 13 +---- src/PostIt/PostIt/Views/CirclesPage.axaml | 5 +- .../PostIt/Views/Commands/RdvPage.axaml | 13 +---- src/PostIt/PostIt/Views/SettingsPage.axaml | 5 +- src/PostIt/PostIt/Views/SettingsPage.axaml.cs | 30 +++++----- 12 files changed, 159 insertions(+), 40 deletions(-) create mode 100644 src/PostIt/PostIt/Controls/StatusBar.axaml create mode 100644 src/PostIt/PostIt/Controls/StatusBar.axaml.cs create mode 100644 src/PostIt/PostIt/ViewModels/StatusNotice.cs diff --git a/src/PostIt/PostIt/Controls/StatusBar.axaml b/src/PostIt/PostIt/Controls/StatusBar.axaml new file mode 100644 index 000000000..eaa6f5a09 --- /dev/null +++ b/src/PostIt/PostIt/Controls/StatusBar.axaml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/src/PostIt/PostIt/Controls/StatusBar.axaml.cs b/src/PostIt/PostIt/Controls/StatusBar.axaml.cs new file mode 100644 index 000000000..975f9b2f9 --- /dev/null +++ b/src/PostIt/PostIt/Controls/StatusBar.axaml.cs @@ -0,0 +1,11 @@ +using Avalonia.Controls; + +namespace PostIt.Controls; + +public partial class StatusBar : UserControl +{ + public StatusBar() + { + InitializeComponent(); + } +} diff --git a/src/PostIt/PostIt/ViewModels/ActivitiesPageViewModel.cs b/src/PostIt/PostIt/ViewModels/ActivitiesPageViewModel.cs index 2dc8938f3..801cf21d4 100644 --- a/src/PostIt/PostIt/ViewModels/ActivitiesPageViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/ActivitiesPageViewModel.cs @@ -43,6 +43,14 @@ public partial class ActivitiesPageViewModel : ViewModelBase [ObservableProperty] public partial string StatusMessage { get; set; } = "Choisissez une activité."; + [ObservableProperty] + public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Choisissez une activité."); + + partial void OnStatusMessageChanged(string value) + { + ActionStatus = StatusNotice.FromMessage(value); + } + public ActivityInfo? CurrentActivity => SelectedSpecialization ?? SelectedActivity; public string SelectedActivityLabel => SelectedActivity?.Name ?? "(aucune activité)"; public string CurrentActivityLabel => CurrentActivity?.Name ?? "(aucune)"; diff --git a/src/PostIt/PostIt/ViewModels/CirclesPageViewModel.cs b/src/PostIt/PostIt/ViewModels/CirclesPageViewModel.cs index 9cee3ea8c..6d70add1d 100644 --- a/src/PostIt/PostIt/ViewModels/CirclesPageViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/CirclesPageViewModel.cs @@ -65,6 +65,14 @@ public partial class CirclesPageViewModel : ViewModelBase [ObservableProperty] public partial string StatusMessage { get; set; } = string.Empty; + [ObservableProperty] + public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret."); + + partial void OnStatusMessageChanged(string value) + { + ActionStatus = StatusNotice.FromMessage(value); + } + public CirclesPageViewModel(CircleApiClient client) { diff --git a/src/PostIt/PostIt/ViewModels/Commands/BillingCommandPageViewModel.cs b/src/PostIt/PostIt/ViewModels/Commands/BillingCommandPageViewModel.cs index 0ab76291d..5fd7d8461 100644 --- a/src/PostIt/PostIt/ViewModels/Commands/BillingCommandPageViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/Commands/BillingCommandPageViewModel.cs @@ -23,6 +23,9 @@ public abstract partial class BillingCommandPageViewModel : RemoteViewModelBase [ObservableProperty] public partial string StatusMessage { get; set; } + [ObservableProperty] + public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret."); + [ObservableProperty] public partial string Reason { get; set; } = string.Empty; @@ -89,6 +92,11 @@ public abstract partial class BillingCommandPageViewModel : RemoteViewModelBase OnPropertyChanged(nameof(CanUseCurrentLocation)); } + partial void OnStatusMessageChanged(string value) + { + ActionStatus = StatusNotice.FromMessage(value); + } + public async Task InitializeAsync(BillingQueryDetailsDto? existingQuery = null) { await LoadAsync(); diff --git a/src/PostIt/PostIt/ViewModels/Settings/Settings.cs b/src/PostIt/PostIt/ViewModels/Settings/Settings.cs index e63f0b321..b59ef9933 100644 --- a/src/PostIt/PostIt/ViewModels/Settings/Settings.cs +++ b/src/PostIt/PostIt/ViewModels/Settings/Settings.cs @@ -31,6 +31,19 @@ public partial class Settings : ViewModelBase [ObservableProperty] public partial string SearchText { get; set; } = string.Empty; + [ObservableProperty] + public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret."); + + public void SetActionStatus(string message, StatusSeverity severity = StatusSeverity.Info) + { + ActionStatus = severity switch + { + StatusSeverity.Error => StatusNotice.Error(message), + StatusSeverity.Warning => StatusNotice.Warning(message), + _ => StatusNotice.Info(message), + }; + } + /// /// Catch top-level mutations: the four ObservableProperty /// setters above all funnel through here, and we flip @@ -406,6 +419,8 @@ public partial class Settings : ViewModelBase [RelayCommand(CanExecute = nameof(CanSave))] public void Save() { + SetActionStatus("Enregistrement des parametres...", StatusSeverity.Info); + var configDir = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "PostIt"); @@ -425,10 +440,13 @@ public partial class Settings : ViewModelBase File.SetUnixFileMode(configPath, UnixFileMode.UserRead | UnixFileMode.UserWrite); IsDirty = false; + SetActionStatus("Parametres sauvegardes.", StatusSeverity.Info); + Console.WriteLine($"💾 Settings saved to {configPath}"); } catch (Exception ex) { + SetActionStatus($"Echec sauvegarde parametres: {ex.Message}", StatusSeverity.Error); Console.Error.WriteLine($"🩎 Error saving settings to {configPath}: {ex.Message}"); throw; } diff --git a/src/PostIt/PostIt/ViewModels/StatusNotice.cs b/src/PostIt/PostIt/ViewModels/StatusNotice.cs new file mode 100644 index 000000000..2d14b28b3 --- /dev/null +++ b/src/PostIt/PostIt/ViewModels/StatusNotice.cs @@ -0,0 +1,58 @@ +namespace PostIt.ViewModels; + +public enum StatusSeverity +{ + Info, + Warning, + Error +} + +public sealed class StatusNotice +{ + public string Message { get; } + public StatusSeverity Severity { get; } + public string Glyph { get; } + public string Background { get; } + public string BorderBrush { get; } + public string Foreground { get; } + + private StatusNotice(string message, StatusSeverity severity) + { + Message = string.IsNullOrWhiteSpace(message) ? "Pret." : message; + Severity = severity; + + (Glyph, Background, BorderBrush, Foreground) = severity switch + { + StatusSeverity.Error => ("!", "#FDECEA", "#C62828", "#7F1D1D"), + StatusSeverity.Warning => ("~", "#FFF8E1", "#E6A700", "#7C4A03"), + _ => ("i", "#E8F0FE", "#5B8DEF", "#1E3A8A"), + }; + } + + public static StatusNotice Info(string message) => new(message, StatusSeverity.Info); + public static StatusNotice Warning(string message) => new(message, StatusSeverity.Warning); + public static StatusNotice Error(string message) => new(message, StatusSeverity.Error); + + public static StatusNotice FromMessage(string? message) + { + if (string.IsNullOrWhiteSpace(message)) + { + return Info("Pret."); + } + + var text = message.Trim(); + var lower = text.ToLowerInvariant(); + + if (lower.StartsWith("erreur") || lower.StartsWith("echec") || lower.StartsWith("impossible")) + { + return Error(text); + } + + if (lower.Contains("refuse") || lower.Contains("annule") || lower.Contains("obligatoire") || lower.Contains("deja")) + { + return Warning(text); + } + + return Info(text); + } +} diff --git a/src/PostIt/PostIt/Views/ActivitiesPage.axaml b/src/PostIt/PostIt/Views/ActivitiesPage.axaml index 16d883443..a34d8edf2 100644 --- a/src/PostIt/PostIt/Views/ActivitiesPage.axaml +++ b/src/PostIt/PostIt/Views/ActivitiesPage.axaml @@ -1,6 +1,7 @@ - + diff --git a/src/PostIt/PostIt/Views/CirclesPage.axaml b/src/PostIt/PostIt/Views/CirclesPage.axaml index 6fc2172ba..8488201e2 100644 --- a/src/PostIt/PostIt/Views/CirclesPage.axaml +++ b/src/PostIt/PostIt/Views/CirclesPage.axaml @@ -1,6 +1,7 @@ - + diff --git a/src/PostIt/PostIt/Views/Commands/RdvPage.axaml b/src/PostIt/PostIt/Views/Commands/RdvPage.axaml index 46280602b..4c88b0108 100644 --- a/src/PostIt/PostIt/Views/Commands/RdvPage.axaml +++ b/src/PostIt/PostIt/Views/Commands/RdvPage.axaml @@ -1,6 +1,7 @@ @@ -71,16 +72,8 @@ Content="{Binding SubmitLabel}" Command="{Binding SubmitCommand}" IsEnabled="{Binding IsSupported}" /> - + - + public AddCircleMemberDialogViewModel? ViewModel => DataContext as AddCircleMemberDialogViewModel; - - private async Task OnCloseClicked(object? sender, RoutedEventArgs e) - { - App app = App.Current! as App; - await app!.GoBackAsync(); - } } From 37d6551a23ff4f265dec87a3a80789f25a399b9d Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 6 Sep 2026 15:45:24 +0100 Subject: [PATCH 04/30] postit: replace inferred status severity with explicit setters --- .../ActionStatusViewModelExtensions.cs | 32 +++++++++++++ .../ViewModels/ActivitiesPageViewModel.cs | 29 +++++------- .../AddCircleMemberDialogViewModel.cs | 19 +++----- .../ViewModels/BillingQueriesPageViewModel.cs | 23 ++++------ .../PostIt/ViewModels/CirclesPageViewModel.cs | 46 ++++++++----------- .../ViewModels/CommandFormsPageViewModel.cs | 25 +++++----- .../Commands/BillingCommandPageViewModel.cs | 11 ++--- .../ViewModels/Commands/BrushViewModel.cs | 26 ++++++----- .../ViewModels/Commands/MBrushViewModel.cs | 14 +++--- .../ViewModels/Commands/RdvViewModel.cs | 28 +++++------ src/PostIt/PostIt/ViewModels/MainViewModel.cs | 35 ++++++-------- .../ViewModels/PostAclDialogViewModel.cs | 31 ++++++------- .../ViewModels/SignaturePageViewModel.cs | 21 ++++----- src/PostIt/PostIt/ViewModels/StatusNotice.cs | 23 ---------- 14 files changed, 165 insertions(+), 198 deletions(-) create mode 100644 src/PostIt/PostIt/ViewModels/ActionStatusViewModelExtensions.cs diff --git a/src/PostIt/PostIt/ViewModels/ActionStatusViewModelExtensions.cs b/src/PostIt/PostIt/ViewModels/ActionStatusViewModelExtensions.cs new file mode 100644 index 000000000..614d477c8 --- /dev/null +++ b/src/PostIt/PostIt/ViewModels/ActionStatusViewModelExtensions.cs @@ -0,0 +1,32 @@ +namespace PostIt.ViewModels; + +public interface IActionStatusViewModel +{ + string StatusMessage { get; set; } + StatusNotice ActionStatus { get; set; } +} + +public static class ActionStatusViewModelExtensions +{ + public static void SetInfoStatus(this IActionStatusViewModel viewModel, string message) + => viewModel.SetStatus(message, StatusSeverity.Info); + + public static void SetWarningStatus(this IActionStatusViewModel viewModel, string message) + => viewModel.SetStatus(message, StatusSeverity.Warning); + + public static void SetErrorStatus(this IActionStatusViewModel viewModel, string message) + => viewModel.SetStatus(message, StatusSeverity.Error); + + public static void SetStatus(this IActionStatusViewModel viewModel, string message, StatusSeverity severity) + { + var normalizedMessage = string.IsNullOrWhiteSpace(message) ? "Pret." : message.Trim(); + + viewModel.StatusMessage = normalizedMessage; + viewModel.ActionStatus = severity switch + { + StatusSeverity.Error => StatusNotice.Error(normalizedMessage), + StatusSeverity.Warning => StatusNotice.Warning(normalizedMessage), + _ => StatusNotice.Info(normalizedMessage), + }; + } +} \ No newline at end of file diff --git a/src/PostIt/PostIt/ViewModels/ActivitiesPageViewModel.cs b/src/PostIt/PostIt/ViewModels/ActivitiesPageViewModel.cs index 801cf21d4..bd13faf9b 100644 --- a/src/PostIt/PostIt/ViewModels/ActivitiesPageViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/ActivitiesPageViewModel.cs @@ -13,7 +13,7 @@ using Yavsc.Api.Client; namespace PostIt.ViewModels; -public partial class ActivitiesPageViewModel : ViewModelBase +public partial class ActivitiesPageViewModel : ViewModelBase, IActionStatusViewModel { private readonly ActivityApiClient _client; private readonly BillingApiClient _billingClient; @@ -46,11 +46,6 @@ public partial class ActivitiesPageViewModel : ViewModelBase [ObservableProperty] public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Choisissez une activité."); - partial void OnStatusMessageChanged(string value) - { - ActionStatus = StatusNotice.FromMessage(value); - } - public ActivityInfo? CurrentActivity => SelectedSpecialization ?? SelectedActivity; public string SelectedActivityLabel => SelectedActivity?.Name ?? "(aucune activité)"; public string CurrentActivityLabel => CurrentActivity?.Name ?? "(aucune)"; @@ -94,11 +89,11 @@ public partial class ActivitiesPageViewModel : ViewModelBase } catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden) { - StatusMessage = "Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous."; + this.SetWarningStatus("Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous."); } catch (Exception ex) { - StatusMessage = $"Erreur: {ex.Message}"; + this.SetErrorStatus($"Erreur: {ex.Message}"); } } @@ -110,11 +105,11 @@ public partial class ActivitiesPageViewModel : ViewModelBase } catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden) { - StatusMessage = "Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous."; + this.SetWarningStatus("Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous."); } catch (Exception ex) { - StatusMessage = $"Erreur: {ex.Message}"; + this.SetErrorStatus($"Erreur: {ex.Message}"); } } @@ -131,7 +126,7 @@ public partial class ActivitiesPageViewModel : ViewModelBase await ShowActivityAsync(first); if (first is null) { - StatusMessage = "Aucune activité disponible."; + this.SetInfoStatus("Aucune activité disponible."); } } catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden) @@ -139,14 +134,14 @@ public partial class ActivitiesPageViewModel : ViewModelBase Activities = new ObservableCollection(); Specializations = new ObservableCollection(); Performers = new ObservableCollection(); - StatusMessage = "Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous."; + this.SetWarningStatus("Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous."); } catch (Exception ex) { Activities = new ObservableCollection(); Specializations = new ObservableCollection(); Performers = new ObservableCollection(); - StatusMessage = $"Erreur: {ex.Message}"; + this.SetErrorStatus($"Erreur: {ex.Message}"); } finally { @@ -238,19 +233,19 @@ public partial class ActivitiesPageViewModel : ViewModelBase Performers = new ObservableCollection(items); SelectedPerformer = null; - StatusMessage = $"{activity.Name} · {Performers.Count} utilisateur(s)"; + this.SetInfoStatus($"{activity.Name} · {Performers.Count} utilisateur(s)"); } catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden) { Performers = new ObservableCollection(); SelectedPerformer = null; - StatusMessage = "Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous."; + this.SetWarningStatus("Accès refusé pour les activités (scope 'api'). Déconnectez puis reconnectez-vous."); } catch (Exception ex) { Performers = new ObservableCollection(); SelectedPerformer = null; - StatusMessage = $"Erreur: {ex.Message}"; + this.SetErrorStatus($"Erreur: {ex.Message}"); } finally { @@ -267,7 +262,7 @@ public partial class ActivitiesPageViewModel : ViewModelBase { if (SelectedPerformer is null || CurrentActivity is null) { - StatusMessage = "Sélectionnez un utilisateur et une activité avec formulaire."; + this.SetWarningStatus("Sélectionnez un utilisateur et une activité avec formulaire."); return; } diff --git a/src/PostIt/PostIt/ViewModels/AddCircleMemberDialogViewModel.cs b/src/PostIt/PostIt/ViewModels/AddCircleMemberDialogViewModel.cs index d3f9deb68..635073d1a 100644 --- a/src/PostIt/PostIt/ViewModels/AddCircleMemberDialogViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/AddCircleMemberDialogViewModel.cs @@ -29,7 +29,7 @@ namespace PostIt.ViewModels; /// CirclesPage then calls /// . /// -public partial class AddCircleMemberDialogViewModel : ViewModelBase +public partial class AddCircleMemberDialogViewModel : ViewModelBase, IActionStatusViewModel { private readonly IUserDirectory _directory; @@ -46,15 +46,10 @@ public partial class AddCircleMemberDialogViewModel : ViewModelBase public partial bool IsBusy { get; set; } [ObservableProperty] - public partial string StatusMessage { get; set; } = string.Empty; + public partial string StatusMessage { get; set; } = "Pret."; [ObservableProperty] - public partial StatusNotice ActionStatus { get; set; } = StatusNotice.FromMessage(string.Empty); - - partial void OnStatusMessageChanged(string value) - { - ActionStatus = StatusNotice.FromMessage(value); - } + public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret."); /// /// Raised when the user confirms a selection. The hosting @@ -87,7 +82,7 @@ public partial class AddCircleMemberDialogViewModel : ViewModelBase if (string.IsNullOrWhiteSpace(SearchQuery)) { Results.Clear(); - StatusMessage = "Tapez un nom ou un email"; + this.SetWarningStatus("Tapez un nom ou un email"); return; } @@ -96,11 +91,11 @@ public partial class AddCircleMemberDialogViewModel : ViewModelBase { var hits = await _directory.SearchAsync(SearchQuery, CancellationToken.None).ConfigureAwait(true); Results = new ObservableCollection(hits ?? Array.Empty()); - StatusMessage = $"{Results.Count} résultat(s)"; + this.SetInfoStatus($"{Results.Count} résultat(s)"); } catch (Exception ex) { - StatusMessage = $"Erreur: {ex.Message}"; + this.SetErrorStatus($"Erreur: {ex.Message}"); } finally { @@ -118,7 +113,7 @@ public partial class AddCircleMemberDialogViewModel : ViewModelBase { if (Selected is null) { - StatusMessage = "Sélectionnez un utilisateur"; + this.SetWarningStatus("Sélectionnez un utilisateur"); return; } Confirmed?.Invoke(this, Selected); diff --git a/src/PostIt/PostIt/ViewModels/BillingQueriesPageViewModel.cs b/src/PostIt/PostIt/ViewModels/BillingQueriesPageViewModel.cs index 098cdc6f4..d3c097f43 100644 --- a/src/PostIt/PostIt/ViewModels/BillingQueriesPageViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/BillingQueriesPageViewModel.cs @@ -14,7 +14,7 @@ using Yavsc.Abstract.Workflow; namespace PostIt.ViewModels; -public partial class BillingQueriesPageViewModel : ViewModelBase +public partial class BillingQueriesPageViewModel : ViewModelBase, IActionStatusViewModel { private readonly BillingApiClient _billingClient; @@ -37,12 +37,7 @@ public partial class BillingQueriesPageViewModel : ViewModelBase public partial string StatusMessage { get; set; } = "Chargement des commandes..."; [ObservableProperty] - public partial StatusNotice ActionStatus { get; set; } = StatusNotice.FromMessage("Chargement des commandes..."); - - partial void OnStatusMessageChanged(string value) - { - ActionStatus = StatusNotice.FromMessage(value); - } + public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Chargement des commandes..."); public string Title => IsReadOnly ? $"Demandes en cours ({Form.Title})" @@ -98,17 +93,17 @@ public partial class BillingQueriesPageViewModel : ViewModelBase .ToList(); Queries = new ObservableCollection(filtered); - StatusMessage = BuildLoadedStatusMessage(filtered.Count); + this.SetInfoStatus(BuildLoadedStatusMessage(filtered.Count)); } catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden) { Queries = new ObservableCollection(); - StatusMessage = "Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous."; + this.SetWarningStatus("Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous."); } catch (Exception ex) { Queries = new ObservableCollection(); - StatusMessage = $"Erreur: {ex.Message}"; + this.SetErrorStatus($"Erreur: {ex.Message}"); } finally { @@ -121,13 +116,13 @@ public partial class BillingQueriesPageViewModel : ViewModelBase { if (IsReadOnly) { - StatusMessage = "Mode lecture seule: l'ouverture en modification est désactivée."; + this.SetWarningStatus("Mode lecture seule: l'ouverture en modification est désactivée."); return; } if (SelectedQuery is null) { - StatusMessage = "Sélectionnez une commande."; + this.SetWarningStatus("Sélectionnez une commande."); return; } @@ -147,11 +142,11 @@ public partial class BillingQueriesPageViewModel : ViewModelBase } catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden) { - StatusMessage = "Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous."; + this.SetWarningStatus("Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous."); } catch (Exception ex) { - StatusMessage = $"Erreur lors de l'ouverture: {ex.Message}"; + this.SetErrorStatus($"Erreur lors de l'ouverture: {ex.Message}"); } finally { diff --git a/src/PostIt/PostIt/ViewModels/CirclesPageViewModel.cs b/src/PostIt/PostIt/ViewModels/CirclesPageViewModel.cs index 73b87a181..cd068b4f4 100644 --- a/src/PostIt/PostIt/ViewModels/CirclesPageViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/CirclesPageViewModel.cs @@ -34,7 +34,7 @@ namespace PostIt.ViewModels; /// . The "remove" /// command is per-row and runs inline. /// -public partial class CirclesPageViewModel : ViewModelBase +public partial class CirclesPageViewModel : ViewModelBase, IActionStatusViewModel { private readonly CircleApiClient _client; @@ -63,17 +63,11 @@ public partial class CirclesPageViewModel : ViewModelBase public partial bool IsBusy { get; set; } [ObservableProperty] - public partial string StatusMessage { get; set; } = string.Empty; + public partial string StatusMessage { get; set; } = "Pret."; [ObservableProperty] public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret."); - partial void OnStatusMessageChanged(string value) - { - ActionStatus = StatusNotice.FromMessage(value); - } - - public CirclesPageViewModel(CircleApiClient client) { _client = client ?? throw new ArgumentNullException(nameof(client)); @@ -108,11 +102,11 @@ public partial class CirclesPageViewModel : ViewModelBase { var list = await _client.GetMyCirclesAsync(); Circles = new ObservableCollection(list ?? new()); - StatusMessage = $"{Circles.Count} cercle(s)"; + this.SetInfoStatus($"{Circles.Count} cercle(s)"); } catch (Exception ex) { - StatusMessage = $"Erreur: {ex.Message}"; + this.SetErrorStatus($"Erreur: {ex.Message}"); } finally { @@ -157,11 +151,11 @@ public partial class CirclesPageViewModel : ViewModelBase { var list = await _client.GetMembersAsync(circleId); Members = new ObservableCollection(list ?? new()); - StatusMessage = $"{Members.Count} membre(s)"; + this.SetInfoStatus($"{Members.Count} membre(s)"); } catch (Exception ex) { - StatusMessage = $"Erreur: {ex.Message}"; + this.SetErrorStatus($"Erreur: {ex.Message}"); Members = new ObservableCollection(); } finally @@ -176,7 +170,7 @@ public partial class CirclesPageViewModel : ViewModelBase SelectedCircle = null; DraftName = string.Empty; DraftPublic = false; - StatusMessage = "Nouveau cercle"; + this.SetInfoStatus("Nouveau cercle"); } [RelayCommand] @@ -186,7 +180,7 @@ public partial class CirclesPageViewModel : ViewModelBase SelectedCircle = circle; DraftName = circle.Name; DraftPublic = circle.Public; - StatusMessage = $"Édition de « {circle.Name} »"; + this.SetInfoStatus($"Édition de « {circle.Name} »"); } [RelayCommand] @@ -194,7 +188,7 @@ public partial class CirclesPageViewModel : ViewModelBase { if (string.IsNullOrWhiteSpace(DraftName)) { - StatusMessage = "Le nom est obligatoire"; + this.SetWarningStatus("Le nom est obligatoire"); return; } @@ -208,22 +202,22 @@ public partial class CirclesPageViewModel : ViewModelBase Name = DraftName.Trim(), Public = DraftPublic, }); - StatusMessage = created is null - ? "Création échouée" - : $"Cercle « {created.Name} » créé"; + this.SetStatus( + created is null ? "Création échouée" : $"Cercle « {created.Name} » créé", + created is null ? StatusSeverity.Warning : StatusSeverity.Info); } else { SelectedCircle.Name = DraftName.Trim(); SelectedCircle.Public = DraftPublic; await _client.UpdateCircleAsync(SelectedCircle.Id, SelectedCircle); - StatusMessage = $"Cercle « {SelectedCircle.Name} » mis à jour"; + this.SetInfoStatus($"Cercle « {SelectedCircle.Name} » mis à jour"); } await RefreshAsync(); } catch (Exception ex) { - StatusMessage = $"Erreur: {ex.Message}"; + this.SetErrorStatus($"Erreur: {ex.Message}"); } finally { @@ -239,7 +233,7 @@ public partial class CirclesPageViewModel : ViewModelBase try { await _client.DeleteCircleAsync(circle.Id); - StatusMessage = $"Cercle « {circle.Name} » supprimé"; + this.SetInfoStatus($"Cercle « {circle.Name} » supprimé"); // If the deleted circle was the selected one, // clear the selection so the Members view goes // empty too (the partial setter on @@ -250,7 +244,7 @@ public partial class CirclesPageViewModel : ViewModelBase } catch (Exception ex) { - StatusMessage = $"Erreur: {ex.Message}"; + this.SetErrorStatus($"Erreur: {ex.Message}"); } finally { @@ -271,7 +265,7 @@ public partial class CirclesPageViewModel : ViewModelBase try { await _client.AddMemberAsync(SelectedCircle.Id, picked.Id); - StatusMessage = $"« {picked.DisplayName} » ajouté au cercle"; + this.SetInfoStatus($"« {picked.DisplayName} » ajouté au cercle"); await LoadMembersAsync(SelectedCircle.Id); } catch (Exception ex) @@ -286,7 +280,7 @@ public partial class CirclesPageViewModel : ViewModelBase var msg = ex.Message.Contains("409") || ex.Message.Contains("Conflict") ? "Déjà membre du cercle" : $"Erreur: {ex.Message}"; - StatusMessage = msg; + this.SetStatus(msg, msg == "Déjà membre du cercle" ? StatusSeverity.Warning : StatusSeverity.Error); } finally { @@ -307,11 +301,11 @@ public partial class CirclesPageViewModel : ViewModelBase { await _client.RemoveMemberAsync(SelectedCircle.Id, member.Id); Members.Remove(member); - StatusMessage = $"« {member.UserName} » retiré du cercle"; + this.SetInfoStatus($"« {member.UserName} » retiré du cercle"); } catch (Exception ex) { - StatusMessage = $"Erreur: {ex.Message}"; + this.SetErrorStatus($"Erreur: {ex.Message}"); } finally { diff --git a/src/PostIt/PostIt/ViewModels/CommandFormsPageViewModel.cs b/src/PostIt/PostIt/ViewModels/CommandFormsPageViewModel.cs index fd4c9ec8d..533fbc380 100644 --- a/src/PostIt/PostIt/ViewModels/CommandFormsPageViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/CommandFormsPageViewModel.cs @@ -11,7 +11,7 @@ using Yavsc.Api.Client; namespace PostIt.ViewModels; -public partial class CommandFormsPageViewModel : ViewModelBase +public partial class CommandFormsPageViewModel : ViewModelBase, IActionStatusViewModel { private readonly BillingApiClient _billingClient; @@ -25,15 +25,10 @@ public partial class CommandFormsPageViewModel : ViewModelBase public partial CommandFormSummary? SelectedForm { get; set; } [ObservableProperty] - public partial string StatusMessage { get; set; } + public partial string StatusMessage { get; set; } = "Pret."; [ObservableProperty] - public partial StatusNotice ActionStatus { get; set; } = StatusNotice.FromMessage(string.Empty); - - partial void OnStatusMessageChanged(string value) - { - ActionStatus = StatusNotice.FromMessage(value); - } + public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret."); public string Title => $"Formulaires pour {Performer.UserName}"; public string ContextLabel => $"{Activity.Name} · {Forms.Count} formulaire(s)"; @@ -63,9 +58,11 @@ public partial class CommandFormsPageViewModel : ViewModelBase .OrderBy(f => f.Title) .ThenBy(f => f.ActionName)); SelectedForm = Forms.FirstOrDefault(); - StatusMessage = Forms.Count == 0 - ? "Aucun formulaire n'est disponible pour cette activité." - : "Choisissez le formulaire à utiliser."; + this.SetStatus( + Forms.Count == 0 + ? "Aucun formulaire n'est disponible pour cette activité." + : "Choisissez le formulaire à utiliser.", + Forms.Count == 0 ? StatusSeverity.Warning : StatusSeverity.Info); } private bool CanOpenSelectedForm() => SelectedForm is not null; @@ -79,7 +76,7 @@ public partial class CommandFormsPageViewModel : ViewModelBase { if (SelectedForm is null) { - StatusMessage = "Sélectionnez un formulaire."; + this.SetWarningStatus("Sélectionnez un formulaire."); return; } @@ -100,7 +97,7 @@ public partial class CommandFormsPageViewModel : ViewModelBase { if (SelectedForm is null) { - StatusMessage = "Sélectionnez un formulaire."; + this.SetWarningStatus("Sélectionnez un formulaire."); return; } @@ -120,7 +117,7 @@ public partial class CommandFormsPageViewModel : ViewModelBase { if (SelectedForm is null) { - StatusMessage = "Sélectionnez un formulaire."; + this.SetWarningStatus("Sélectionnez un formulaire."); return; } diff --git a/src/PostIt/PostIt/ViewModels/Commands/BillingCommandPageViewModel.cs b/src/PostIt/PostIt/ViewModels/Commands/BillingCommandPageViewModel.cs index 5fd7d8461..5ad2b08f4 100644 --- a/src/PostIt/PostIt/ViewModels/Commands/BillingCommandPageViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/Commands/BillingCommandPageViewModel.cs @@ -9,7 +9,7 @@ using Yavsc.Models.Billing; namespace PostIt.ViewModels; -public abstract partial class BillingCommandPageViewModel : RemoteViewModelBase +public abstract partial class BillingCommandPageViewModel : RemoteViewModelBase, IActionStatusViewModel { protected readonly BillingApiClient _billingClient; @@ -21,7 +21,7 @@ public abstract partial class BillingCommandPageViewModel : RemoteViewModelBase public partial bool IsBusy { get; set; } [ObservableProperty] - public partial string StatusMessage { get; set; } + public partial string StatusMessage { get; set; } = "Pret."; [ObservableProperty] public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret."); @@ -78,7 +78,7 @@ public abstract partial class BillingCommandPageViewModel : RemoteViewModelBase Form = form ?? throw new ArgumentNullException(nameof(form)); _billingClient = billingClient ?? throw new ArgumentNullException(nameof(billingClient)); - StatusMessage = SupportMessage; + this.SetInfoStatus(SupportMessage); } partial void OnExistingQueryIdChanged(long? value) @@ -92,11 +92,6 @@ public abstract partial class BillingCommandPageViewModel : RemoteViewModelBase OnPropertyChanged(nameof(CanUseCurrentLocation)); } - partial void OnStatusMessageChanged(string value) - { - ActionStatus = StatusNotice.FromMessage(value); - } - public async Task InitializeAsync(BillingQueryDetailsDto? existingQuery = null) { await LoadAsync(); diff --git a/src/PostIt/PostIt/ViewModels/Commands/BrushViewModel.cs b/src/PostIt/PostIt/ViewModels/Commands/BrushViewModel.cs index d49fde803..72d9ce8ea 100644 --- a/src/PostIt/PostIt/ViewModels/Commands/BrushViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/Commands/BrushViewModel.cs @@ -58,18 +58,20 @@ public partial class BrushViewModel : RdvViewModel SelectedPrestation = AvailablePrestations.FirstOrDefault(); } - StatusMessage = AvailablePrestations.Count == 0 - ? "Aucune prestation coiffure disponible." - : SupportMessage; + this.SetStatus( + AvailablePrestations.Count == 0 + ? "Aucune prestation coiffure disponible." + : SupportMessage, + AvailablePrestations.Count == 0 ? StatusSeverity.Warning : StatusSeverity.Info); } catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden) { - StatusMessage = "Accès refusé au catalogue de prestations (scope 'api'). Déconnectez puis reconnectez-vous."; + this.SetWarningStatus("Accès refusé au catalogue de prestations (scope 'api'). Déconnectez puis reconnectez-vous."); } catch (Exception ex) { - StatusMessage = $"Erreur lors du chargement des prestations: {ex.Message}"; + this.SetErrorStatus($"Erreur lors du chargement des prestations: {ex.Message}"); } finally { @@ -81,19 +83,19 @@ public partial class BrushViewModel : RdvViewModel { if (!Consent) { - StatusMessage = "Le consentement est requis pour poster la commande."; + this.SetWarningStatus("Le consentement est requis pour poster la commande."); return; } if (string.IsNullOrWhiteSpace(Address)) { - StatusMessage = "L'adresse du rendez-vous est requise."; + this.SetWarningStatus("L'adresse du rendez-vous est requise."); return; } if (SelectedPrestation is null) { - StatusMessage = "Sélectionnez une prestation coiffure."; + this.SetWarningStatus("Sélectionnez une prestation coiffure."); return; } @@ -143,18 +145,18 @@ public partial class BrushViewModel : RdvViewModel }).ConfigureAwait(true); } - StatusMessage = IsEditingExisting + this.SetInfoStatus(IsEditingExisting ? $"Commande #{ExistingQueryId} mise à jour sur {BillingRoute} pour {Performer.UserName}." - : $"Commande transmise sur {BillingRoute} pour {Performer.UserName}."; + : $"Commande transmise sur {BillingRoute} pour {Performer.UserName}."); } catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden) { - StatusMessage = "Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous."; + this.SetWarningStatus("Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous."); } catch (Exception ex) { - StatusMessage = $"Erreur lors de l'envoi de la commande: {ex.Message}"; + this.SetErrorStatus($"Erreur lors de l'envoi de la commande: {ex.Message}"); } finally { diff --git a/src/PostIt/PostIt/ViewModels/Commands/MBrushViewModel.cs b/src/PostIt/PostIt/ViewModels/Commands/MBrushViewModel.cs index 793a77516..05481c2c3 100644 --- a/src/PostIt/PostIt/ViewModels/Commands/MBrushViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/Commands/MBrushViewModel.cs @@ -49,20 +49,20 @@ public partial class MBrushViewModel : BrushViewModel { if (!Consent) { - StatusMessage = "Le consentement est requis pour poster la commande."; + this.SetWarningStatus("Le consentement est requis pour poster la commande."); return; } if (string.IsNullOrWhiteSpace(Address)) { - StatusMessage = "L'adresse du rendez-vous est requise."; + this.SetWarningStatus("L'adresse du rendez-vous est requise."); return; } var selectedPrestations = MultiPrestations.Where(x => x.IsSelected).ToList(); if (selectedPrestations.Count == 0) { - StatusMessage = "Sélectionnez au moins une prestation coiffure."; + this.SetWarningStatus("Sélectionnez au moins une prestation coiffure."); return; } @@ -109,18 +109,18 @@ public partial class MBrushViewModel : BrushViewModel }).ConfigureAwait(true); } - StatusMessage = IsEditingExisting + this.SetInfoStatus(IsEditingExisting ? $"Commande #{ExistingQueryId} mise à jour sur {BillingRoute} pour {Performer.UserName}." - : $"Commande transmise sur {BillingRoute} pour {Performer.UserName}."; + : $"Commande transmise sur {BillingRoute} pour {Performer.UserName}."); } catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden) { - StatusMessage = "Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous."; + this.SetWarningStatus("Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous."); } catch (Exception ex) { - StatusMessage = $"Erreur lors de l'envoi de la commande: {ex.Message}"; + this.SetErrorStatus($"Erreur lors de l'envoi de la commande: {ex.Message}"); } finally { diff --git a/src/PostIt/PostIt/ViewModels/Commands/RdvViewModel.cs b/src/PostIt/PostIt/ViewModels/Commands/RdvViewModel.cs index c2ff3294e..afd0c54bd 100644 --- a/src/PostIt/PostIt/ViewModels/Commands/RdvViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/Commands/RdvViewModel.cs @@ -54,7 +54,7 @@ public partial class RdvViewModel : BillingCommandPageViewModel Longitude = existingQuery.Location.Longitude; } - StatusMessage = $"Commande #{existingQuery.Id} chargée."; + this.SetInfoStatus($"Commande #{existingQuery.Id} chargée."); } [RelayCommand(CanExecute = nameof(CanUseCurrentLocation))] @@ -71,23 +71,23 @@ public partial class RdvViewModel : BillingCommandPageViewModel var result = await Platform.TryGetCurrentLocationAsync(default).ConfigureAwait(true); if (!result.IsSuccess || !result.Latitude.HasValue || !result.Longitude.HasValue) { - StatusMessage = result.Message; + this.SetWarningStatus(result.Message); return; } Latitude = result.Latitude.Value; Longitude = result.Longitude.Value; - StatusMessage = string.IsNullOrWhiteSpace(Address) + this.SetInfoStatus(string.IsNullOrWhiteSpace(Address) ? "Position récupérée. Complétez l'adresse puis envoyez la commande." - : result.Message; + : result.Message); } catch (OperationCanceledException) { - StatusMessage = "La récupération de la position a été annulée."; + this.SetWarningStatus("La récupération de la position a été annulée."); } catch (Exception ex) { - StatusMessage = $"Impossible de récupérer la position: {ex.Message}"; + this.SetErrorStatus($"Impossible de récupérer la position: {ex.Message}"); } finally { @@ -118,26 +118,26 @@ public partial class RdvViewModel : BillingCommandPageViewModel { if (!IsSupported) { - StatusMessage = SupportMessage; + this.SetWarningStatus(SupportMessage); return; } if (!Consent) { - StatusMessage = "Le consentement est requis pour poster la commande."; + this.SetWarningStatus("Le consentement est requis pour poster la commande."); return; } if (string.IsNullOrWhiteSpace(Address)) { - StatusMessage = "L'adresse du rendez-vous est requise."; + this.SetWarningStatus("L'adresse du rendez-vous est requise."); return; } if (string.IsNullOrWhiteSpace(Reason)) { - StatusMessage = "Le motif du rendez-vous est requis."; + this.SetWarningStatus("Le motif du rendez-vous est requis."); return; } @@ -186,17 +186,17 @@ public partial class RdvViewModel : BillingCommandPageViewModel }).ConfigureAwait(true); } - StatusMessage = IsEditingExisting + this.SetInfoStatus(IsEditingExisting ? $"Commande #{ExistingQueryId} mise à jour sur {BillingRoute} pour {Performer.UserName}." - : $"Commande transmise sur {BillingRoute} pour {Performer.UserName}."; + : $"Commande transmise sur {BillingRoute} pour {Performer.UserName}."); } catch (HttpRequestException ex) when (ex.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden) { - StatusMessage = "Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous."; + this.SetWarningStatus("Accès refusé au billing (scope 'api'). Déconnectez puis reconnectez-vous."); } catch (Exception ex) { - StatusMessage = $"Erreur lors de l'envoi: {ex.Message}"; + this.SetErrorStatus($"Erreur lors de l'envoi: {ex.Message}"); } finally { diff --git a/src/PostIt/PostIt/ViewModels/MainViewModel.cs b/src/PostIt/PostIt/ViewModels/MainViewModel.cs index 2ef6959bc..696470a3f 100644 --- a/src/PostIt/PostIt/ViewModels/MainViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/MainViewModel.cs @@ -12,7 +12,7 @@ using PostIt.Helpers; namespace PostIt.ViewModels; -public partial class MainViewModel : ViewModelBase +public partial class MainViewModel : ViewModelBase, IActionStatusViewModel { /// Window/tab title. Cosmetic — bound by /// MainPage.axaml if at all. Not the post title. @@ -55,16 +55,11 @@ public partial class MainViewModel : ViewModelBase public partial string StatusMessage { get; set; } [ObservableProperty] - public partial StatusNotice ActionStatus { get; set; } = StatusNotice.FromMessage(string.Empty); + public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret."); [ObservableProperty] public partial string SearchText { get; set; } - partial void OnStatusMessageChanged(string value) - { - ActionStatus = StatusNotice.FromMessage(value); - } - [ObservableProperty] public partial ObservableCollection Posts { get; set; } @@ -92,7 +87,7 @@ public partial class MainViewModel : ViewModelBase Posts.Add(post); } ApplyFilter(); - StatusMessage = $"Loaded {Posts.Count} posts."; + this.SetInfoStatus($"Loaded {Posts.Count} posts."); }); } @@ -112,7 +107,7 @@ public partial class MainViewModel : ViewModelBase // than to send a request the server will reject. if (string.IsNullOrWhiteSpace(DraftTitle)) { - StatusMessage = "Title is required."; + this.SetWarningStatus("Title is required."); return; } @@ -142,7 +137,7 @@ public partial class MainViewModel : ViewModelBase if (created is not null) { SelectedPost = created; - StatusMessage = $"Created post {created.Id}."; + this.SetInfoStatus($"Created post {created.Id}."); } } else @@ -158,7 +153,7 @@ public partial class MainViewModel : ViewModelBase DateModified = DateTime.UtcNow, }; await BlogClient!.UpdatePostAsync(SelectedPost.Id, update); - StatusMessage = $"Saved post {SelectedPost.Id}."; + this.SetInfoStatus($"Saved post {SelectedPost.Id}."); } await RefreshPostsAsync(); @@ -170,14 +165,14 @@ public partial class MainViewModel : ViewModelBase { if (SelectedPost is null || SelectedPost.Id == 0) { - StatusMessage = "Select an existing post before deleting."; + this.SetWarningStatus("Select an existing post before deleting."); return; } await ExecuteAsync(async () => { await BlogClient!.DeletePostAsync(SelectedPost.Id); - StatusMessage = $"Deleted post {SelectedPost.Id}."; + this.SetInfoStatus($"Deleted post {SelectedPost.Id}."); SelectedPost = null; await RefreshPostsAsync(); }); @@ -202,7 +197,7 @@ public partial class MainViewModel : ViewModelBase { if (SelectedPost is null || SelectedPost.Id == 0) { - StatusMessage = "Sélectionnez un billet existant pour changer sa publication."; + this.SetWarningStatus("Sélectionnez un billet existant pour changer sa publication."); return; } @@ -219,9 +214,9 @@ public partial class MainViewModel : ViewModelBase // locally flipped state until the round-trip // re-hydrates it. SelectedPost.IsPublished = publish; - StatusMessage = publish + this.SetInfoStatus(publish ? $"Billet {SelectedPost.Id} publié." - : $"Billet {SelectedPost.Id} remis en brouillon."; + : $"Billet {SelectedPost.Id} remis en brouillon."); }); } @@ -255,7 +250,7 @@ public partial class MainViewModel : ViewModelBase { if (SelectedPost is null) { - StatusMessage = "Select an existing post before managing ACL."; + this.SetWarningStatus("Select an existing post before managing ACL."); return; } @@ -354,7 +349,7 @@ public partial class MainViewModel : ViewModelBase FilteredPosts = new ObservableCollection(); SelectedPost = null; IsBusy = false; - StatusMessage = "Ready"; + this.SetInfoStatus("Ready"); Settings = settings ?? new Settings(); SearchText = Settings.SearchText; WindowTitle = "PostIt"; @@ -484,12 +479,12 @@ public partial class MainViewModel : ViewModelBase try { IsBusy = true; - StatusMessage = "Working..."; + this.SetInfoStatus("Working..."); await action(); } catch (Exception ex) { - StatusMessage = $"Error: {ex.Message}"; + this.SetErrorStatus($"Error: {ex.Message}"); } finally { diff --git a/src/PostIt/PostIt/ViewModels/PostAclDialogViewModel.cs b/src/PostIt/PostIt/ViewModels/PostAclDialogViewModel.cs index 994a4bcbd..be1b220fa 100644 --- a/src/PostIt/PostIt/ViewModels/PostAclDialogViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/PostAclDialogViewModel.cs @@ -37,7 +37,7 @@ public sealed class PostAclEntry /// any 403 / 404 will surface as an exception caught by the /// command and routed to . /// -public partial class PostAclDialogViewModel : ViewModelBase +public partial class PostAclDialogViewModel : ViewModelBase, IActionStatusViewModel { private readonly BlogAclApiClient _aclClient; private readonly CircleApiClient _circleClient; @@ -61,15 +61,10 @@ public partial class PostAclDialogViewModel : ViewModelBase public partial bool IsBusy { get; set; } [ObservableProperty] - public partial string StatusMessage { get; set; } = string.Empty; + public partial string StatusMessage { get; set; } = "Pret."; [ObservableProperty] - public partial StatusNotice ActionStatus { get; set; } = StatusNotice.FromMessage(string.Empty); - - partial void OnStatusMessageChanged(string value) - { - ActionStatus = StatusNotice.FromMessage(value); - } + public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret."); /// /// Idempotency gate for : the dialog @@ -123,12 +118,12 @@ public partial class PostAclDialogViewModel : ViewModelBase AclEntries = new ObservableCollection(AclEntries.Select(a => ToAclEntry(a.CircleId))); - StatusMessage = $"{AclEntries.Count} autorisation(s)"; + this.SetInfoStatus($"{AclEntries.Count} autorisation(s)"); _loaded = true; } catch (Exception ex) { - StatusMessage = $"Erreur: {ex.Message}"; + this.SetErrorStatus($"Erreur: {ex.Message}"); } finally { @@ -141,7 +136,7 @@ public partial class PostAclDialogViewModel : ViewModelBase { if (SelectedCircleToAdd is null) { - StatusMessage = "Sélectionnez un cercle à ajouter"; + this.SetWarningStatus("Sélectionnez un cercle à ajouter"); return; } @@ -150,7 +145,7 @@ public partial class PostAclDialogViewModel : ViewModelBase { if (AclEntries.Any(a => a.CircleId == SelectedCircleToAdd.Id)) { - StatusMessage = $"Cercle « {SelectedCircleToAdd.Name} » déjà autorisé"; + this.SetWarningStatus($"Cercle « {SelectedCircleToAdd.Name} » déjà autorisé"); return; } @@ -162,11 +157,11 @@ public partial class PostAclDialogViewModel : ViewModelBase if (created is not null) { AclEntries.Add(ToAclEntry(created.CircleId)); - StatusMessage = $"Cercle « {SelectedCircleToAdd.Name} » autorisé"; + this.SetInfoStatus($"Cercle « {SelectedCircleToAdd.Name} » autorisé"); } else { - StatusMessage = "Autorisation refusée par le serveur"; + this.SetWarningStatus("Autorisation refusée par le serveur"); } } catch (HttpRequestException ex) when (ex.StatusCode == HttpStatusCode.Conflict) @@ -174,11 +169,11 @@ public partial class PostAclDialogViewModel : ViewModelBase // Conflict means the link already exists in backend. Resync // from the dedicated ACL API so the UI reflects server truth. await ReloadAclEntriesFromServerAsync(); - StatusMessage = $"Cercle « {SelectedCircleToAdd.Name} » déjà autorisé"; + this.SetWarningStatus($"Cercle « {SelectedCircleToAdd.Name} » déjà autorisé"); } catch (Exception ex) { - StatusMessage = $"Erreur: {ex.Message}"; + this.SetErrorStatus($"Erreur: {ex.Message}"); } finally { @@ -197,11 +192,11 @@ public partial class PostAclDialogViewModel : ViewModelBase var existing = AclEntries.FirstOrDefault(e => e.CircleId == acl.CircleId); if (existing is not null) AclEntries.Remove(existing); - StatusMessage = "Autorisation révoquée"; + this.SetInfoStatus("Autorisation révoquée"); } catch (Exception ex) { - StatusMessage = $"Erreur: {ex.Message}"; + this.SetErrorStatus($"Erreur: {ex.Message}"); } finally { diff --git a/src/PostIt/PostIt/ViewModels/SignaturePageViewModel.cs b/src/PostIt/PostIt/ViewModels/SignaturePageViewModel.cs index 47667bddf..23ba70cf9 100644 --- a/src/PostIt/PostIt/ViewModels/SignaturePageViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/SignaturePageViewModel.cs @@ -30,7 +30,7 @@ namespace PostIt.ViewModels; /// until the Yavsc.Org endpoint exists; the contract there will /// be POST /api/signature/{devisId} with this same payload. /// -public partial class SignaturePageViewModel : ViewModelBase +public partial class SignaturePageViewModel : ViewModelBase, IActionStatusViewModel { /// /// Default capture surface, in DIPs. 3:1 ratio matches a @@ -43,12 +43,7 @@ public partial class SignaturePageViewModel : ViewModelBase public partial string StatusMessage { get; set; } = "Prêt."; [ObservableProperty] - public partial StatusNotice ActionStatus { get; set; } = StatusNotice.FromMessage("Prêt."); - - partial void OnStatusMessageChanged(string value) - { - ActionStatus = StatusNotice.FromMessage(value); - } + public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Prêt."); [ObservableProperty] public partial int StrokeCount { get; set; } @@ -115,7 +110,7 @@ public partial class SignaturePageViewModel : ViewModelBase private void OnStrokeCompleted(object? sender, SignaturePadData data) { - StatusMessage = $"Trait terminé. {data.StrokeCount} trait(s)."; + this.SetInfoStatus($"Trait terminé. {data.StrokeCount} trait(s)."); RefreshCounts(); } @@ -133,7 +128,7 @@ public partial class SignaturePageViewModel : ViewModelBase public void Clear() { _control?.Clear(); - StatusMessage = "Effacé."; + this.SetInfoStatus("Effacé."); RefreshCounts(); } @@ -142,14 +137,14 @@ public partial class SignaturePageViewModel : ViewModelBase { if (_control is null) { - StatusMessage = "Contrôle non attaché."; + this.SetWarningStatus("Contrôle non attaché."); return; } var data = _control.Snapshot(); if (data.IsEmpty) { - StatusMessage = "Rien à capturer."; + this.SetWarningStatus("Rien à capturer."); return; } @@ -157,11 +152,11 @@ public partial class SignaturePageViewModel : ViewModelBase { var path = WriteCapture(data); LastCapturedPath = path; - StatusMessage = $"Capture enregistrée: {path}"; + this.SetInfoStatus($"Capture enregistrée: {path}"); } catch (Exception ex) { - StatusMessage = $"Erreur: {ex.Message}"; + this.SetErrorStatus($"Erreur: {ex.Message}"); } await Task.CompletedTask; } diff --git a/src/PostIt/PostIt/ViewModels/StatusNotice.cs b/src/PostIt/PostIt/ViewModels/StatusNotice.cs index 2d14b28b3..972c64350 100644 --- a/src/PostIt/PostIt/ViewModels/StatusNotice.cs +++ b/src/PostIt/PostIt/ViewModels/StatusNotice.cs @@ -32,27 +32,4 @@ public sealed class StatusNotice public static StatusNotice Info(string message) => new(message, StatusSeverity.Info); public static StatusNotice Warning(string message) => new(message, StatusSeverity.Warning); public static StatusNotice Error(string message) => new(message, StatusSeverity.Error); - - public static StatusNotice FromMessage(string? message) - { - if (string.IsNullOrWhiteSpace(message)) - { - return Info("Pret."); - } - - var text = message.Trim(); - var lower = text.ToLowerInvariant(); - - if (lower.StartsWith("erreur") || lower.StartsWith("echec") || lower.StartsWith("impossible")) - { - return Error(text); - } - - if (lower.Contains("refuse") || lower.Contains("annule") || lower.Contains("obligatoire") || lower.Contains("deja")) - { - return Warning(text); - } - - return Info(text); - } } From 5d94270fd8cb950be11fe1e7c291b4d5e0755d12 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 6 Sep 2026 15:47:01 +0100 Subject: [PATCH 05/30] postit: harmonize main status messages in french --- src/PostIt/PostIt/ViewModels/MainViewModel.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/PostIt/PostIt/ViewModels/MainViewModel.cs b/src/PostIt/PostIt/ViewModels/MainViewModel.cs index 696470a3f..d2667c012 100644 --- a/src/PostIt/PostIt/ViewModels/MainViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/MainViewModel.cs @@ -87,7 +87,7 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel Posts.Add(post); } ApplyFilter(); - this.SetInfoStatus($"Loaded {Posts.Count} posts."); + this.SetInfoStatus($"{Posts.Count} billet(s) chargé(s)."); }); } @@ -107,7 +107,7 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel // than to send a request the server will reject. if (string.IsNullOrWhiteSpace(DraftTitle)) { - this.SetWarningStatus("Title is required."); + this.SetWarningStatus("Le titre est obligatoire."); return; } @@ -137,7 +137,7 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel if (created is not null) { SelectedPost = created; - this.SetInfoStatus($"Created post {created.Id}."); + this.SetInfoStatus($"Billet {created.Id} créé."); } } else @@ -153,7 +153,7 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel DateModified = DateTime.UtcNow, }; await BlogClient!.UpdatePostAsync(SelectedPost.Id, update); - this.SetInfoStatus($"Saved post {SelectedPost.Id}."); + this.SetInfoStatus($"Billet {SelectedPost.Id} enregistré."); } await RefreshPostsAsync(); @@ -165,14 +165,14 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel { if (SelectedPost is null || SelectedPost.Id == 0) { - this.SetWarningStatus("Select an existing post before deleting."); + this.SetWarningStatus("Sélectionnez un billet existant avant suppression."); return; } await ExecuteAsync(async () => { await BlogClient!.DeletePostAsync(SelectedPost.Id); - this.SetInfoStatus($"Deleted post {SelectedPost.Id}."); + this.SetInfoStatus($"Billet {SelectedPost.Id} supprimé."); SelectedPost = null; await RefreshPostsAsync(); }); @@ -250,7 +250,7 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel { if (SelectedPost is null) { - this.SetWarningStatus("Select an existing post before managing ACL."); + this.SetWarningStatus("Sélectionnez un billet existant avant de gérer l'ACL."); return; } @@ -349,7 +349,7 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel FilteredPosts = new ObservableCollection(); SelectedPost = null; IsBusy = false; - this.SetInfoStatus("Ready"); + this.SetInfoStatus("Prêt."); Settings = settings ?? new Settings(); SearchText = Settings.SearchText; WindowTitle = "PostIt"; @@ -479,12 +479,12 @@ public partial class MainViewModel : ViewModelBase, IActionStatusViewModel try { IsBusy = true; - this.SetInfoStatus("Working..."); + this.SetInfoStatus("Traitement en cours..."); await action(); } catch (Exception ex) { - this.SetErrorStatus($"Error: {ex.Message}"); + this.SetErrorStatus($"Erreur: {ex.Message}"); } finally { From a987116eb5c11e90e7914908725a5635c10e9500 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 6 Sep 2026 15:50:40 +0100 Subject: [PATCH 06/30] abstract: enable nullable annotations in legacy files --- src/Yavsc.Abstract/Billing/IBillable.cs | 2 ++ src/Yavsc.Abstract/Blogspot/BlogPostAuthorDto.cs | 2 ++ src/Yavsc.Abstract/Blogspot/BlogPostDto.cs | 2 ++ src/Yavsc.Abstract/Blogspot/IBlogPost.cs | 2 ++ src/Yavsc.Abstract/Chat/ChatHubConstants.cs | 2 ++ src/Yavsc.Abstract/Chat/IChatRoom.cs | 2 ++ src/Yavsc.Abstract/FileSystem/AbstractFileSystemHelpers.cs | 4 +++- src/Yavsc.Abstract/FileSystem/FsOperationInfo.cs | 2 ++ src/Yavsc.Abstract/FileSystem/UserDirectoryInfo.cs | 2 ++ src/Yavsc.Abstract/Google/GDate.cs | 2 ++ .../Google/Messaging/MessageWithPayloadResponse.cs | 2 ++ src/Yavsc.Abstract/IT/Fixing/Bug.cs | 2 ++ src/Yavsc.Abstract/Identity/IApplicationUser.cs | 4 +++- src/Yavsc.Abstract/Identity/UserDisplayHelpers.cs | 2 ++ src/Yavsc.Abstract/Interfaces/Workflow/IBookQueryData.cs | 4 +++- src/Yavsc.Abstract/Messaging/Comment.cs | 2 ++ src/Yavsc.Abstract/Messaging/Notification.cs | 2 ++ src/Yavsc.Abstract/Messaging/RdvQueryEvent.cs | 2 ++ src/Yavsc.Abstract/Messaging/RdvQueryProviderInfo.cs | 2 ++ src/Yavsc.Abstract/Workflow/IMobileDeviceDeclaration.cs | 4 +++- src/Yavsc.Abstract/Workflow/IPerformerProfile.cs | 2 ++ src/Yavsc.Abstract/Workflow/PerformerCodeInputValidation.cs | 2 ++ 22 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/Yavsc.Abstract/Billing/IBillable.cs b/src/Yavsc.Abstract/Billing/IBillable.cs index 416dc5bee..f936a57df 100644 --- a/src/Yavsc.Abstract/Billing/IBillable.cs +++ b/src/Yavsc.Abstract/Billing/IBillable.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using Yavsc.Services; namespace Yavsc.Billing diff --git a/src/Yavsc.Abstract/Blogspot/BlogPostAuthorDto.cs b/src/Yavsc.Abstract/Blogspot/BlogPostAuthorDto.cs index e332822e1..ab1b3fbe8 100644 --- a/src/Yavsc.Abstract/Blogspot/BlogPostAuthorDto.cs +++ b/src/Yavsc.Abstract/Blogspot/BlogPostAuthorDto.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + namespace Yavsc.Blogspot; /// diff --git a/src/Yavsc.Abstract/Blogspot/BlogPostDto.cs b/src/Yavsc.Abstract/Blogspot/BlogPostDto.cs index 9cb5b1430..bdb2ccdc8 100644 --- a/src/Yavsc.Abstract/Blogspot/BlogPostDto.cs +++ b/src/Yavsc.Abstract/Blogspot/BlogPostDto.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using Yavsc.Abstract.Identity.Security; using System.Text.Json.Serialization; diff --git a/src/Yavsc.Abstract/Blogspot/IBlogPost.cs b/src/Yavsc.Abstract/Blogspot/IBlogPost.cs index 1ef371803..38a50b78f 100644 --- a/src/Yavsc.Abstract/Blogspot/IBlogPost.cs +++ b/src/Yavsc.Abstract/Blogspot/IBlogPost.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + diff --git a/src/Yavsc.Abstract/Chat/ChatHubConstants.cs b/src/Yavsc.Abstract/Chat/ChatHubConstants.cs index b54c00c74..c673e6fae 100644 --- a/src/Yavsc.Abstract/Chat/ChatHubConstants.cs +++ b/src/Yavsc.Abstract/Chat/ChatHubConstants.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + namespace Yavsc.Abstract.Chat { public static class ChatHubConstants diff --git a/src/Yavsc.Abstract/Chat/IChatRoom.cs b/src/Yavsc.Abstract/Chat/IChatRoom.cs index 1d6f68dd5..133ca2837 100644 --- a/src/Yavsc.Abstract/Chat/IChatRoom.cs +++ b/src/Yavsc.Abstract/Chat/IChatRoom.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; namespace Yavsc.Abstract.Chat diff --git a/src/Yavsc.Abstract/FileSystem/AbstractFileSystemHelpers.cs b/src/Yavsc.Abstract/FileSystem/AbstractFileSystemHelpers.cs index dd805864e..14bc86435 100644 --- a/src/Yavsc.Abstract/FileSystem/AbstractFileSystemHelpers.cs +++ b/src/Yavsc.Abstract/FileSystem/AbstractFileSystemHelpers.cs @@ -1,4 +1,6 @@ -using System.Text; +#nullable enable annotations + +using System.Text; using Yavsc.ViewModels.UserFiles; namespace Yavsc.Server.Helpers diff --git a/src/Yavsc.Abstract/FileSystem/FsOperationInfo.cs b/src/Yavsc.Abstract/FileSystem/FsOperationInfo.cs index 76a481492..0e3c0e0c7 100644 --- a/src/Yavsc.Abstract/FileSystem/FsOperationInfo.cs +++ b/src/Yavsc.Abstract/FileSystem/FsOperationInfo.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + namespace Yavsc.Abstract.Helpers { public enum ErrorCode { diff --git a/src/Yavsc.Abstract/FileSystem/UserDirectoryInfo.cs b/src/Yavsc.Abstract/FileSystem/UserDirectoryInfo.cs index fa727d0c0..2ec5dcfaf 100644 --- a/src/Yavsc.Abstract/FileSystem/UserDirectoryInfo.cs +++ b/src/Yavsc.Abstract/FileSystem/UserDirectoryInfo.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using Yavsc.Server.Helpers; namespace Yavsc.ViewModels.UserFiles diff --git a/src/Yavsc.Abstract/Google/GDate.cs b/src/Yavsc.Abstract/Google/GDate.cs index 3506ba416..10e4de92e 100644 --- a/src/Yavsc.Abstract/Google/GDate.cs +++ b/src/Yavsc.Abstract/Google/GDate.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + // // GDate.cs // diff --git a/src/Yavsc.Abstract/Google/Messaging/MessageWithPayloadResponse.cs b/src/Yavsc.Abstract/Google/Messaging/MessageWithPayloadResponse.cs index 59538ca62..980a4abcf 100644 --- a/src/Yavsc.Abstract/Google/Messaging/MessageWithPayloadResponse.cs +++ b/src/Yavsc.Abstract/Google/Messaging/MessageWithPayloadResponse.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + // // MessageWithPayloadResponse.cs // diff --git a/src/Yavsc.Abstract/IT/Fixing/Bug.cs b/src/Yavsc.Abstract/IT/Fixing/Bug.cs index f0b403bb7..60bd155f6 100644 --- a/src/Yavsc.Abstract/IT/Fixing/Bug.cs +++ b/src/Yavsc.Abstract/IT/Fixing/Bug.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Attributes.Validation; diff --git a/src/Yavsc.Abstract/Identity/IApplicationUser.cs b/src/Yavsc.Abstract/Identity/IApplicationUser.cs index 5d1d5b1ca..0b8e1047c 100644 --- a/src/Yavsc.Abstract/Identity/IApplicationUser.cs +++ b/src/Yavsc.Abstract/Identity/IApplicationUser.cs @@ -1,4 +1,6 @@ -namespace Yavsc.Abstract.Identity +#nullable enable annotations + +namespace Yavsc.Abstract.Identity { public interface IApplicationUser { diff --git a/src/Yavsc.Abstract/Identity/UserDisplayHelpers.cs b/src/Yavsc.Abstract/Identity/UserDisplayHelpers.cs index 242615527..4277d6e3b 100644 --- a/src/Yavsc.Abstract/Identity/UserDisplayHelpers.cs +++ b/src/Yavsc.Abstract/Identity/UserDisplayHelpers.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + namespace Yavsc.Abstract.Identity { /// diff --git a/src/Yavsc.Abstract/Interfaces/Workflow/IBookQueryData.cs b/src/Yavsc.Abstract/Interfaces/Workflow/IBookQueryData.cs index 2c844f925..eb3dee591 100644 --- a/src/Yavsc.Abstract/Interfaces/Workflow/IBookQueryData.cs +++ b/src/Yavsc.Abstract/Interfaces/Workflow/IBookQueryData.cs @@ -1,4 +1,6 @@ -using Yavsc.Abstract.Identity; +#nullable enable annotations + +using Yavsc.Abstract.Identity; namespace Yavsc.Interfaces { diff --git a/src/Yavsc.Abstract/Messaging/Comment.cs b/src/Yavsc.Abstract/Messaging/Comment.cs index 3b8702ae1..d8eef456c 100644 --- a/src/Yavsc.Abstract/Messaging/Comment.cs +++ b/src/Yavsc.Abstract/Messaging/Comment.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using Yavsc.Interfaces; diff --git a/src/Yavsc.Abstract/Messaging/Notification.cs b/src/Yavsc.Abstract/Messaging/Notification.cs index dbbf735d5..f7b35b48b 100644 --- a/src/Yavsc.Abstract/Messaging/Notification.cs +++ b/src/Yavsc.Abstract/Messaging/Notification.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/src/Yavsc.Abstract/Messaging/RdvQueryEvent.cs b/src/Yavsc.Abstract/Messaging/RdvQueryEvent.cs index b2168bd7c..9e2ecb754 100644 --- a/src/Yavsc.Abstract/Messaging/RdvQueryEvent.cs +++ b/src/Yavsc.Abstract/Messaging/RdvQueryEvent.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + // // BookQueryEvent.cs // diff --git a/src/Yavsc.Abstract/Messaging/RdvQueryProviderInfo.cs b/src/Yavsc.Abstract/Messaging/RdvQueryProviderInfo.cs index 87125c544..94eeb5ab9 100644 --- a/src/Yavsc.Abstract/Messaging/RdvQueryProviderInfo.cs +++ b/src/Yavsc.Abstract/Messaging/RdvQueryProviderInfo.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using Yavsc.Abstract.Identity; using Yavsc.Models.Relationship; diff --git a/src/Yavsc.Abstract/Workflow/IMobileDeviceDeclaration.cs b/src/Yavsc.Abstract/Workflow/IMobileDeviceDeclaration.cs index 6e55ebe51..7a1dbc261 100644 --- a/src/Yavsc.Abstract/Workflow/IMobileDeviceDeclaration.cs +++ b/src/Yavsc.Abstract/Workflow/IMobileDeviceDeclaration.cs @@ -1,4 +1,6 @@ -// Copyright (C) 2016 Paul Schneider +#nullable enable annotations + +// Copyright (C) 2016 Paul Schneider // // This file is part of yavsc. // diff --git a/src/Yavsc.Abstract/Workflow/IPerformerProfile.cs b/src/Yavsc.Abstract/Workflow/IPerformerProfile.cs index 4314dd371..606285a6c 100644 --- a/src/Yavsc.Abstract/Workflow/IPerformerProfile.cs +++ b/src/Yavsc.Abstract/Workflow/IPerformerProfile.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + namespace Yavsc.Workflow { public interface IPerformerProfile diff --git a/src/Yavsc.Abstract/Workflow/PerformerCodeInputValidation.cs b/src/Yavsc.Abstract/Workflow/PerformerCodeInputValidation.cs index 84e9c1cc7..4ed60e465 100644 --- a/src/Yavsc.Abstract/Workflow/PerformerCodeInputValidation.cs +++ b/src/Yavsc.Abstract/Workflow/PerformerCodeInputValidation.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; From 0ba44c21e7ea1f4bb2956fa5f56d1282f20cdb10 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 6 Sep 2026 16:11:37 +0100 Subject: [PATCH 07/30] server: enable nullable annotations in legacy files --- src/Yavsc.Server/Config.cs | 2 ++ src/Yavsc.Server/Constants.cs | 2 ++ src/Yavsc.Server/Exceptions/AuthorizationFailureException.cs | 2 ++ src/Yavsc.Server/Exceptions/YavscInfrastructureException.cs | 2 ++ src/Yavsc.Server/Helpers/BillingHelpers.cs | 2 ++ src/Yavsc.Server/Helpers/EstimateSignatureFileHelper.cs | 2 ++ src/Yavsc.Server/Helpers/FileSystemHelpers.cs | 2 ++ src/Yavsc.Server/Helpers/HtmlHelpers.cs | 2 ++ src/Yavsc.Server/Helpers/PayPalHelpers.cs | 2 ++ src/Yavsc.Server/Helpers/RequestHelper.cs | 2 ++ src/Yavsc.Server/Helpers/ServiceExtensions.cs | 2 ++ src/Yavsc.Server/Helpers/UserHelpers.cs | 2 ++ src/Yavsc.Server/Hubs/ChatHub.cs | 2 ++ src/Yavsc.Server/Hubs/HubInputValidator.cs | 2 ++ src/Yavsc.Server/Models/Access/GrantViewModel.cs | 2 ++ src/Yavsc.Server/Models/ApplicationUser.cs | 2 ++ src/Yavsc.Server/Models/Auth/DeviceDeclaration.cs | 2 ++ src/Yavsc.Server/Models/Bank/BankIdentity.cs | 2 ++ src/Yavsc.Server/Models/Billing/Estimate.cs | 2 ++ src/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs | 2 ++ src/Yavsc.Server/Models/Billing/histoestim.cs | 2 ++ src/Yavsc.Server/Models/Blog/BlogPost.cs | 2 ++ src/Yavsc.Server/Models/Blog/Comment.cs | 2 ++ src/Yavsc.Server/Models/Calendar/Period.cs | 2 ++ src/Yavsc.Server/Models/ErrorViewModel.cs | 2 ++ src/Yavsc.Server/Models/HairCut/BrusherProfile.cs | 2 ++ src/Yavsc.Server/Models/HairCut/HairCutPaymentEvent.cs | 2 ++ src/Yavsc.Server/Models/HairCut/HairCutQuery.cs | 2 ++ src/Yavsc.Server/Models/HairCut/HairCutQueryEvent.cs | 2 ++ src/Yavsc.Server/Models/HairCut/HairMultiCutQuery.cs | 2 ++ src/Yavsc.Server/Models/HairCut/HairPrestation.cs | 2 ++ src/Yavsc.Server/Models/HairCut/Views/HaircutQueryInfo.cs | 2 ++ src/Yavsc.Server/Models/IT/SourceCode/GitClone.cs | 2 ++ src/Yavsc.Server/Models/IT/SourceCode/ProjectBuild.cs | 2 ++ src/Yavsc.Server/Models/IT/SourceCode/SingleCmdProjectBatch.cs | 2 ++ src/Yavsc.Server/Models/IdentityUserLogin.cs | 2 ++ src/Yavsc.Server/Models/Kyc/TrustDeclaration.cs | 2 ++ src/Yavsc.Server/Models/Kyc/TrustToken.cs | 2 ++ src/Yavsc.Server/Models/Market/Product.cs | 2 ++ src/Yavsc.Server/Models/Relationship/StaticContact.cs | 2 ++ src/Yavsc.Server/Models/Workflow/Activity.cs | 2 ++ src/Yavsc.Server/Models/Workflow/PerformerProfile.cs | 2 ++ src/Yavsc.Server/Models/Workflow/RdvQuery.cs | 2 ++ src/Yavsc.Server/Models/societe.com/CompanyInfo.cs | 2 ++ src/Yavsc.Server/Services/BlogSpotService.cs | 2 ++ src/Yavsc.Server/Services/ClaudeModerationService.cs | 2 ++ src/Yavsc.Server/Services/LiveProcessor.cs | 2 ++ src/Yavsc.Server/Services/MailSender.cs | 2 ++ src/Yavsc.Server/Services/PermissionHandler.cs | 2 ++ src/Yavsc.Server/Services/ProfileService.cs | 2 ++ src/Yavsc.Server/Settings/SiteSettings.cs | 2 ++ src/Yavsc.Server/ViewModels/Account/ForgotPasswordViewModel.cs | 2 ++ src/Yavsc.Server/ViewModels/Account/SignInModel.cs | 2 ++ src/Yavsc.Server/ViewModels/Account/UnregisterViewModel.cs | 2 ++ src/Yavsc.Server/ViewModels/Account/VerifyCodeViewModel.cs | 2 ++ 55 files changed, 110 insertions(+) mode change 100755 => 100644 src/Yavsc.Server/ViewModels/Account/SignInModel.cs diff --git a/src/Yavsc.Server/Config.cs b/src/Yavsc.Server/Config.cs index 5d2bcdffb..e68546eff 100644 --- a/src/Yavsc.Server/Config.cs +++ b/src/Yavsc.Server/Config.cs @@ -1,3 +1,5 @@ +#nullable enable annotations +  using IdentityServer8; using IdentityServer8.Models; diff --git a/src/Yavsc.Server/Constants.cs b/src/Yavsc.Server/Constants.cs index 4ded48eae..8859e5e69 100644 --- a/src/Yavsc.Server/Constants.cs +++ b/src/Yavsc.Server/Constants.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + namespace Yavsc.Server { diff --git a/src/Yavsc.Server/Exceptions/AuthorizationFailureException.cs b/src/Yavsc.Server/Exceptions/AuthorizationFailureException.cs index a3c5105ec..4a588dfd9 100644 --- a/src/Yavsc.Server/Exceptions/AuthorizationFailureException.cs +++ b/src/Yavsc.Server/Exceptions/AuthorizationFailureException.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + namespace Yavsc.Server.Exceptions; [Serializable] diff --git a/src/Yavsc.Server/Exceptions/YavscInfrastructureException.cs b/src/Yavsc.Server/Exceptions/YavscInfrastructureException.cs index 7888970c5..583872414 100644 --- a/src/Yavsc.Server/Exceptions/YavscInfrastructureException.cs +++ b/src/Yavsc.Server/Exceptions/YavscInfrastructureException.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + namespace Yavsc.Services { [Serializable] diff --git a/src/Yavsc.Server/Helpers/BillingHelpers.cs b/src/Yavsc.Server/Helpers/BillingHelpers.cs index c10a76155..789b85a96 100644 --- a/src/Yavsc.Server/Helpers/BillingHelpers.cs +++ b/src/Yavsc.Server/Helpers/BillingHelpers.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.Globalization; using Yavsc.Billing; using Yavsc.Models.Billing; diff --git a/src/Yavsc.Server/Helpers/EstimateSignatureFileHelper.cs b/src/Yavsc.Server/Helpers/EstimateSignatureFileHelper.cs index e2d40266d..8545c3a0a 100644 --- a/src/Yavsc.Server/Helpers/EstimateSignatureFileHelper.cs +++ b/src/Yavsc.Server/Helpers/EstimateSignatureFileHelper.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.Security.Claims; using System.Text; using System.Text.Json; diff --git a/src/Yavsc.Server/Helpers/FileSystemHelpers.cs b/src/Yavsc.Server/Helpers/FileSystemHelpers.cs index 7d9d86ed0..29ada6b77 100644 --- a/src/Yavsc.Server/Helpers/FileSystemHelpers.cs +++ b/src/Yavsc.Server/Helpers/FileSystemHelpers.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.Security.Claims; diff --git a/src/Yavsc.Server/Helpers/HtmlHelpers.cs b/src/Yavsc.Server/Helpers/HtmlHelpers.cs index 213ea369a..c23f05cd2 100644 --- a/src/Yavsc.Server/Helpers/HtmlHelpers.cs +++ b/src/Yavsc.Server/Helpers/HtmlHelpers.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Http; using Yavsc.Models.Drawing; diff --git a/src/Yavsc.Server/Helpers/PayPalHelpers.cs b/src/Yavsc.Server/Helpers/PayPalHelpers.cs index 9d4074d46..51902c784 100644 --- a/src/Yavsc.Server/Helpers/PayPalHelpers.cs +++ b/src/Yavsc.Server/Helpers/PayPalHelpers.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using Microsoft.Extensions.Logging; using Yavsc.Models.Billing; using Microsoft.AspNetCore.Http; diff --git a/src/Yavsc.Server/Helpers/RequestHelper.cs b/src/Yavsc.Server/Helpers/RequestHelper.cs index 99fe15248..6b85a5c31 100644 --- a/src/Yavsc.Server/Helpers/RequestHelper.cs +++ b/src/Yavsc.Server/Helpers/RequestHelper.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.Net; using System.Net.Http.Headers; using Yavsc.Server.Model; diff --git a/src/Yavsc.Server/Helpers/ServiceExtensions.cs b/src/Yavsc.Server/Helpers/ServiceExtensions.cs index 06e877be8..1a69ca42f 100644 --- a/src/Yavsc.Server/Helpers/ServiceExtensions.cs +++ b/src/Yavsc.Server/Helpers/ServiceExtensions.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.Extensions.Configuration; diff --git a/src/Yavsc.Server/Helpers/UserHelpers.cs b/src/Yavsc.Server/Helpers/UserHelpers.cs index c3ee708d6..f0a30995f 100644 --- a/src/Yavsc.Server/Helpers/UserHelpers.cs +++ b/src/Yavsc.Server/Helpers/UserHelpers.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using Microsoft.EntityFrameworkCore; using System.Security.Claims; using Yavsc.Models; diff --git a/src/Yavsc.Server/Hubs/ChatHub.cs b/src/Yavsc.Server/Hubs/ChatHub.cs index 4a99b507c..799f7441c 100644 --- a/src/Yavsc.Server/Hubs/ChatHub.cs +++ b/src/Yavsc.Server/Hubs/ChatHub.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + // // ChatHub.cs // diff --git a/src/Yavsc.Server/Hubs/HubInputValidator.cs b/src/Yavsc.Server/Hubs/HubInputValidator.cs index a6acac5ac..a2382c11e 100644 --- a/src/Yavsc.Server/Hubs/HubInputValidator.cs +++ b/src/Yavsc.Server/Hubs/HubInputValidator.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + // // ChatHub.cs // diff --git a/src/Yavsc.Server/Models/Access/GrantViewModel.cs b/src/Yavsc.Server/Models/Access/GrantViewModel.cs index d9d0e1562..d0d379caa 100644 --- a/src/Yavsc.Server/Models/Access/GrantViewModel.cs +++ b/src/Yavsc.Server/Models/Access/GrantViewModel.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. diff --git a/src/Yavsc.Server/Models/ApplicationUser.cs b/src/Yavsc.Server/Models/ApplicationUser.cs index 355e0ad15..69fbf1e52 100644 --- a/src/Yavsc.Server/Models/ApplicationUser.cs +++ b/src/Yavsc.Server/Models/ApplicationUser.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; diff --git a/src/Yavsc.Server/Models/Auth/DeviceDeclaration.cs b/src/Yavsc.Server/Models/Auth/DeviceDeclaration.cs index 1db1d89e0..7ed5e9b0d 100644 --- a/src/Yavsc.Server/Models/Auth/DeviceDeclaration.cs +++ b/src/Yavsc.Server/Models/Auth/DeviceDeclaration.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; diff --git a/src/Yavsc.Server/Models/Bank/BankIdentity.cs b/src/Yavsc.Server/Models/Bank/BankIdentity.cs index eea65d691..092059acc 100644 --- a/src/Yavsc.Server/Models/Bank/BankIdentity.cs +++ b/src/Yavsc.Server/Models/Bank/BankIdentity.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/src/Yavsc.Server/Models/Billing/Estimate.cs b/src/Yavsc.Server/Models/Billing/Estimate.cs index e6495a140..24cd021a8 100644 --- a/src/Yavsc.Server/Models/Billing/Estimate.cs +++ b/src/Yavsc.Server/Models/Billing/Estimate.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/src/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs b/src/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs index ad651d368..aa9e06abf 100644 --- a/src/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs +++ b/src/Yavsc.Server/Models/Billing/NominativeServiceCommand.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/src/Yavsc.Server/Models/Billing/histoestim.cs b/src/Yavsc.Server/Models/Billing/histoestim.cs index 1f9b99f1f..df2860f5d 100644 --- a/src/Yavsc.Server/Models/Billing/histoestim.cs +++ b/src/Yavsc.Server/Models/Billing/histoestim.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + namespace Yavsc.Models.Billing { public partial class histoestim diff --git a/src/Yavsc.Server/Models/Blog/BlogPost.cs b/src/Yavsc.Server/Models/Blog/BlogPost.cs index 4c2f2ae5c..6dc8ff750 100644 --- a/src/Yavsc.Server/Models/Blog/BlogPost.cs +++ b/src/Yavsc.Server/Models/Blog/BlogPost.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; diff --git a/src/Yavsc.Server/Models/Blog/Comment.cs b/src/Yavsc.Server/Models/Blog/Comment.cs index 4d39d0c2e..5d7cc2912 100644 --- a/src/Yavsc.Server/Models/Blog/Comment.cs +++ b/src/Yavsc.Server/Models/Blog/Comment.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; diff --git a/src/Yavsc.Server/Models/Calendar/Period.cs b/src/Yavsc.Server/Models/Calendar/Period.cs index dfc285cf3..f333235b1 100644 --- a/src/Yavsc.Server/Models/Calendar/Period.cs +++ b/src/Yavsc.Server/Models/Calendar/Period.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + // // Period.cs // diff --git a/src/Yavsc.Server/Models/ErrorViewModel.cs b/src/Yavsc.Server/Models/ErrorViewModel.cs index 178194769..087aa505b 100644 --- a/src/Yavsc.Server/Models/ErrorViewModel.cs +++ b/src/Yavsc.Server/Models/ErrorViewModel.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + namespace Yavsc.Models; public class ErrorViewModel diff --git a/src/Yavsc.Server/Models/HairCut/BrusherProfile.cs b/src/Yavsc.Server/Models/HairCut/BrusherProfile.cs index ba47bfdce..d89a56fa8 100644 --- a/src/Yavsc.Server/Models/HairCut/BrusherProfile.cs +++ b/src/Yavsc.Server/Models/HairCut/BrusherProfile.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + // // BrusherProfile.cs diff --git a/src/Yavsc.Server/Models/HairCut/HairCutPaymentEvent.cs b/src/Yavsc.Server/Models/HairCut/HairCutPaymentEvent.cs index 353249288..2c96a7d80 100644 --- a/src/Yavsc.Server/Models/HairCut/HairCutPaymentEvent.cs +++ b/src/Yavsc.Server/Models/HairCut/HairCutPaymentEvent.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using Microsoft.Extensions.Localization; using Yavsc.Interfaces.Workflow; diff --git a/src/Yavsc.Server/Models/HairCut/HairCutQuery.cs b/src/Yavsc.Server/Models/HairCut/HairCutQuery.cs index 0960db6d6..680cf6956 100644 --- a/src/Yavsc.Server/Models/HairCut/HairCutQuery.cs +++ b/src/Yavsc.Server/Models/HairCut/HairCutQuery.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Billing; diff --git a/src/Yavsc.Server/Models/HairCut/HairCutQueryEvent.cs b/src/Yavsc.Server/Models/HairCut/HairCutQueryEvent.cs index bd30fb784..fadc353a8 100644 --- a/src/Yavsc.Server/Models/HairCut/HairCutQueryEvent.cs +++ b/src/Yavsc.Server/Models/HairCut/HairCutQueryEvent.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using Yavsc.Interfaces.Workflow; namespace Yavsc.Models.Haircut diff --git a/src/Yavsc.Server/Models/HairCut/HairMultiCutQuery.cs b/src/Yavsc.Server/Models/HairCut/HairMultiCutQuery.cs index 21ae437ce..beb7da9ac 100644 --- a/src/Yavsc.Server/Models/HairCut/HairMultiCutQuery.cs +++ b/src/Yavsc.Server/Models/HairCut/HairMultiCutQuery.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Yavsc.Models.Billing; diff --git a/src/Yavsc.Server/Models/HairCut/HairPrestation.cs b/src/Yavsc.Server/Models/HairCut/HairPrestation.cs index 6153f6483..2e2cf8ca6 100644 --- a/src/Yavsc.Server/Models/HairCut/HairPrestation.cs +++ b/src/Yavsc.Server/Models/HairCut/HairPrestation.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Reflection; diff --git a/src/Yavsc.Server/Models/HairCut/Views/HaircutQueryInfo.cs b/src/Yavsc.Server/Models/HairCut/Views/HaircutQueryInfo.cs index c9213862e..4099dbcaa 100644 --- a/src/Yavsc.Server/Models/HairCut/Views/HaircutQueryInfo.cs +++ b/src/Yavsc.Server/Models/HairCut/Views/HaircutQueryInfo.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + // // HaircutQueryInfo.cs diff --git a/src/Yavsc.Server/Models/IT/SourceCode/GitClone.cs b/src/Yavsc.Server/Models/IT/SourceCode/GitClone.cs index 826e5de38..d58551a65 100644 --- a/src/Yavsc.Server/Models/IT/SourceCode/GitClone.cs +++ b/src/Yavsc.Server/Models/IT/SourceCode/GitClone.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + // // GitClone.cs // /* // paul 21/06/2018 11:27 20182018 6 21 diff --git a/src/Yavsc.Server/Models/IT/SourceCode/ProjectBuild.cs b/src/Yavsc.Server/Models/IT/SourceCode/ProjectBuild.cs index f65b17b51..eb1afe214 100644 --- a/src/Yavsc.Server/Models/IT/SourceCode/ProjectBuild.cs +++ b/src/Yavsc.Server/Models/IT/SourceCode/ProjectBuild.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.Diagnostics; namespace Yavsc.Server.Models.IT.SourceCode diff --git a/src/Yavsc.Server/Models/IT/SourceCode/SingleCmdProjectBatch.cs b/src/Yavsc.Server/Models/IT/SourceCode/SingleCmdProjectBatch.cs index 2ce162564..0fb2116f5 100644 --- a/src/Yavsc.Server/Models/IT/SourceCode/SingleCmdProjectBatch.cs +++ b/src/Yavsc.Server/Models/IT/SourceCode/SingleCmdProjectBatch.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.Diagnostics; namespace Yavsc.Server.Models.IT.SourceCode diff --git a/src/Yavsc.Server/Models/IdentityUserLogin.cs b/src/Yavsc.Server/Models/IdentityUserLogin.cs index bfbd4e899..78567f68f 100644 --- a/src/Yavsc.Server/Models/IdentityUserLogin.cs +++ b/src/Yavsc.Server/Models/IdentityUserLogin.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + namespace Yavsc.Models.Auth { using System.ComponentModel.DataAnnotations.Schema; diff --git a/src/Yavsc.Server/Models/Kyc/TrustDeclaration.cs b/src/Yavsc.Server/Models/Kyc/TrustDeclaration.cs index 0a97eb6a9..fe9fc2ec4 100644 --- a/src/Yavsc.Server/Models/Kyc/TrustDeclaration.cs +++ b/src/Yavsc.Server/Models/Kyc/TrustDeclaration.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + // Yavsc.Models.Kyc/TrustDeclaration.cs namespace Yavsc.Models.Kyc { diff --git a/src/Yavsc.Server/Models/Kyc/TrustToken.cs b/src/Yavsc.Server/Models/Kyc/TrustToken.cs index 2e240bae1..8c09d39cd 100644 --- a/src/Yavsc.Server/Models/Kyc/TrustToken.cs +++ b/src/Yavsc.Server/Models/Kyc/TrustToken.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + // Yavsc.Models.Kyc/TrustToken.cs namespace Yavsc.Models.Kyc { diff --git a/src/Yavsc.Server/Models/Market/Product.cs b/src/Yavsc.Server/Models/Market/Product.cs index ae8f29199..84f5709ca 100644 --- a/src/Yavsc.Server/Models/Market/Product.cs +++ b/src/Yavsc.Server/Models/Market/Product.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; diff --git a/src/Yavsc.Server/Models/Relationship/StaticContact.cs b/src/Yavsc.Server/Models/Relationship/StaticContact.cs index 7ae6ab6ae..05ebf04da 100644 --- a/src/Yavsc.Server/Models/Relationship/StaticContact.cs +++ b/src/Yavsc.Server/Models/Relationship/StaticContact.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + namespace Yavsc.Models.Relationship { diff --git a/src/Yavsc.Server/Models/Workflow/Activity.cs b/src/Yavsc.Server/Models/Workflow/Activity.cs index 0f813a273..e3303f5ac 100644 --- a/src/Yavsc.Server/Models/Workflow/Activity.cs +++ b/src/Yavsc.Server/Models/Workflow/Activity.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; diff --git a/src/Yavsc.Server/Models/Workflow/PerformerProfile.cs b/src/Yavsc.Server/Models/Workflow/PerformerProfile.cs index 23bd688b4..c2f312b84 100644 --- a/src/Yavsc.Server/Models/Workflow/PerformerProfile.cs +++ b/src/Yavsc.Server/Models/Workflow/PerformerProfile.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/src/Yavsc.Server/Models/Workflow/RdvQuery.cs b/src/Yavsc.Server/Models/Workflow/RdvQuery.cs index f821fc75d..cd56f3676 100644 --- a/src/Yavsc.Server/Models/Workflow/RdvQuery.cs +++ b/src/Yavsc.Server/Models/Workflow/RdvQuery.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/src/Yavsc.Server/Models/societe.com/CompanyInfo.cs b/src/Yavsc.Server/Models/societe.com/CompanyInfo.cs index 114c4d8e3..354bc4861 100644 --- a/src/Yavsc.Server/Models/societe.com/CompanyInfo.cs +++ b/src/Yavsc.Server/Models/societe.com/CompanyInfo.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; diff --git a/src/Yavsc.Server/Services/BlogSpotService.cs b/src/Yavsc.Server/Services/BlogSpotService.cs index a08326303..20f7245e5 100644 --- a/src/Yavsc.Server/Services/BlogSpotService.cs +++ b/src/Yavsc.Server/Services/BlogSpotService.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.Diagnostics; using System.Security.Claims; using Microsoft.AspNetCore.Authorization; diff --git a/src/Yavsc.Server/Services/ClaudeModerationService.cs b/src/Yavsc.Server/Services/ClaudeModerationService.cs index a510e55cb..a47952318 100644 --- a/src/Yavsc.Server/Services/ClaudeModerationService.cs +++ b/src/Yavsc.Server/Services/ClaudeModerationService.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using Yavsc.Moderation; using Yavsc.Abstract.Interfaces; using Anthropic.SDK; diff --git a/src/Yavsc.Server/Services/LiveProcessor.cs b/src/Yavsc.Server/Services/LiveProcessor.cs index f10a8201a..560ee6d0a 100644 --- a/src/Yavsc.Server/Services/LiveProcessor.cs +++ b/src/Yavsc.Server/Services/LiveProcessor.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.Collections.Concurrent; using System.Net.WebSockets; using Yavsc.Models; diff --git a/src/Yavsc.Server/Services/MailSender.cs b/src/Yavsc.Server/Services/MailSender.cs index 592a43ba6..81518eddb 100644 --- a/src/Yavsc.Server/Services/MailSender.cs +++ b/src/Yavsc.Server/Services/MailSender.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using MailKit.Net.Smtp; using MailKit.Security; using Microsoft.Extensions.Logging; diff --git a/src/Yavsc.Server/Services/PermissionHandler.cs b/src/Yavsc.Server/Services/PermissionHandler.cs index 6848070ac..77ee9fd57 100644 --- a/src/Yavsc.Server/Services/PermissionHandler.cs +++ b/src/Yavsc.Server/Services/PermissionHandler.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.Security.Claims; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; diff --git a/src/Yavsc.Server/Services/ProfileService.cs b/src/Yavsc.Server/Services/ProfileService.cs index b6da3a568..3b7b5121a 100644 --- a/src/Yavsc.Server/Services/ProfileService.cs +++ b/src/Yavsc.Server/Services/ProfileService.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.Security.Claims; using IdentityModel; using IdentityServer8.Models; diff --git a/src/Yavsc.Server/Settings/SiteSettings.cs b/src/Yavsc.Server/Settings/SiteSettings.cs index ef74781de..3d604f79f 100644 --- a/src/Yavsc.Server/Settings/SiteSettings.cs +++ b/src/Yavsc.Server/Settings/SiteSettings.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using Yavsc.Models.Relationship; namespace Yavsc diff --git a/src/Yavsc.Server/ViewModels/Account/ForgotPasswordViewModel.cs b/src/Yavsc.Server/ViewModels/Account/ForgotPasswordViewModel.cs index 6af77fe4d..903d4c8b3 100644 --- a/src/Yavsc.Server/ViewModels/Account/ForgotPasswordViewModel.cs +++ b/src/Yavsc.Server/ViewModels/Account/ForgotPasswordViewModel.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; diff --git a/src/Yavsc.Server/ViewModels/Account/SignInModel.cs b/src/Yavsc.Server/ViewModels/Account/SignInModel.cs old mode 100755 new mode 100644 index d2aa69ad2..6375c40fe --- a/src/Yavsc.Server/ViewModels/Account/SignInModel.cs +++ b/src/Yavsc.Server/ViewModels/Account/SignInModel.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; namespace Yavsc.ViewModels.Account diff --git a/src/Yavsc.Server/ViewModels/Account/UnregisterViewModel.cs b/src/Yavsc.Server/ViewModels/Account/UnregisterViewModel.cs index e28fcfed8..e08330440 100644 --- a/src/Yavsc.Server/ViewModels/Account/UnregisterViewModel.cs +++ b/src/Yavsc.Server/ViewModels/Account/UnregisterViewModel.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; namespace Yavsc.ViewModels.Account diff --git a/src/Yavsc.Server/ViewModels/Account/VerifyCodeViewModel.cs b/src/Yavsc.Server/ViewModels/Account/VerifyCodeViewModel.cs index a768e249f..5252ff4f6 100644 --- a/src/Yavsc.Server/ViewModels/Account/VerifyCodeViewModel.cs +++ b/src/Yavsc.Server/ViewModels/Account/VerifyCodeViewModel.cs @@ -1,3 +1,5 @@ +#nullable enable annotations + using System.ComponentModel.DataAnnotations; namespace Yavsc.ViewModels.Account From 148a3aa271535f664d6263a87f9433a71d1b0daa Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 6 Sep 2026 16:20:17 +0100 Subject: [PATCH 08/30] postit: harden oidc settings defaults on startup --- .../PostIt/ViewModels/Settings/Settings.cs | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/PostIt/PostIt/ViewModels/Settings/Settings.cs b/src/PostIt/PostIt/ViewModels/Settings/Settings.cs index b59ef9933..9547fb4f3 100644 --- a/src/PostIt/PostIt/ViewModels/Settings/Settings.cs +++ b/src/PostIt/PostIt/ViewModels/Settings/Settings.cs @@ -123,6 +123,8 @@ public partial class Settings : ViewModelBase // build options from a torn read. lock (_mutationGate) { + EnsureAuthenticationDefaultsLocked(); + var options = new OidcClientOptions { Authority = Authentication.Authority, @@ -151,6 +153,25 @@ public partial class Settings : ViewModelBase } } + private void EnsureAuthenticationDefaultsLocked() + { + Authentication ??= new AuthenticationSettings(); + + if (string.IsNullOrWhiteSpace(Authentication.Authority)) + Authentication.Authority = AuthenticationSettings.DefaultAuthority; + + if (string.IsNullOrWhiteSpace(Authentication.ClientId)) + Authentication.ClientId = AuthenticationSettings.DefaultClientId; + + if (string.IsNullOrWhiteSpace(Authentication.RedirectUri)) + Authentication.RedirectUri = AuthenticationSettings.DesktopRedirectUri; + + if (Authentication.Scopes is null || Authentication.Scopes.Length == 0) + Authentication.Scopes = AuthenticationSettings.DefaultScopes; + + Authentication.RefreshScopeListText(); + } + /// /// Scopes the PostIt client always requires from the OIDC provider, /// regardless of what the user has in their settings file. @@ -334,11 +355,13 @@ public partial class Settings : ViewModelBase AuthenticationSettings.DesktopRedirectUri : settings.Authentication.RedirectUri; if (settings.Authentication.Scopes is null || settings.Authentication.Scopes.Length == 0) { - settings.Authentication.Scopes = AuthenticationSettings.DefaultScopes; + this.Authentication.Scopes = AuthenticationSettings.DefaultScopes; } else this.Authentication.Scopes = settings.Authentication.Scopes; } + + EnsureAuthenticationDefaultsLocked(); } // A disk load (or an embedded-resource fallback) is the // baseline, not a user edit. Clear the dirty flag last From 66614ef2e1e8f503eb1a1963a018f14a3822105e Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 6 Sep 2026 16:24:46 +0100 Subject: [PATCH 09/30] postit: ignore runtime status in settings json --- src/PostIt/PostIt/ViewModels/Settings/Settings.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/PostIt/PostIt/ViewModels/Settings/Settings.cs b/src/PostIt/PostIt/ViewModels/Settings/Settings.cs index 9547fb4f3..0864c1416 100644 --- a/src/PostIt/PostIt/ViewModels/Settings/Settings.cs +++ b/src/PostIt/PostIt/ViewModels/Settings/Settings.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.IO; using System.Net.Http; using System.Text.Json; +using System.Text.Json.Serialization; [assembly: InternalsVisibleTo("PostIt.Tests")] @@ -32,6 +33,7 @@ public partial class Settings : ViewModelBase public partial string SearchText { get; set; } = string.Empty; [ObservableProperty] + [JsonIgnore] public partial StatusNotice ActionStatus { get; set; } = StatusNotice.Info("Pret."); public void SetActionStatus(string message, StatusSeverity severity = StatusSeverity.Info) From 3488abc7fdf1a182309cc6af6ff832f1c2a03576 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 6 Sep 2026 16:32:59 +0100 Subject: [PATCH 10/30] postit-tests: lock first-load settings regression --- src/PostIt/PostIt.Tests/SettingsLoadTests.cs | 47 ++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/PostIt/PostIt.Tests/SettingsLoadTests.cs b/src/PostIt/PostIt.Tests/SettingsLoadTests.cs index 3f8dc02b9..069b6ac96 100644 --- a/src/PostIt/PostIt.Tests/SettingsLoadTests.cs +++ b/src/PostIt/PostIt.Tests/SettingsLoadTests.cs @@ -173,4 +173,51 @@ public class SettingsLoadTests Assert.NotNull(roundTrip); Assert.Equal("bonjour", roundTrip.SearchText); } + + /// + /// First-start regression guard: older settings payloads can + /// still contain ActionStatus from a previous write. This + /// runtime-only UI state must not be persisted anymore and must + /// not break deserialization when present. + /// + [Fact] + public void ActionStatus_is_not_persisted_and_legacy_payload_with_it_still_deserializes() + { + var settings = new PostIt.ViewModels.Settings + { + Authentication = new AuthenticationSettings + { + Authority = "https://example.test/", + ClientId = "postit-tests", + Scopes = new[] { "openid" } + } + }; + + var serialized = JsonSerializer.Serialize(settings); + Assert.DoesNotContain("\"ActionStatus\"", serialized, StringComparison.Ordinal); + + const string legacyPayload = """ + { + "Authentication": { + "Authority": "https://example.test/", + "ClientId": "postit-tests", + "Scopes": ["openid"], + "RedirectUri": "postit://callback" + }, + "DarkMode": false, + "BlogsApiUrl": "https://blogs.example.test/api/v1/", + "ApiUrl": "https://api.example.test/api/v1/", + "SearchText": "hello", + "ActionStatus": { + "Message": "runtime only", + "Severity": "Error" + } + } + """; + + var roundTrip = JsonSerializer.Deserialize(legacyPayload); + + Assert.NotNull(roundTrip); + Assert.Equal("hello", roundTrip.SearchText); + } } From 2ede36cb8fd87f4c710f362998c9009ea910e8ba Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 6 Sep 2026 16:58:39 +0100 Subject: [PATCH 11/30] postit: add mapsui location picker to rdv form --- src/PostIt/Directory.Packages.props | 2 + .../BillingCommandPageViewModelTests.cs | 20 ++++++ src/PostIt/PostIt/PostIt.csproj | 2 + .../ViewModels/Commands/RdvViewModel.cs | 14 ++++ .../PostIt/Views/Commands/RdvPage.axaml | 12 +++- .../PostIt/Views/Commands/RdvPage.axaml.cs | 65 +++++++++++++++++++ 6 files changed, 114 insertions(+), 1 deletion(-) diff --git a/src/PostIt/Directory.Packages.props b/src/PostIt/Directory.Packages.props index 4dd4b2889..2f27340e9 100644 --- a/src/PostIt/Directory.Packages.props +++ b/src/PostIt/Directory.Packages.props @@ -16,6 +16,8 @@ + + diff --git a/src/PostIt/PostIt.Tests/BillingCommandPageViewModelTests.cs b/src/PostIt/PostIt.Tests/BillingCommandPageViewModelTests.cs index c7b5b926b..da366d284 100644 --- a/src/PostIt/PostIt.Tests/BillingCommandPageViewModelTests.cs +++ b/src/PostIt/PostIt.Tests/BillingCommandPageViewModelTests.cs @@ -115,6 +115,26 @@ public class BillingCommandPageViewModelTests } } + [Fact] + public void ApplyLocationFromMap_sets_coordinates_and_updates_status() + { + var api = new RecordingApi(); + var client = new BillingApiClient(api, "https://business.example/api/v1/"); + var vm = + new CommandFormSummary { Id = 12, ActionName = "Rdv", Title = "Rendez-vous" } + .CreateCommandPageViewModel( + new ActivityInfo { Code = "dev", Name = "Développement" }, + new ActivityUserDisplayItem { PerformerId = "perf-1", UserName = "Alice" }, + client) as RdvViewModel; + + vm!.Address = string.Empty; + vm.ApplyLocationFromMap(48.85661234, 2.35224567); + + Assert.Equal(48.856612, vm.Latitude); + Assert.Equal(2.352246, vm.Longitude); + Assert.Contains("Position sélectionnée", vm.StatusMessage, StringComparison.OrdinalIgnoreCase); + } + [Fact] public async Task InitializeAsync_loads_prestations_for_brush_and_submit_posts_selected_prestation() { diff --git a/src/PostIt/PostIt/PostIt.csproj b/src/PostIt/PostIt/PostIt.csproj index 177e346d3..09632bdf8 100644 --- a/src/PostIt/PostIt/PostIt.csproj +++ b/src/PostIt/PostIt/PostIt.csproj @@ -29,6 +29,8 @@ None All + + diff --git a/src/PostIt/PostIt/ViewModels/Commands/RdvViewModel.cs b/src/PostIt/PostIt/ViewModels/Commands/RdvViewModel.cs index afd0c54bd..44293f03e 100644 --- a/src/PostIt/PostIt/ViewModels/Commands/RdvViewModel.cs +++ b/src/PostIt/PostIt/ViewModels/Commands/RdvViewModel.cs @@ -113,6 +113,20 @@ public partial class RdvViewModel : BillingCommandPageViewModel }; } + public void ApplyLocationFromMap(double latitude, double longitude) + { + Latitude = Math.Round(latitude, 6); + Longitude = Math.Round(longitude, 6); + + if (string.IsNullOrWhiteSpace(Address)) + { + this.SetInfoStatus("Position sélectionnée sur la carte. Complétez l'adresse puis envoyez la commande."); + return; + } + + this.SetInfoStatus("Position sélectionnée sur la carte."); + } + protected override async Task SubmitAsync() { diff --git a/src/PostIt/PostIt/Views/Commands/RdvPage.axaml b/src/PostIt/PostIt/Views/Commands/RdvPage.axaml index 4c88b0108..cee3c5c79 100644 --- a/src/PostIt/PostIt/Views/Commands/RdvPage.axaml +++ b/src/PostIt/PostIt/Views/Commands/RdvPage.axaml @@ -1,12 +1,13 @@ - + + + ("LocationMap"); + if (_locationMap is null) + return; + + var map = new Map(); + map.Layers.Add(OpenStreetMap.CreateTileLayer()); + _locationMap.Map = map; + _locationMap.MapTapped += OnMapTapped; + + DataContextChanged += OnDataContextChanged; + CenterFromViewModel(); + } + + private void OnDataContextChanged(object? sender, System.EventArgs e) + { + CenterFromViewModel(); + } + + private void OnMapTapped(object? sender, MapEventArgs e) + { + if (DataContext is not RdvViewModel vm) + return; + + var (longitude, latitude) = SphericalMercator.ToLonLat(e.WorldPosition.X, e.WorldPosition.Y); + vm.ApplyLocationFromMap(latitude, longitude); + CenterMap(latitude, longitude, zoomLevel: 13); + } + + private void CenterFromViewModel() + { + if (DataContext is not RdvViewModel vm) + { + CenterMap(48.8566, 2.3522, zoomLevel: 4); + return; + } + + if (vm.Latitude.HasValue && vm.Longitude.HasValue) + { + CenterMap(vm.Latitude.Value, vm.Longitude.Value, zoomLevel: 13); + return; + } + + CenterMap(48.8566, 2.3522, zoomLevel: 4); + } + + private void CenterMap(double latitude, double longitude, int zoomLevel) + { + if (_locationMap?.Map is null) + return; + + var (x, y) = SphericalMercator.FromLonLat(longitude, latitude); + _locationMap.Map.Navigator.CenterOn(x, y); + _locationMap.Map.Navigator.ZoomToLevel(zoomLevel); + } } From 389cd050daec1e1b0c609c4bc624d121ade9285d Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 6 Sep 2026 17:05:18 +0100 Subject: [PATCH 12/30] postit: add rdv map marker and recenter action --- .../PostIt/Views/Commands/RdvPage.axaml | 20 ++-- .../PostIt/Views/Commands/RdvPage.axaml.cs | 92 ++++++++++++++++++- 2 files changed, 101 insertions(+), 11 deletions(-) diff --git a/src/PostIt/PostIt/Views/Commands/RdvPage.axaml b/src/PostIt/PostIt/Views/Commands/RdvPage.axaml index cee3c5c79..a3cb477b1 100644 --- a/src/PostIt/PostIt/Views/Commands/RdvPage.axaml +++ b/src/PostIt/PostIt/Views/Commands/RdvPage.axaml @@ -40,12 +40,20 @@ -