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 #1675 from CTemplar/dev
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
The-Hidden-Hand committed Feb 23, 2022
2 parents 5e31722 + 6bb43af commit 4da57cf
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 40 deletions.
12 changes: 4 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,19 @@
name: Bug report
about: Report here if you found something isn't working as expected.
title: ''
labels: ''
labels: 'bug'
assignees: ''
---

### Your environment

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

### Steps to reproduce
### Picture, video or steps to reproduce

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

### Expected behavior
### Explanation

Tell us what should happen.

### Actual behavior

Tell us what happens instead.
Tell us any extra details.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Feature request
about: Suggest here if you have any new feature or improvement request.
title: ''
labels: ''
labels: 'enhacement'
assignees: ''
---

Expand Down
6 changes: 1 addition & 5 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
Fixes #

### Changes description

-
Fixes task (link or #num):
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ctemplar",
"version": "2.5.67",
"version": "2.5.68",
"license": "Apache",
"main": "electron-main.js",
"description": "Angular webclient (with Linux, macOS and Windows desktop clients) for CTemplar's encrypted email service.",
Expand Down
40 changes: 40 additions & 0 deletions src/app/mail/mail-settings/security/security.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,46 @@ <h5 class="ui-header-subtitle text-dark mb-0">
</div>
</div>
</div>
<!-- Attach Public Key -->
<div class="form-content-row">
<div class="row align-items-center">
<div class="col-sm-3">
<label class="form-label mb-sm-0" [translate]="'settings.security.attach_public_key'">
Attach public key
</label>
</div>
<div class="col-sm-7 col-md-5 attach-public-key">
<div class="row row-sm">
<div class="col-6 flex-auto-col">
<div class="fancy-field-group">
<input
class="d-none fancy-field-control fancy-field-control-sm"
id="attachPublicKey1"
name="attachPublicKey"
type="radio"
(click)="updateSettings('attach_public_key', true)"
[checked]="(settings$ | async)?.attach_public_key"
/>
<label for="attachPublicKey1" [translate]="'common.enabled'">Enabled</label>
</div>
</div>
<div class="col-6 flex-auto-col">
<div class="fancy-field-group">
<input
class="d-none fancy-field-control fancy-field-control-sm"
id="attachPublicKey2"
name="attachPublicKey"
type="radio"
(click)="updateSettings('attach_public_key', false)"
[checked]="!(settings$ | async)?.attach_public_key"
/>
<label for="attachPublicKey2" [translate]="'common.disabled'">Disabled</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,14 +597,11 @@
</button>
<button
class="dropdown-item dropdown-menu-item dropdown-menu-item-attach"
(click)="onClickAttachPublicKey(!selectedMailbox?.is_attach_public_key)"
(click)="onClickAttachPublicKey(!isAttachPublicKey)"
>
<div class="row-item">
<div class="check-box">
<i
*ngIf="selectedMailbox?.is_attach_public_key"
class="fa fa-check text-black-50 ng-star-inserted"
></i>
<i *ngIf="isAttachPublicKey" class="fa fa-check text-black-50 ng-star-inserted"></i>
</div>
<a class="ql-size-small" [translate]="'settings.security.attach_public_key'">Attach public key</a>
</div>
Expand Down
36 changes: 16 additions & 20 deletions src/app/mail/mail-sidebar/compose-mail/compose-mail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Store } from '@ngrx/store';
import * as parseEmail from 'email-addresses';
import { of, Subject, Subscription } from 'rxjs';
import { debounceTime, filter, finalize, pairwise, withLatestFrom } from 'rxjs/operators';
import { combineLatest } from 'rxjs';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import * as xss from 'xss';

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

isTrialPrimeFeaturesAvailable = false;

isAttachPublicKey = false;

mailBoxesState: MailBoxesState;

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

combineLatest(
this.store.select((state: AppState) => state.mailboxes),
this.store.select((state: AppState) => state.user),
)
.pipe(untilDestroyed(this))
.subscribe(([mailBoxesState, userState]: [MailBoxesState, UserState]) => {
this.isAttachPublicKey =
userState?.settings?.attach_public_key && mailBoxesState?.currentMailbox?.is_attach_public_key;
});

/**
* Get mail status and
* add decrypted content if content is not decrypted
Expand Down Expand Up @@ -1025,6 +1038,7 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {
return;
}
this.selectedMailbox = mailbox;
this.isAttachPublicKey = this.userState?.settings?.attach_public_key && this.selectedMailbox?.is_attach_public_key;
this.oldMailbox = oldMailbox;
this.isSignatureAdded = false;
this.updateSignature();
Expand Down Expand Up @@ -1303,22 +1317,7 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {
}

// Attach public key if needed
const publicKeyFileName = `publickey-${this.selectedMailbox.email}.asc`;
if (
!this.selectedMailbox.is_pgp_sign &&
this.selectedMailbox.is_attach_public_key &&
!this.attachments.some(a => a.name === publicKeyFileName)
) {
const publicKeyFile = new File([this.selectedMailbox.public_key], publicKeyFileName);
this.isProcessingAttachments = true;
this.uploadAttachment(publicKeyFile, false);

setTimeout(() => {
this.isPreparingToSendEmail = false;
this.sendEmailCheck();
}, 500);
return;
}
this.draftMail.attach_public_key = this.isAttachPublicKey;

if (
receivers.some(
Expand Down Expand Up @@ -2149,10 +2148,7 @@ export class ComposeMailComponent implements OnInit, AfterViewInit, OnDestroy {
}

onClickAttachPublicKey(isEnabled: boolean) {
if (this.selectedMailbox) {
this.selectedMailbox.is_attach_public_key = isEnabled;
this.store.dispatch(new MailboxSettingsUpdate(this.selectedMailbox));
}
this.isAttachPublicKey = isEnabled;
}

onClickSignMessage(isEnabled: boolean) {
Expand Down
2 changes: 2 additions & 0 deletions src/app/store/datatypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ export class Settings {
universal_spam_filter?: string;

theme?: string;

attach_public_key?: boolean;
}

export interface Invoice {
Expand Down
1 change: 1 addition & 0 deletions src/app/store/models/mail.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export interface Mail {
email_display_name_map?: any;
sign?: string;
participants?: any;
attach_public_key?: boolean;

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

0 comments on commit 4da57cf

Please sign in to comment.