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

Commit 4da57cf

Browse files
Merge pull request #1675 from CTemplar/dev
Release
2 parents 5e31722 + 6bb43af commit 4da57cf

File tree

9 files changed

+68
-40
lines changed

9 files changed

+68
-40
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,19 @@
22
name: Bug report
33
about: Report here if you found something isn't working as expected.
44
title: ''
5-
labels: ''
5+
labels: 'bug'
66
assignees: ''
77
---
88

99
### Your environment
1010

1111
Include, at least, your web browser version and the operative system.
1212

13-
### Steps to reproduce
13+
### Picture, video or steps to reproduce
1414

1515
1. Tell us how to reproduce this issue, step by step.
1616
2. You can include media content like images or videos.
1717

18-
### Expected behavior
18+
### Explanation
1919

20-
Tell us what should happen.
21-
22-
### Actual behavior
23-
24-
Tell us what happens instead.
20+
Tell us any extra details.

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Feature request
33
about: Suggest here if you have any new feature or improvement request.
44
title: ''
5-
labels: ''
5+
labels: 'enhacement'
66
assignees: ''
77
---
88

.github/pull_request_template.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
Fixes #
2-
3-
### Changes description
4-
5-
-
1+
Fixes task (link or #num):

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ctemplar",
3-
"version": "2.5.67",
3+
"version": "2.5.68",
44
"license": "Apache",
55
"main": "electron-main.js",
66
"description": "Angular webclient (with Linux, macOS and Windows desktop clients) for CTemplar's encrypted email service.",

src/app/mail/mail-settings/security/security.component.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,46 @@ <h5 class="ui-header-subtitle text-dark mb-0">
214214
</div>
215215
</div>
216216
</div>
217+
<!-- Attach Public Key -->
218+
<div class="form-content-row">
219+
<div class="row align-items-center">
220+
<div class="col-sm-3">
221+
<label class="form-label mb-sm-0" [translate]="'settings.security.attach_public_key'">
222+
Attach public key
223+
</label>
224+
</div>
225+
<div class="col-sm-7 col-md-5 attach-public-key">
226+
<div class="row row-sm">
227+
<div class="col-6 flex-auto-col">
228+
<div class="fancy-field-group">
229+
<input
230+
class="d-none fancy-field-control fancy-field-control-sm"
231+
id="attachPublicKey1"
232+
name="attachPublicKey"
233+
type="radio"
234+
(click)="updateSettings('attach_public_key', true)"
235+
[checked]="(settings$ | async)?.attach_public_key"
236+
/>
237+
<label for="attachPublicKey1" [translate]="'common.enabled'">Enabled</label>
238+
</div>
239+
</div>
240+
<div class="col-6 flex-auto-col">
241+
<div class="fancy-field-group">
242+
<input
243+
class="d-none fancy-field-control fancy-field-control-sm"
244+
id="attachPublicKey2"
245+
name="attachPublicKey"
246+
type="radio"
247+
(click)="updateSettings('attach_public_key', false)"
248+
[checked]="!(settings$ | async)?.attach_public_key"
249+
/>
250+
<label for="attachPublicKey2" [translate]="'common.disabled'">Disabled</label>
251+
</div>
252+
</div>
253+
</div>
254+
</div>
255+
</div>
256+
</div>
217257
</div>
218258
</div>
219259

src/app/mail/mail-sidebar/compose-mail/compose-mail.component.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -597,14 +597,11 @@
597597
</button>
598598
<button
599599
class="dropdown-item dropdown-menu-item dropdown-menu-item-attach"
600-
(click)="onClickAttachPublicKey(!selectedMailbox?.is_attach_public_key)"
600+
(click)="onClickAttachPublicKey(!isAttachPublicKey)"
601601
>
602602
<div class="row-item">
603603
<div class="check-box">
604-
<i
605-
*ngIf="selectedMailbox?.is_attach_public_key"
606-
class="fa fa-check text-black-50 ng-star-inserted"
607-
></i>
604+
<i *ngIf="isAttachPublicKey" class="fa fa-check text-black-50 ng-star-inserted"></i>
608605
</div>
609606
<a class="ql-size-small" [translate]="'settings.security.attach_public_key'">Attach public key</a>
610607
</div>

src/app/mail/mail-sidebar/compose-mail/compose-mail.component.ts

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { Store } from '@ngrx/store';
1616
import * as parseEmail from 'email-addresses';
1717
import { of, Subject, Subscription } from 'rxjs';
1818
import { debounceTime, filter, finalize, pairwise, withLatestFrom } from 'rxjs/operators';
19+
import { combineLatest } from 'rxjs';
1920
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
2021
import * as xss from 'xss';
2122

@@ -240,6 +241,8 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {
240241

241242
isTrialPrimeFeaturesAvailable = false;
242243

244+
isAttachPublicKey = false;
245+
243246
mailBoxesState: MailBoxesState;
244247

245248
isUploadingAttachment: boolean;
@@ -515,6 +518,16 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {
515518
this.analyzeUsersKeysWithContact$.next(true);
516519
});
517520

521+
combineLatest(
522+
this.store.select((state: AppState) => state.mailboxes),
523+
this.store.select((state: AppState) => state.user),
524+
)
525+
.pipe(untilDestroyed(this))
526+
.subscribe(([mailBoxesState, userState]: [MailBoxesState, UserState]) => {
527+
this.isAttachPublicKey =
528+
userState?.settings?.attach_public_key && mailBoxesState?.currentMailbox?.is_attach_public_key;
529+
});
530+
518531
/**
519532
* Get mail status and
520533
* add decrypted content if content is not decrypted
@@ -1025,6 +1038,7 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {
10251038
return;
10261039
}
10271040
this.selectedMailbox = mailbox;
1041+
this.isAttachPublicKey = this.userState?.settings?.attach_public_key && this.selectedMailbox?.is_attach_public_key;
10281042
this.oldMailbox = oldMailbox;
10291043
this.isSignatureAdded = false;
10301044
this.updateSignature();
@@ -1303,22 +1317,7 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {
13031317
}
13041318

13051319
// Attach public key if needed
1306-
const publicKeyFileName = `publickey-${this.selectedMailbox.email}.asc`;
1307-
if (
1308-
!this.selectedMailbox.is_pgp_sign &&
1309-
this.selectedMailbox.is_attach_public_key &&
1310-
!this.attachments.some(a => a.name === publicKeyFileName)
1311-
) {
1312-
const publicKeyFile = new File([this.selectedMailbox.public_key], publicKeyFileName);
1313-
this.isProcessingAttachments = true;
1314-
this.uploadAttachment(publicKeyFile, false);
1315-
1316-
setTimeout(() => {
1317-
this.isPreparingToSendEmail = false;
1318-
this.sendEmailCheck();
1319-
}, 500);
1320-
return;
1321-
}
1320+
this.draftMail.attach_public_key = this.isAttachPublicKey;
13221321

13231322
if (
13241323
receivers.some(
@@ -2149,10 +2148,7 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {
21492148
}
21502149

21512150
onClickAttachPublicKey(isEnabled: boolean) {
2152-
if (this.selectedMailbox) {
2153-
this.selectedMailbox.is_attach_public_key = isEnabled;
2154-
this.store.dispatch(new MailboxSettingsUpdate(this.selectedMailbox));
2155-
}
2151+
this.isAttachPublicKey = isEnabled;
21562152
}
21572153

21582154
onClickSignMessage(isEnabled: boolean) {

src/app/store/datatypes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ export class Settings {
314314
universal_spam_filter?: string;
315315

316316
theme?: string;
317+
318+
attach_public_key?: boolean;
317319
}
318320

319321
export interface Invoice {

src/app/store/models/mail.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export interface Mail {
5959
email_display_name_map?: any;
6060
sign?: string;
6161
participants?: any;
62+
attach_public_key?: boolean;
6263

6364
mailLink?: string; // set in UI for generating the mail's deep-link
6465
htmlQuotedMailContent?: string; // the initial quoted mails in HTML format

0 commit comments

Comments
 (0)