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 #1658 from CTemplar/dev
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
The-Hidden-Hand authored Feb 18, 2022
2 parents ed350e7 + 8a4fe48 commit 5e31722
Show file tree
Hide file tree
Showing 25 changed files with 220 additions and 502 deletions.
594 changes: 140 additions & 454 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ctemplar",
"version": "2.5.66",
"version": "2.5.67",
"license": "Apache",
"main": "electron-main.js",
"description": "Angular webclient (with Linux, macOS and Windows desktop clients) for CTemplar's encrypted email service.",
Expand Down Expand Up @@ -95,7 +95,7 @@
"husky": "^6.0.0",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma": "~6.3.14",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@
.attachment-content {
padding-left: 25px;
}

.msg-reply-content {
overflow: auto;
}
28 changes: 21 additions & 7 deletions src/app/mail/mail-detail/mail-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1437,17 +1437,21 @@ export class MailDetailComponent implements OnInit, OnDestroy {
mail.receiver_display?.length > 0
? mail.receiver_display
.map(receiver =>
EmailFormatPipe.transformToFormattedEmail(receiver.email, receiver.name, true, mail.is_html !== false),
xss.escapeHtml(
EmailFormatPipe.transformToFormattedEmail(receiver.email, receiver.name, true, mail.is_html !== false),
),
)
.join(', ')
: mail.receiver.join(', ');
let content =
`</br>---------- Forwarded message ----------</br>` +
`From: ${EmailFormatPipe.transformToFormattedEmail(
mail.sender_display.email,
xss.escapeHtml(mail.sender_display.name),
true,
mail.is_html !== false,
`From: ${xss.escapeHtml(
EmailFormatPipe.transformToFormattedEmail(
mail.sender_display.email,
xss.escapeHtml(mail.sender_display.name),
true,
mail.is_html !== false,
),
)}</br>` +
`Date: ${
mail.sent_at
Expand All @@ -1458,7 +1462,17 @@ export class MailDetailComponent implements OnInit, OnDestroy {
`To: ${toHeaderString}</br>`;

if (mail.cc.length > 0) {
content += `CC: ${mail.cc.map(cc => `< ${cc} >`).join(', ')}</br>`;
const ccContent =
mail.cc_display?.length > 0
? mail.cc_display
.map(cc =>
xss.escapeHtml(
EmailFormatPipe.transformToFormattedEmail(cc.email, cc.name, true, mail.is_html !== false),
),
)
.join(', ')
: mail.cc.join(', ');
content += `CC: ${ccContent}</br>`;
}
content += `</br>${this.decryptedContents[mail.id]}</br>`;
content = SafePipe.sanitizeEmail(content, this.disableExternalImages);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ export class GenericFolderComponent implements OnInit, AfterViewInit {
this.advancedSearchQuery.size = parameters.size;
this.advancedSearchQuery.size_operator = parameters.size_operator;
this.advancedSearchQuery.exact = parameters.exact;
this.advancedSearchQuery.have_attachment = parameters.have_attachment;
this.store.dispatch(
new GetMails({
forceReload: true,
Expand Down
36 changes: 14 additions & 22 deletions src/app/mail/mail-settings/mail-filters/mail-filters.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,26 @@ <h5 class="ui-header-subtitle text-dark mb-0">
<span [translate]="'settings.set_priority'">Set Priority</span>
</button>
<ng-container *ngTemplateOutlet="setPriorityButtons"></ng-container>
<ul cdkDropList class="ui-list ui-list-styled list-styled" (cdkDropListDropped)="onFilterDrop($event)">
<li *ngFor="let filter of filters; let i = index" class="ui-list-item ui-list-item-xs-full" cdkDrag>
<ul
cdkDropList
[cdkDropListDisabled]="!inSetPriority"
class="ui-list ui-list-styled list-styled"
(cdkDropListDropped)="onFilterDrop($event)"
>
<li
*ngFor="let filter of filters; let i = index"
class="ui-list-item ui-list-item-xs-full"
[class.filter-drag-handle]="inSetPriority"
cdkDrag
cdkDragHandle
>
<div class="row row-xs align-items-center filter-item">
<div class="col-10 col-sm-8 show-ellipses">
<div class="drag-drop-handle" cdkDragHandle *ngIf="inSetPriority">
<i class="fas fa-arrows-alt-v"></i>
</div>
<span>
{{ filter.name }}
</span>
</div>
<div class="col-2 col-sm-4">
<div align="right" *ngIf="inSetPriority">
<i
class="fas fa-chevron-up cursor-pointer mr-2"
[class.hidden]="i === 0"
[ngbTooltip]="'settings.move_up' | translate"
(click)="priorityUp(i)"
>
</i>
<i
class="fas fa-chevron-down cursor-pointer"
[class.hidden]="i === filters.length - 1"
[ngbTooltip]="'settings.move_down' | translate"
(click)="priorityDown(i)"
>
</i>
</div>
<ul
*ngIf="!inSetPriority"
class="setting-actions-list d-flex align-items-center justify-content-end list-styled text-right"
Expand Down Expand Up @@ -193,7 +185,7 @@ <h3 class="modal-title w-100 text-dark" id="customFilterModalLabel">
role="button"
[disabled]="!condition.parameter"
>
{{ condition.condition_text }}
{{ condition.condition ? ('settings.filters.' + condition.condition | translate) : '' }}
</button>
<div ngbDropdownMenu aria-labelledby="filterConditionDropdownMenuBtn-{{ i }}">
<a (click)="onSelectAdvancedCondition(filterCondition.CONTAINS, i)" class="dropdown-item">
Expand Down
4 changes: 4 additions & 0 deletions src/app/mail/mail-settings/mail-settings.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -701,3 +701,7 @@ $error-red: #e94e4c;
.mat-checkbox-row {
height: 24px;
}

.filter-drag-handle {
cursor: move;
}
25 changes: 16 additions & 9 deletions src/app/mail/mail-sidebar/compose-mail/compose-mail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {

_htmlQuotedMailContent: string;

analyzeUsersKeysWithContact$ = new Subject<boolean>();

public set htmlQuotedMailContent(value: string) {
if (!this._htmlQuotedMailContent) {
// store the initial HTML quoted mails
Expand Down Expand Up @@ -391,7 +393,7 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {
}
this.draft = draft;
this.usersKeys = response.usersKeys;
this.analyzeUsersKeysWithContact();
this.analyzeUsersKeysWithContact$.next(true);
const receivers = this.draftMail?.receiver;
if (receivers && receivers.length > 0) {
const receiversToFetchKey = receivers
Expand Down Expand Up @@ -468,7 +470,7 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {
this.clonedContacts =
contactsState.emailContacts === undefined ? contactsState.contacts : contactsState.emailContacts;
this.contactsState = contactsState;
this.analyzeUsersKeysWithContact();
this.analyzeUsersKeysWithContact$.next(true);
this.loadEmailContacts();
});

Expand Down Expand Up @@ -510,7 +512,7 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {
this.selectedMailbox = mailBoxesState.currentMailbox;
}
this.mailBoxesState = mailBoxesState;
this.analyzeUsersKeysWithContact();
this.analyzeUsersKeysWithContact$.next(true);
});

/**
Expand All @@ -536,6 +538,11 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {
}
});

// debounce the calls to analyzeUsersKeysWithContact to avoid switch between PGP_INLINE and PGP_MIME
this.analyzeUsersKeysWithContact$.pipe(debounceTime(500)).subscribe(() => {
this.analyzeUsersKeysWithContact();
});

const now = new Date();
this.datePickerMinDate = {
year: now.getFullYear(),
Expand Down Expand Up @@ -838,7 +845,7 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {
break;
}
this.isSelfDestructionEnable();
this.analyzeUsersKeysWithContact();
this.analyzeUsersKeysWithContact$.next(true);
}

validateEmail(email: string) {
Expand All @@ -854,19 +861,19 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {
onTagEdited($event: any) {
this.mailData.receiver[$event.index] = { display: $event.display, value: $event.value, email: $event.value };
this.isSelfDestructionEnable();
this.analyzeUsersKeysWithContact();
this.analyzeUsersKeysWithContact$.next(true);
}

ccOnTagEdited($event: any) {
this.mailData.cc[$event.index] = { display: $event.display, value: $event.value, email: $event.value };
this.isSelfDestructionEnable();
this.analyzeUsersKeysWithContact();
this.analyzeUsersKeysWithContact$.next(true);
}

bccOnTagEdited($event: any) {
this.mailData.bcc[$event.index] = { display: $event.display, value: $event.value, email: $event.value };
this.isSelfDestructionEnable();
this.analyzeUsersKeysWithContact();
this.analyzeUsersKeysWithContact$.next(true);
}
/**
* End Tag editing
Expand Down Expand Up @@ -1022,7 +1029,7 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {
this.isSignatureAdded = false;
this.updateSignature();
this.valueChanged$.next(this.selectedMailbox);
this.analyzeUsersKeysWithContact();
this.analyzeUsersKeysWithContact$.next(true);
}

onImagesSelected(files: FileList) {
Expand Down Expand Up @@ -1951,7 +1958,7 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {
);
}
this.valueChanged$.next(data);
this.analyzeUsersKeysWithContact();
this.analyzeUsersKeysWithContact$.next(true);
this.isSelfDestructionEnable();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@
[(ngModel)]="sameExactly"
[ngModelOptions]="{ standalone: true }"
>
Same exactly
</mat-checkbox>
<label for="sameExactly" class="fancy-field-empty">Same exactly</label>
</div>
<div class="col-6">
<mat-checkbox
Expand All @@ -249,8 +249,8 @@
[(ngModel)]="hasAttachment"
[ngModelOptions]="{ standalone: true }"
>
Has attachment
</mat-checkbox>
<label for="hasAttachment" class="fancy-field-empty">Has attachment</label>
</div>
</div>
<div class="d-flex justify-content-between mt-4">
Expand Down
4 changes: 2 additions & 2 deletions src/app/shared/pipes/safe.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class SafePipe implements PipeTransform {
return this.sanitizer.bypassSecurityTrustUrl(value);
case 'sanitize':
// Move style from style tag to inline style
value = juice(value);
value = juice(value, { preserveFontFaces: false, preserveMediaQueries: false });
// Sanitize Mail
value = SafePipe.processSanitizationForEmail(value, disableExternalImages);
return this.sanitizer.bypassSecurityTrustHtml(value);
Expand Down Expand Up @@ -365,7 +365,7 @@ export class SafePipe implements PipeTransform {
* @returns sanitized content
*/
static sanitizeEmail(value: string, disableExternalImages: boolean) {
value = juice(value);
value = juice(value, { preserveFontFaces: false, preserveMediaQueries: false });
// Sanitize Mail
value = SafePipe.processSanitizationForEmail(value, disableExternalImages);
return value;
Expand Down
4 changes: 0 additions & 4 deletions src/app/store/quotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,6 @@ export const quotes = [
content: 'Blind belief in authority is the greatest enemy of truth.',
author: '- Albert Einstein -',
},
{
content: "People can tell you to keep your mouth shut, but that doesn't stop you from having your own opinion.",
author: '- Anne Frank -',
},
{
content: 'Few are those who see with their own eyes and feel with their own hearts.',
author: '- Albert Einstein -',
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"contains": "Contains",
"not_contains": "Does Not Contain",
"starts_with": "Starts With",
"startswith": "Starts With",
"not_startswith": "Does Not Starts With",
"endswith": "Ends With",
"not_endswith": "Does Not Ends With",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"contains": "enthält",
"not_contains": "enthält nicht",
"starts_with": "beginnt mit",
"startswith": "beginnt mit",
"not_startswith": "beginnt nich tmit",
"endswith": "endet mit",
"not_endswith": "endet nicht mit",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"contains": "contains",
"not_contains": "doesn't contain",
"starts_with": "starts with",
"startswith": "starts with",
"not_startswith": "doesn't start with",
"endswith": "ends with",
"not_endswith": "doesn't end with",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"contains": "Contains",
"not_contains": "Does Not Contain",
"starts_with": "starts with",
"startswith": "starts with",
"not_startswith": "Does Not Starts With",
"endswith": "Ends With",
"not_endswith": "Does Not Ends With",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"contains": "Contains",
"not_contains": "Does Not Contain",
"starts_with": "Commence par",
"startswith": "Commence par",
"not_startswith": "Does Not Starts With",
"endswith": "Ends With",
"not_endswith": "Does Not Ends With",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"contains": "Contains",
"not_contains": "Does Not Contain",
"starts_with": "inizia con",
"startswith": "inizia con",
"not_startswith": "Does Not Starts With",
"endswith": "Ends With",
"not_endswith": "Does Not Ends With",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"contains": "含む",
"not_contains": "含まない",
"starts_with": "~で始まる",
"startswith": "~で始まる",
"not_startswith": "~で始まらない",
"endswith": "~で終わる",
"not_endswith": "~で終わらない",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"contains": "Contains",
"not_contains": "Does Not Contain",
"starts_with": "zaczyna się na",
"startswith": "zaczyna się na",
"not_startswith": "Does Not Starts With",
"endswith": "Ends With",
"not_endswith": "Does Not Ends With",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"contains": "Contains",
"not_contains": "Does Not Contain",
"starts_with": "começa com",
"startswith": "começa com",
"not_startswith": "Does Not Starts With",
"endswith": "Ends With",
"not_endswith": "Does Not Ends With",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"contains": "Contains",
"not_contains": "Does Not Contain",
"starts_with": "începe cu",
"startswith": "începe cu",
"not_startswith": "Does Not Starts With",
"endswith": "Ends With",
"not_endswith": "Does Not Ends With",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"contains": "Contains",
"not_contains": "Does Not Contain",
"starts_with": "начинается с",
"startswith": "начинается с",
"not_startswith": "Does Not Starts With",
"endswith": "Ends With",
"not_endswith": "Does Not Ends With",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"contains": "içeriyorsa",
"not_contains": "içermiyorsa",
"starts_with": "ile başlıyorsa",
"startswith": "ile başlıyorsa",
"not_startswith": "ile başlamıyorsa",
"endswith": "bu şekilde bitiyorsa",
"not_endswith": "bu şekilde bitmiyorsa",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
"contains": "Contains",
"not_contains": "Does Not Contain",
"starts_with": "починається з",
"startswith": "починається з",
"not_startswith": "Does Not Starts With",
"endswith": "Ends With",
"not_endswith": "Does Not Ends With",
Expand Down
Loading

0 comments on commit 5e31722

Please sign in to comment.