Skip to content

Commit fe5c036

Browse files
pentojancernik
authored andcommitted
FIX: Show the correct message when no user export exists. (discourse#30970)
Followup to 7fc8d74 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.
1 parent 8b92d87 commit fe5c036

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/assets/javascripts/admin/addon/components/admin-user-exports-table.gjs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ export default class extends Component {
2828
this.messageBus.subscribe(EXPORT_PROGRESS_CHANNEL, this.onExportProgress);
2929

3030
this.model = this.args.model;
31-
this.userExport = UserExport.create(this.model.latest_export?.user_export);
31+
if (this.model.latest_export) {
32+
this.userExport = UserExport.create(this.model.latest_export.user_export);
33+
}
3234
}
3335

3436
willDestroy() {
@@ -43,7 +45,9 @@ export default class extends Component {
4345
if (data.failed) {
4446
this.dialog.alert(i18n("admin.user.exports.download.export_failed"));
4547
} else {
46-
this.userExport = UserExport.create(data.export_data.user_export);
48+
if (data.export_data.user_export) {
49+
this.userExport = UserExport.create(data.export_data.user_export);
50+
}
4751
this.toasts.success({
4852
autoClose: false,
4953
data: { message: i18n("admin.user.exports.download.success") },

0 commit comments

Comments
 (0)