2021-01-18 16:40:34 +01:00
|
|
|
<ion-header>
|
|
|
|
<ion-toolbar>
|
|
|
|
<ion-buttons slot="start">
|
2021-04-27 15:21:09 +02:00
|
|
|
<ion-back-button [text]="'core.back' | translate"></ion-back-button>
|
2021-01-18 16:40:34 +01:00
|
|
|
</ion-buttons>
|
|
|
|
<ion-title>{{ 'addon.messages.messages' | translate }}</ion-title>
|
|
|
|
<ion-buttons slot="end">
|
2021-04-27 13:14:31 +02:00
|
|
|
<ion-button (click)="gotoSearch()" [attr.aria-label]="'addon.messages.searchcombined' | translate">
|
|
|
|
<ion-icon name="fas-search" slot="icon-only" aria-hidden="true"></ion-icon>
|
2021-01-18 16:40:34 +01:00
|
|
|
</ion-button>
|
2021-01-28 17:23:57 +01:00
|
|
|
<ion-button (click)="gotoSettings()" [attr.aria-label]="'addon.messages.messagepreferences' | translate">
|
2021-04-27 13:14:31 +02:00
|
|
|
<ion-icon name="fas-cog" slot="icon-only" aria-hidden="true"></ion-icon>
|
2021-01-18 16:40:34 +01:00
|
|
|
</ion-button>
|
|
|
|
<!-- Add an empty context menu so discussion page can add items in split view,
|
|
|
|
otherwise the menu disappears in some cases. -->
|
|
|
|
<core-context-menu></core-context-menu>
|
|
|
|
</ion-buttons>
|
|
|
|
</ion-toolbar>
|
|
|
|
</ion-header>
|
|
|
|
<ion-content class="core-expand-max">
|
2021-01-26 12:39:48 +01:00
|
|
|
<core-split-view>
|
2021-03-12 12:22:55 +01:00
|
|
|
<ion-refresher slot="fixed" [disabled]="!loaded || !currentListEl" (ionRefresh)="refreshData($event.target)">
|
2021-01-26 12:39:48 +01:00
|
|
|
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
|
|
|
</ion-refresher>
|
2021-01-18 16:40:34 +01:00
|
|
|
|
2021-01-26 12:39:48 +01:00
|
|
|
<core-loading [hideUntil]="loaded" [message]="loadingMessage">
|
|
|
|
<ion-list>
|
2021-01-28 17:23:57 +01:00
|
|
|
<ion-item class="ion-text-wrap addon-message-discussion" (click)="gotoContacts()"
|
2021-04-29 13:52:38 +02:00
|
|
|
[attr.aria-label]="'addon.messages.contacts' | translate" detail="true" button>
|
2021-04-27 13:14:31 +02:00
|
|
|
<ion-icon name="fas-address-book" slot="start" aria-hidden="true"></ion-icon>
|
2021-01-26 12:39:48 +01:00
|
|
|
<ion-label><h2>{{ 'addon.messages.contacts' | translate }}</h2></ion-label>
|
|
|
|
<ion-badge *ngIf="contactRequestsCount > 0" slot="end">{{contactRequestsCount}}</ion-badge>
|
|
|
|
</ion-item>
|
|
|
|
<!-- Favourite conversations. -->
|
2021-04-27 13:14:31 +02:00
|
|
|
<ion-item-divider class="ion-text-wrap core-expandable" (click)="toggle(favourites)" sticky="true"
|
|
|
|
[attr.aria-label]="(favourites.expanded ? 'core.collapse' : 'core.expand') | translate"
|
2021-04-29 13:52:38 +02:00
|
|
|
[attr.aria-expanded]="favourites.expanded" role="heading button">
|
2021-04-27 13:14:31 +02:00
|
|
|
<ion-icon *ngIf="!favourites.expanded" name="fas-caret-right" slot="start" aria-hidden="true"></ion-icon>
|
|
|
|
<ion-icon *ngIf="favourites.expanded" name="fas-caret-down" slot="start" aria-hidden="true"></ion-icon>
|
2021-01-26 12:39:48 +01:00
|
|
|
<ion-label>{{ 'core.favourites' | translate }} ({{ favourites.count }})</ion-label>
|
|
|
|
<ion-badge slot="end" *ngIf="favourites.unread">{{ favourites.unread }}</ion-badge>
|
|
|
|
</ion-item-divider>
|
|
|
|
<div [hidden]="!favourites.conversations || !favourites.expanded || favourites.loading" #favlist>
|
|
|
|
<ng-container *ngTemplateOutlet="conversationsTemplate; context: {conversations: favourites.conversations}">
|
|
|
|
</ng-container>
|
|
|
|
<!-- The infinite loading cannot be inside the ng-template, it fails because it doesn't find ion-content. -->
|
2021-01-28 17:23:57 +01:00
|
|
|
<core-infinite-loading [enabled]="favourites.canLoadMore" (action)="loadMoreConversations(favourites, $event)"
|
|
|
|
[error]="favourites.loadMoreError"></core-infinite-loading>
|
2021-01-26 12:39:48 +01:00
|
|
|
<ion-item class="ion-text-wrap" *ngIf="favourites.conversations && favourites.conversations.length == 0">
|
|
|
|
<ion-label><p>{{ 'addon.messages.nofavourites' | translate }}</p></ion-label>
|
|
|
|
</ion-item>
|
|
|
|
</div>
|
|
|
|
<ion-item class="ion-text-center" *ngIf="favourites.loading">
|
|
|
|
<ion-label><ion-spinner></ion-spinner></ion-label>
|
2021-01-18 16:40:34 +01:00
|
|
|
</ion-item>
|
|
|
|
|
2021-01-26 12:39:48 +01:00
|
|
|
<!-- Group conversations. -->
|
2021-04-27 13:14:31 +02:00
|
|
|
<ion-item-divider class="ion-text-wrap core-expandable" (click)="toggle(group)" sticky="true"
|
|
|
|
[attr.aria-label]="(group.expanded ? 'core.collapse' : 'core.expand') | translate"
|
2021-04-29 13:52:38 +02:00
|
|
|
[attr.aria-expanded]="group.expanded" role="heading button">
|
2021-04-27 13:14:31 +02:00
|
|
|
<ion-icon *ngIf="!group.expanded" name="fas-caret-right" slot="start" aria-hidden="true"></ion-icon>
|
|
|
|
<ion-icon *ngIf="group.expanded" name="fas-caret-down" slot="start" aria-hidden="true"></ion-icon>
|
2021-01-26 12:39:48 +01:00
|
|
|
<ion-label>{{ 'addon.messages.groupconversations' | translate }} ({{ group.count }})</ion-label>
|
|
|
|
<ion-badge slot="end" *ngIf="group.unread">{{ group.unread }}</ion-badge>
|
|
|
|
</ion-item-divider>
|
|
|
|
<div [hidden]="!group.conversations || !group.expanded || group.loading" #grouplist>
|
2021-01-28 17:23:57 +01:00
|
|
|
<ng-container *ngTemplateOutlet="conversationsTemplate; context: {conversations: group.conversations}">
|
|
|
|
</ng-container>
|
2021-01-26 12:39:48 +01:00
|
|
|
<!-- The infinite loading cannot be inside the ng-template, it fails because it doesn't find ion-content. -->
|
2021-01-28 17:23:57 +01:00
|
|
|
<core-infinite-loading [enabled]="group.canLoadMore" (action)="loadMoreConversations(group, $event)"
|
|
|
|
[error]="group.loadMoreError"></core-infinite-loading>
|
2021-01-26 12:39:48 +01:00
|
|
|
<ion-item class="ion-text-wrap" *ngIf="group.conversations && group.conversations.length == 0">
|
|
|
|
<ion-label><p>{{ 'addon.messages.nogroupconversations' | translate }}</p></ion-label>
|
|
|
|
</ion-item>
|
|
|
|
</div>
|
|
|
|
<ion-item class="ion-text-center" *ngIf="group.loading">
|
|
|
|
<ion-label><ion-spinner></ion-spinner></ion-label>
|
2021-01-18 16:40:34 +01:00
|
|
|
</ion-item>
|
|
|
|
|
2021-04-27 13:14:31 +02:00
|
|
|
<ion-item-divider class="ion-text-wrap core-expandable" (click)="toggle(individual)" sticky="true"
|
|
|
|
[attr.aria-label]="(individual.expanded ? 'core.collapse' : 'core.expand') | translate"
|
2021-04-29 13:52:38 +02:00
|
|
|
[attr.aria-expanded]="individual.expanded" role="heading button">
|
2021-04-27 13:14:31 +02:00
|
|
|
<ion-icon *ngIf="!individual.expanded" name="fas-caret-right" slot="start" aria-hidden="true"></ion-icon>
|
|
|
|
<ion-icon *ngIf="individual.expanded" name="fas-caret-down" slot="start" aria-hidden="true"></ion-icon>
|
2021-01-26 12:39:48 +01:00
|
|
|
<ion-label>{{ 'addon.messages.individualconversations' | translate }} ({{ individual.count }})</ion-label>
|
|
|
|
<ion-badge slot="end" *ngIf="individual.unread">{{ individual.unread }}</ion-badge>
|
|
|
|
</ion-item-divider>
|
|
|
|
<div [hidden]="!individual.conversations || !individual.expanded || individual.loading" #indlist>
|
2021-01-28 17:23:57 +01:00
|
|
|
<ng-container *ngTemplateOutlet="conversationsTemplate; context: {conversations: individual.conversations}">
|
|
|
|
</ng-container>
|
2021-01-26 12:39:48 +01:00
|
|
|
<!-- The infinite loading cannot be inside the ng-template, it fails because it doesn't find ion-content. -->
|
2021-01-28 17:23:57 +01:00
|
|
|
<core-infinite-loading [enabled]="individual.canLoadMore" (action)="loadMoreConversations(individual, $event)"
|
|
|
|
[error]="individual.loadMoreError"></core-infinite-loading>
|
2021-01-26 12:39:48 +01:00
|
|
|
<ion-item class="ion-text-wrap" *ngIf="individual.conversations && individual.conversations.length == 0">
|
|
|
|
<ion-label><p>{{ 'addon.messages.noindividualconversations' | translate }}</p></ion-label>
|
|
|
|
</ion-item>
|
|
|
|
</div>
|
|
|
|
<ion-item class="ion-text-center" *ngIf="individual.loading">
|
|
|
|
<ion-label><ion-spinner></ion-spinner></ion-label>
|
2021-01-18 16:40:34 +01:00
|
|
|
</ion-item>
|
|
|
|
|
2021-01-26 12:39:48 +01:00
|
|
|
</ion-list>
|
|
|
|
</core-loading>
|
|
|
|
</core-split-view>
|
2021-01-18 16:40:34 +01:00
|
|
|
</ion-content>
|
|
|
|
|
|
|
|
<!-- Template to render a list of conversations. -->
|
|
|
|
<ng-template #conversationsTemplate let-conversations="conversations">
|
2021-04-29 13:52:38 +02:00
|
|
|
<ion-item class="ion-text-wrap addon-message-discussion" *ngFor="let conversation of conversations" button
|
|
|
|
[attr.aria-label]="conversation.name" (click)="gotoConversation(conversation.id, conversation.userid)"
|
2021-05-03 10:08:20 +02:00
|
|
|
[attr.aria-current]="((conversation.id && conversation.id == selectedConversationId) ||
|
|
|
|
(conversation.userid && conversation.userid == selectedUserId)) ? 'page': 'false'"
|
2021-01-28 17:23:57 +01:00
|
|
|
id="addon-message-conversation-{{ conversation.id ? conversation.id : 'user-' + conversation.userid }}">
|
2021-01-18 16:40:34 +01:00
|
|
|
<!-- Group conversation image. -->
|
|
|
|
<ion-avatar slot="start" *ngIf="conversation.type == typeGroup">
|
2021-01-28 17:23:57 +01:00
|
|
|
<img [src]="conversation.imageurl" [alt]="conversation.name" core-external-content
|
|
|
|
onError="this.src='assets/img/group-avatar.png'">
|
2021-01-18 16:40:34 +01:00
|
|
|
</ion-avatar>
|
|
|
|
|
|
|
|
<!-- Avatar for individual conversations. -->
|
|
|
|
<core-user-avatar *ngIf="conversation.type != typeGroup" core-user-avatar [user]="conversation.otherUser"
|
|
|
|
[linkProfile]="false" [checkOnline]="conversation.showonlinestatus" slot="start"></core-user-avatar>
|
|
|
|
|
|
|
|
<ion-label>
|
|
|
|
<h2>
|
|
|
|
<core-format-text [text]="conversation.name" contextLevel="system" [contextInstanceId]="0"></core-format-text>
|
2021-01-28 17:23:57 +01:00
|
|
|
<ion-icon name="fas-user-slash" *ngIf="conversation.isblocked"
|
|
|
|
[title]="'addon.messages.contactblocked' | translate"></ion-icon>
|
|
|
|
<ion-icon *ngIf="conversation.ismuted" name="fas-volume-mute"
|
|
|
|
[title]="'addon.messages.mutedconversation' | translate"></ion-icon>
|
2021-01-18 16:40:34 +01:00
|
|
|
</h2>
|
2021-01-28 17:23:57 +01:00
|
|
|
<p *ngIf="conversation.subname"><core-format-text [text]="conversation.subname" contextLevel="system"
|
|
|
|
[contextInstanceId]="0"></core-format-text></p>
|
2021-01-18 16:40:34 +01:00
|
|
|
<p class="addon-message-last-message">
|
2021-01-28 17:23:57 +01:00
|
|
|
<span *ngIf="conversation.sentfromcurrentuser" class="addon-message-last-message-user">
|
|
|
|
{{ 'addon.messages.you' | translate }}
|
|
|
|
</span>
|
|
|
|
<span *ngIf="!conversation.sentfromcurrentuser && conversation.type == typeGroup && conversation.members[0]"
|
|
|
|
class="addon-message-last-message-user">{{ conversation.members[0].fullname + ':' }}</span>
|
|
|
|
<core-format-text clean="true" singleLine="true" [text]="conversation.lastmessage"
|
|
|
|
class="addon-message-last-message-text" contextLevel="system" [contextInstanceId]="0"></core-format-text>
|
2021-01-18 16:40:34 +01:00
|
|
|
</p>
|
|
|
|
</ion-label>
|
2021-03-09 11:22:21 +01:00
|
|
|
<ion-note *ngIf="conversation.lastmessagedate > 0 || conversation.unreadcount" slot="end">
|
|
|
|
<ion-badge *ngIf="conversation.unreadcount > 0">{{ conversation.unreadcount }}</ion-badge>
|
|
|
|
<span *ngIf="conversation.lastmessagedate > 0">{{conversation.lastmessagedate | coreDateDayOrTime}}</span>
|
|
|
|
</ion-note>
|
2021-01-18 16:40:34 +01:00
|
|
|
</ion-item>
|
|
|
|
</ng-template>
|