MOBILE-3833 forum: Fix check empty discussion list
parent
7383dc1974
commit
c6bdde182c
|
@ -40,11 +40,11 @@
|
||||||
</ion-card>
|
</ion-card>
|
||||||
|
|
||||||
<ng-container *ngIf="forum">
|
<ng-container *ngIf="forum">
|
||||||
<core-empty-box *ngIf="!discussions || discussions.empty" icon="far-comments"
|
<core-empty-box *ngIf="!discussions || !discussions.hasDiscussions" icon="far-comments"
|
||||||
[message]="'addon.mod_forum.forumnodiscussionsyet' | translate">
|
[message]="'addon.mod_forum.forumnodiscussionsyet' | translate">
|
||||||
</core-empty-box>
|
</core-empty-box>
|
||||||
|
|
||||||
<div *ngIf="discussions && !discussions.empty && sortingAvailable && selectedSortOrder" class="ion-text-wrap">
|
<div *ngIf="discussions?.hasDiscussions && sortingAvailable && selectedSortOrder" class="ion-text-wrap">
|
||||||
<core-combobox [modalOptions]="sortOrderSelectorModalOptions" listboxId="addon-mod-forum-sort-selector"
|
<core-combobox [modalOptions]="sortOrderSelectorModalOptions" listboxId="addon-mod-forum-sort-selector"
|
||||||
[label]="('core.sort' | translate)" (onChange)="setSortOrder($event)" [selection]="selectedSortOrder.label | translate"
|
[label]="('core.sort' | translate)" (onChange)="setSortOrder($event)" [selection]="selectedSortOrder.label | translate"
|
||||||
interface="modal">
|
interface="modal">
|
||||||
|
|
|
@ -705,4 +705,16 @@ class AddonModForumDiscussionsManager extends CoreListItemsManager<AddonModForum
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether there is any discussion in the items.
|
||||||
|
*
|
||||||
|
* @return Whether there is a discussion.
|
||||||
|
*/
|
||||||
|
get hasDiscussions(): boolean {
|
||||||
|
const source = this.getSource();
|
||||||
|
const items = source.getItems();
|
||||||
|
|
||||||
|
return items !== null && items.some(item => !source.isNewDiscussionForm(item));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue