Skip to content
This repository has been archived by the owner on May 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #231 from CTemplar/dev
Browse files Browse the repository at this point in the history
Release v1.1.1
  • Loading branch information
atifsaddique211f committed Sep 28, 2018
2 parents acbb12e + d65a569 commit 4058f95
Show file tree
Hide file tree
Showing 25 changed files with 118 additions and 261 deletions.
11 changes: 10 additions & 1 deletion src/app/mail/mail-detail/mail-detail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,17 @@ <h5 class="ui-header-subtitle text-dark mb-0">
<app-progress-bar [active]="!decryptedContents[mail.id]"></app-progress-bar>

<div class="ui-body" *ngIf="decryptedContents[mail.id]">
<div class="msg-reply-content text-dark" id="{{mail.id}}-mail-content"
<div [ngClass]="{'show_gmail_extra': mailOptions[mail.id]?.showGmailExtraContent}">
<div class="msg-reply-content text-dark" id="{{mail.id}}-mail-content"
[innerHTML]="decryptedContents[mail.id] | safe: 'html'"></div>
<a href="javascript:void(0)" (click)="toggleGmailExtra(mail)"
*ngIf="decryptedContents[mail.id]?.indexOf('gmail_extra') > -1 || decryptedContents[mail.id]?.indexOf('gmail_quote') > -1" >
<div class="ellipsis-wrapper" placement="top"
[ngbTooltip]="mailOptions[mail.id]?.showGmailExtraContent ? 'Hide extra content' : 'Show trimmed content'">
<div class="gmail-ellipsis"></div>
</div>
</a>
</div>
</div>

<ul class="list-style-none mt-3">
Expand Down

This file was deleted.

Empty file.
25 changes: 0 additions & 25 deletions src/app/mail/mail-list/mail-folder/draft/draft.component.spec.ts

This file was deleted.

36 changes: 0 additions & 36 deletions src/app/mail/mail-list/mail-folder/draft/draft.component.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@
<div class="col-sm-4 mailbox-actionbar-col hidden-xs-down" *ngIf="mails?.length>0">
<div class="mail-controls d-flex align-items-center justify-content-end">
<div class="mail-result-text text-muted">
<small>1-{{mails?.length}} of {{mails?.length}}</small>
<small>{{ OFFSET }} - {{(LIMIT > MAX_EMAIL_PAGE_LIMIT - OFFSET) ? MAX_EMAIL_PAGE_LIMIT : LIMIT }} of {{ MAX_EMAIL_PAGE_LIMIT }}</small>
</div>
<div class="mail-nav-control">
<button role="button" class="mail-nav-control-prev">
<button role="button" class="mail-nav-control-prev" (click)="prevPage()">
<i class="icon icon-chevron-left"></i>
</button>
<button role="button" class="mail-nav-control-next">
<button role="button" class="mail-nav-control-next" (click)="nextPage()">
<i class="icon icon-chevron-right"></i>
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ export class GenericFolderComponent implements OnInit, OnDestroy, OnChanges {
readonly AUTO_REFRESH_DURATION: number = 10000; // duration in milliseconds
readonly destroyed$: Observable<boolean>;

MAX_EMAIL_PAGE_LIMIT: number = 1;
LIMIT: number;
OFFSET: number = 0;
PAGE: number = 0;

constructor(public store: Store<AppState>,
private router: Router,
private sharedService: SharedService,
Expand All @@ -44,20 +49,26 @@ export class GenericFolderComponent implements OnInit, OnDestroy, OnChanges {

ngOnInit() {
this.store.dispatch(new SetCurrentFolder(this.mailFolder));
if (this.fetchMails) {
this.store.dispatch(new GetMails({ limit: 1000, offset: 0, folder: this.mailFolder }));
}

this.store.select(state => state.mail).takeUntil(this.destroyed$)
.subscribe((mailState: MailState) => {
this.showProgress = !mailState.loaded || mailState.inProgress;
if (this.fetchMails) {
this.MAX_EMAIL_PAGE_LIMIT = mailState.total_mail_count;
this.mails = this.sharedService.sortByDate(mailState.mails, 'created_at');
}
});

this.store.select(state => state.user).takeUntil(this.destroyed$)
.subscribe((user: UserState) => {
this.userState = user;
if (this.fetchMails && this.userState.settings) {
this.LIMIT = user.settings.emails_per_page;
if (this.LIMIT) {
this.store.dispatch(new GetMails({ limit: user.settings.emails_per_page, offset: this.OFFSET, folder: this.mailFolder }));
this.initializeAutoRefresh();
}
}
});

this.store.select(state => state.mailboxes).takeUntil(this.destroyed$)
Expand All @@ -72,7 +83,6 @@ export class GenericFolderComponent implements OnInit, OnDestroy, OnChanges {
// TODO: apply search
});

this.initializeAutoRefresh();
}

ngOnChanges(changes: SimpleChanges) {
Expand All @@ -96,9 +106,9 @@ export class GenericFolderComponent implements OnInit, OnDestroy, OnChanges {

refresh(forceReload: boolean = false) {
if (!forceReload && this.mailFolder === MailFolderType.INBOX) {
this.store.dispatch(new GetMails({ limit: 1000, offset: 0, folder: this.mailFolder, read: false, seconds: 30 }));
this.store.dispatch(new GetMails({ limit: this.LIMIT, offset: 0, folder: this.mailFolder, read: false, seconds: 30 }));
} else {
this.store.dispatch(new GetMails({ forceReload, limit: 1000, offset: 0, folder: this.mailFolder }));
this.store.dispatch(new GetMails({ forceReload, limit: this.LIMIT, offset: this.OFFSET, folder: this.mailFolder }));
}
}

Expand Down Expand Up @@ -164,8 +174,7 @@ export class GenericFolderComponent implements OnInit, OnDestroy, OnChanges {
openMail(mail: Mail) {
if (this.mailFolder === MailFolderType.DRAFT) {
this.composeMailService.openComposeMailDialog({ draft: mail });
}
else {
} else {
this.store.dispatch(new GetMailDetailSuccess(mail));
this.router.navigate([`/mail/${this.mailFolder}/message/`, mail.id]);
}
Expand Down Expand Up @@ -249,6 +258,22 @@ export class GenericFolderComponent implements OnInit, OnDestroy, OnChanges {
});
}

prevPage() {
if (this.PAGE > 0) {
this.PAGE--;
this.OFFSET = this.PAGE * this.LIMIT;
this.store.dispatch(new GetMails({ limit: this.LIMIT, offset: this.OFFSET, folder: this.mailFolder }));
}
}

nextPage() {
if (((this.PAGE + 1) * this.LIMIT) < this.MAX_EMAIL_PAGE_LIMIT) {
this.OFFSET = (this.PAGE + 1) * this.LIMIT;
this.PAGE++;
this.store.dispatch(new GetMails({ limit: this.LIMIT, offset: this.OFFSET, folder: this.mailFolder }));
}
}

/**
* @name getMailIDs
* @description Get list of comma separated IDs from mail object list
Expand Down

This file was deleted.

Empty file.
25 changes: 0 additions & 25 deletions src/app/mail/mail-list/mail-folder/inbox/inbox.component.spec.ts

This file was deleted.

36 changes: 0 additions & 36 deletions src/app/mail/mail-list/mail-folder/inbox/inbox.component.ts

This file was deleted.

This file was deleted.

Empty file.
25 changes: 0 additions & 25 deletions src/app/mail/mail-list/mail-folder/trash/trash.component.spec.ts

This file was deleted.

36 changes: 0 additions & 36 deletions src/app/mail/mail-list/mail-folder/trash/trash.component.ts

This file was deleted.

12 changes: 9 additions & 3 deletions src/app/mail/mail-list/mail-list.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
<div [ngSwitch]="mailFolder">
<app-inbox *ngSwitchCase="mailFolderTypes.INBOX"></app-inbox>
<app-draft *ngSwitchCase="mailFolderTypes.DRAFT"></app-draft>
<app-trash *ngSwitchCase="mailFolderTypes.TRASH"></app-trash>
<app-generic-folder *ngSwitchCase="mailFolderTypes.INBOX"
[fetchMails]="true"
[mailFolder]="mailFolderTypes.INBOX"></app-generic-folder>
<app-generic-folder *ngSwitchCase="mailFolderTypes.DRAFT"
[fetchMails]="true"
[mailFolder]="mailFolderTypes.DRAFT"></app-generic-folder>
<app-generic-folder *ngSwitchCase="mailFolderTypes.TRASH"
[fetchMails]="true"
[mailFolder]="mailFolderTypes.TRASH"></app-generic-folder>
<app-generic-folder *ngSwitchCase="mailFolderTypes.SENT"
[fetchMails]="true"
[mailFolder]="mailFolderTypes.SENT"></app-generic-folder>
Expand Down
Loading

0 comments on commit 4058f95

Please sign in to comment.