MOBILE-4362 comments: Fix delete button displayed when it shouldn't

The show delete button icon now also changes so it's clearer that something happened, otherwise if you cannot delete any of the comments you see it could seem that the button does nothing
main
Dani Palou 2023-10-11 11:08:34 +02:00
parent 1a44478da1
commit 4e98e9f64a
3 changed files with 5 additions and 3 deletions

View File

@ -35,8 +35,8 @@
color="danger" (click)="delete($event)" [attr.aria-label]="'addon.messages.deletemessage' | translate" class="delete-button"> color="danger" (click)="delete($event)" [attr.aria-label]="'addon.messages.deletemessage' | translate" class="delete-button">
<ion-icon name="fas-trash" slot="icon-only" aria-hidden="true"></ion-icon> <ion-icon name="fas-trash" slot="icon-only" aria-hidden="true"></ion-icon>
</ion-button> </ion-button>
<ion-button *ngIf="showDelete && message.deleted" fill="clear" color="danger" (click)="undoDelete($event)" <ion-button *ngIf="showDelete && message.deleted" fill="clear" [@coreSlideInOut]="'fromRight'" color="danger"
[attr.aria-label]="'core.restore' | translate" class="delete-button"> (click)="undoDelete($event)" [attr.aria-label]="'core.restore' | translate" class="delete-button">
<ion-icon name="fas-rotate-left" slot="icon-only" aria-hidden="true"></ion-icon> <ion-icon name="fas-rotate-left" slot="icon-only" aria-hidden="true"></ion-icon>
</ion-button> </ion-button>
</div> </div>

View File

@ -12,7 +12,8 @@
<ion-buttons slot="end"> <ion-buttons slot="end">
<ion-button *ngIf="canDeleteComments" slot="end" fill="clear" (click)="toggleDelete()" <ion-button *ngIf="canDeleteComments" slot="end" fill="clear" (click)="toggleDelete()"
[attr.aria-label]="'core.toggledelete' | translate"> [attr.aria-label]="'core.toggledelete' | translate">
<ion-icon name="fas-pen" slot="icon-only" aria-hidden="true"></ion-icon> <ion-icon *ngIf="!showDelete" name="fas-pen" slot="icon-only" aria-hidden="true"></ion-icon>
<ion-icon *ngIf="showDelete" name="fas-check" slot="icon-only" aria-hidden="true"></ion-icon>
</ion-button> </ion-button>
<core-context-menu> <core-context-menu>
<core-context-menu-item [hidden]="!(commentsLoaded && !hasOffline)" [priority]="100" [content]="'core.refresh' | translate" <core-context-menu-item [hidden]="!(commentsLoaded && !hasOffline)" [priority]="100" [content]="'core.refresh' | translate"

View File

@ -222,6 +222,7 @@ export class CoreCommentsViewerPage implements OnInit, OnDestroy {
comment.showDate = this.showDate(comment, prevComment); comment.showDate = this.showDate(comment, prevComment);
comment.showUserData = this.showUserData(comment, prevComment); comment.showUserData = this.showUserData(comment, prevComment);
comment.showTail = this.showTail(comment, prevComment); comment.showTail = this.showTail(comment, prevComment);
comment.delete = comment.delete ?? false; // If this property is undefined, core-message assumes comment can be deleted.
} }
/** /**