Merge pull request #1576 from bitwarden/bugfix-autofill-after-launch

Auto-fill the correct cipher after clicking launch button
This commit is contained in:
Thomas Rittson 2021-01-29 06:35:30 +10:00 committed by GitHub
commit c7966773a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 17 deletions

View File

@ -2,7 +2,7 @@
<i class="fa fa-lg fa-list-alt" aria-hidden="true"></i>
</span>
<ng-container *ngIf="cipher.type === cipherType.Login">
<span class="row-btn" appStopClick appStopProp appA11yTitle="{{'launch' | i18n}}" (click)="launch()"
<span class="row-btn" appStopClick appStopProp appA11yTitle="{{'launch' | i18n}}" (click)="launchCipher()"
*ngIf="!showView" [ngClass]="{disabled: !cipher.login.canLaunch}">
<i class="fa fa-lg fa-share-square-o" aria-hidden="true"></i>
</span>

View File

@ -29,6 +29,7 @@ import { PopupUtilsService } from '../services/popup-utils.service';
})
export class ActionButtonsComponent {
@Output() onView = new EventEmitter<CipherView>();
@Output() launchEvent = new EventEmitter<CipherView>();
@Input() cipher: CipherView;
@Input() showView = false;
@ -44,16 +45,8 @@ export class ActionButtonsComponent {
this.userHasPremiumAccess = await this.userService.canAccessPremium();
}
launch() {
if (this.cipher.type !== CipherType.Login || !this.cipher.login.canLaunch) {
return;
}
this.analytics.eventTrack.next({ action: 'Launched URI From Listing' });
BrowserApi.createNewTab(this.cipher.login.launchUri);
if (this.popupUtilsService.inPopup(window)) {
BrowserApi.closePopup(window);
}
launchCipher() {
this.launchEvent.emit(this.cipher);
}
async copy(cipher: CipherView, value: string, typeI18nKey: string, aType: string) {

View File

@ -1,4 +1,4 @@
<a *ngFor="let c of ciphers" (click)="selectCipher(c)" (dblclick)="doubleSelectCipher(c)" href="#" appStopClick
<a *ngFor="let c of ciphers" (click)="selectCipher(c)" (dblclick)="launchCipher(c)" href="#" appStopClick
title="{{title}} - {{c.name}}" class="box-content-row box-content-row-flex">
<div class="row-main">
<app-vault-icon [cipher]="c"></app-vault-icon>
@ -17,6 +17,7 @@
<span class="detail">{{c.subTitle}}</span>
</div>
</div>
<app-action-buttons [cipher]="c" [showView]="showView" (onView)="viewCipher(c)" class="action-buttons">
<app-action-buttons [cipher]="c" [showView]="showView" (onView)="viewCipher(c)" (launchEvent)="launchCipher(c)"
class="action-buttons">
</app-action-buttons>
</a>

View File

@ -15,7 +15,7 @@ import { CipherView } from 'jslib/models/view/cipherView';
})
export class CiphersListComponent {
@Output() onSelected = new EventEmitter<CipherView>();
@Output() onDoubleSelected = new EventEmitter<CipherView>();
@Output() launchEvent = new EventEmitter<CipherView>();
@Output() onView = new EventEmitter<CipherView>();
@Input() ciphers: CipherView[];
@Input() showView = false;
@ -27,8 +27,8 @@ export class CiphersListComponent {
this.onSelected.emit(c);
}
doubleSelectCipher(c: CipherView) {
this.onDoubleSelected.emit(c);
launchCipher(c: CipherView) {
this.launchEvent.emit(c);
}
viewCipher(c: CipherView) {

View File

@ -72,7 +72,7 @@
</div>
<div class="box-content">
<app-ciphers-list [ciphers]="filteredCiphers" title="{{'viewItem' | i18n}}"
(onSelected)="selectCipher($event)" (onDoubleSelected)="launchCipher($event)"></app-ciphers-list>
(onSelected)="selectCipher($event)" (launchEvent)="launchCipher($event)"></app-ciphers-list>
</div>
</div>
</ng-container>