From c8b55a9bc490c0171acb450740321620669a6ecf Mon Sep 17 00:00:00 2001 From: BelsethUwU Date: Fri, 9 Jun 2023 13:11:27 +0200 Subject: [PATCH] =?UTF-8?q?fix=20:=20pas=20de=20delete=20de=20review=20qui?= =?UTF-8?q?=20sont=20pas=20=C3=A0=20nous?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Stim/DetailledPage.xaml.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Sources/Stim/DetailledPage.xaml.cs b/Sources/Stim/DetailledPage.xaml.cs index 6b8a9b6..7133f2f 100644 --- a/Sources/Stim/DetailledPage.xaml.cs +++ b/Sources/Stim/DetailledPage.xaml.cs @@ -32,13 +32,17 @@ public partial class DetailledPage : ContentPage private async void RemoveReview(object sender, EventArgs e) { - var res = await this.ShowPopupAsync(new ConfirmationPopup("Voulez-vous vraiment supprimer votre commentaire ?")); - if (res != null && res is bool v && v) + if (((sender as ImageButton).BindingContext as Review).AuthorName == ((App)App.Current).Manager.CurrentUser.Username) { - (App.Current as App).Manager.SelectedGame.RemoveReview((sender as ImageButton).BindingContext as Review); - (App.Current as App).Manager.SaveGames(); - await this.ShowPopupAsync(new MessagePopup("Commentaire supprimé !")); + var res = await this.ShowPopupAsync(new ConfirmationPopup("Voulez-vous vraiment supprimer votre commentaire ?")); + if (res != null && res is bool v && v) + { + (App.Current as App).Manager.SelectedGame.RemoveReview((sender as ImageButton).BindingContext as Review); + (App.Current as App).Manager.SaveGames(); + await this.ShowPopupAsync(new MessagePopup("Commentaire supprimé !")); + } } + else await this.ShowPopupAsync(new MessagePopup("Ce commentaire ne vous appartiens pas")); } private async void AddFollow(object sender, EventArgs e)