Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<div>
<div class="tw-mb-4">
@if (receiveName()) {
<p class="tw-text-center">
<b>{{ receiveName() }}</b>
</p>
}
<hr />
@if (ownerEmail()) {
<p class="tw-text-center tw-mb-0">{{ ownerEmail() + " " }}{{ "sentYouThisRequest" | i18n }}</p>
}
</div>
<bit-section>
<bit-form-field>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { I18nPipe } from "@bitwarden/ui-common";
})
export class ReceiveFileUploadComponent implements OnInit {
readonly receiveName = signal<string>("");
readonly ownerEmail = signal<string>("");
readonly fileName = signal<string>("");
readonly showUploadFileButton = signal<boolean>(false);
private readonly receiveId: ReceiveId;
Expand Down Expand Up @@ -65,6 +66,7 @@ export class ReceiveFileUploadComponent implements OnInit {
);
this.receiveName.set(sharedData.name);
this.publicKey.set(sharedData.publicKey);
this.ownerEmail.set(sharedData.ownerEmail);
} catch (e) {
this.logService.error(e);
this.toastService.showToast({
Expand Down Expand Up @@ -133,6 +135,11 @@ export class ReceiveFileUploadComponent implements OnInit {
publicKey: this.publicKey(),
};
await this.receiveFileService.uploadFile(input);
this.toastService.showToast({
variant: "success",
message: this.i18nService.t("fileUploadSuccess"),
});
this.removeFile();
} catch (e) {
this.logService.error(e);
this.toastService.showToast({
Expand Down
6 changes: 6 additions & 0 deletions apps/web/src/locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6393,6 +6393,9 @@
"editReceive": {
"message": "Edit Receive"
},
"sentYouThisRequest" : {
"message": "sent you this request"
},
"expirationDays": {
"message": "Expiration (days)"
},
Expand Down Expand Up @@ -11513,6 +11516,9 @@
"fileReadError": {
"message": "File could not be read"
},
"fileUploadSuccess": {
"message": "File uploaded successfully"
},
"receiveLoadError": {
"message": "Could not load this receive"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface ReceiveSharedData {
name: string;
publicKey: Uint8Array;
ownerEmail: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BaseResponse } from "@bitwarden/common/models/response/base.response";
export class ReceiveSharedDataResponse extends BaseResponse {
name: EncString;
scekWrappedPublicKey: EncString;
ownerEmail: string;

constructor(response: any) {
super(response);
Expand All @@ -21,5 +22,12 @@ export class ReceiveSharedDataResponse extends BaseResponse {
} else {
throw new Error("Missing scekWrappedPublicKey in response");
}

const ownerEmail = this.getResponseProperty("ownerEmail");
if (ownerEmail) {
this.ownerEmail = ownerEmail;
} else {
throw new Error("Missing ownerEmail in response");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export class DefaultReceiveService implements InternalReceiveService {
response.scekWrappedPublicKey,
sharedContentEncryptionKey,
),
ownerEmail: response.ownerEmail,
};
}

Expand Down
Loading