Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mailviewer): New allowlist sender option for mail viewer #1658

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/app/mailviewer/rmm7messageactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,18 @@ export class RMM7MessageActions implements MessageActions {
snackBarRef.dismiss();
}

allowListSender(param) {
const msg = `AllowListing sender: ${param}`;
const snackBarRef = this.snackBar.open(msg);
this.rmmapi.allowListSender(param).subscribe((res) => {
if ( res.status === 'error' ) {
snackBarRef.dismiss();
this.snackBar.open('There was an error with Sender allowlisting functionality. Please try again.', 'Dismiss');
}
});
snackBarRef.dismiss();
}

// Update mailviewer menu flag icon after flagging?
flag() {
this.updateMessages({
Expand Down
9 changes: 6 additions & 3 deletions src/app/mailviewer/singlemailviewer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<mat-icon svgIcon="alert-octagon-outline"></mat-icon>
</button>
</ng-container>
<button mat-icon-button *ngIf="morebuttonindex>8" matTooltip="Block Sender/Domain" [matMenuTriggerFor]="blockSenderMenu">
<button mat-icon-button *ngIf="morebuttonindex>8" matTooltip="Block/Allow Sender" [matMenuTriggerFor]="senderRulesMenu">
<mat-icon svgIcon="filter-cog"></mat-icon>
</button>
<a *ngIf="morebuttonindex>9" mat-icon-button
Expand All @@ -77,11 +77,14 @@
matTooltip="Original HTML" [href]="'/rest/v1/email/'+messageId+'/html'" target="_blank">
<mat-icon svgIcon="alert"></mat-icon>
</a>
<button mat-icon-button *ngIf="morebuttonindex < 12" [matMenuTriggerFor]="moreMailActionsMenu" matTooltip="More message actions">
<button mat-icon-button *ngIf="morebuttonindex < 12" [matMenuTriggerFor]="moreMailActionsMenu" matTooltip="More mesage actions">
<mat-icon svgIcon="dots-vertical"></mat-icon>
</button>

<mat-menu #blockSenderMenu>
<mat-menu #senderRulesMenu>
<button mat-menu-item (click)="messageActionsHandler.allowListSender(mailObj.from[0].address)">
AllowList Sender
</button>
<button mat-menu-item (click)="messageActionsHandler.blockSender(mailObj.from[0].address)">
Block Sender Email
</button>
Expand Down
6 changes: 5 additions & 1 deletion src/app/rmmapi/rbwebmail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,12 @@ export class RunboxWebmailAPI {
return this.http.post('/rest/v1/spam/', JSON.stringify(params));
}

public allowListSender(param): Observable<any> {
return this.http.post('/rest/v1/rules/update_nospam_list', JSON.stringify({'email_addresses': [param]}));
}

public blockSender(param): Observable<any> {
return this.http.post('/rest/v1/rules/block_sender', JSON.stringify({'sender': param}));
return this.http.post('/rest/v1/rules/block_sender', JSON.stringify({'sender': param}));
}

// Moves to Trash if not already in Trash
Expand Down
Loading