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)