FIX: Show the correct message when no user export exists. (#30970)

Followup to 7fc8d74f3eed52116add452b5321b41e02e04499

We need to check that the user export data exists before creating a model, since having an empty model will cause the UI to incorrectly think there's a user export to display.

This change shows the correct message, instead.
This commit is contained in:
Gary Pendergast 2025-01-24 11:38:07 +11:00 committed by GitHub
parent aa90ba2992
commit 37d1212865
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -28,7 +28,9 @@ export default class extends Component {
this.messageBus.subscribe(EXPORT_PROGRESS_CHANNEL, this.onExportProgress);
this.model = this.args.model;
this.userExport = UserExport.create(this.model.latest_export?.user_export);
if (this.model.latest_export) {
this.userExport = UserExport.create(this.model.latest_export.user_export);
}
}
willDestroy() {
@ -43,7 +45,9 @@ export default class extends Component {
if (data.failed) {
this.dialog.alert(i18n("admin.user.exports.download.export_failed"));
} else {
this.userExport = UserExport.create(data.export_data.user_export);
if (data.export_data.user_export) {
this.userExport = UserExport.create(data.export_data.user_export);
}
this.toasts.success({
autoClose: false,
data: { message: i18n("admin.user.exports.download.success") },