From e5f557b97104ca530a6ee6c2a737f762cba297b1 Mon Sep 17 00:00:00 2001 From: Kris Date: Fri, 3 Feb 2023 11:19:08 -0500 Subject: [PATCH] UX: move data export to preferences page for new user nav (#20141) --- .../app/controllers/preferences/account.js | 15 +++++++- .../templates/components/topic-progress.hbs | 1 + .../app/templates/preferences/account.hbs | 17 +++++++++ .../acceptance/user-activity-replies-test.js | 38 +------------------ .../user-preferences-account-test.js | 26 +++++++++++++ config/locales/client.en.yml | 10 +++-- 6 files changed, 64 insertions(+), 43 deletions(-) diff --git a/app/assets/javascripts/discourse/app/controllers/preferences/account.js b/app/assets/javascripts/discourse/app/controllers/preferences/account.js index 7baeb206c29..2d90b4dd007 100644 --- a/app/assets/javascripts/discourse/app/controllers/preferences/account.js +++ b/app/assets/javascripts/discourse/app/controllers/preferences/account.js @@ -1,7 +1,7 @@ -import { gt, not, or } from "@ember/object/computed"; +import { alias, gt, not, or } from "@ember/object/computed"; import { propertyNotEqual, setting } from "discourse/lib/computed"; import CanCheckEmails from "discourse/mixins/can-check-emails"; -import Controller from "@ember/controller"; +import Controller, { inject as controller } from "@ember/controller"; import EmberObject, { action } from "@ember/object"; import I18n from "I18n"; import discourseComputed from "discourse-common/utils/decorators"; @@ -12,9 +12,13 @@ import { popupAjaxError } from "discourse/lib/ajax-error"; import { inject as service } from "@ember/service"; import { next } from "@ember/runloop"; import showModal from "discourse/lib/show-modal"; +import { exportUserArchive } from "discourse/lib/export-csv"; export default Controller.extend(CanCheckEmails, { dialog: service(), + user: controller(), + canDownloadPosts: alias("user.viewingSelf"), + init() { this._super(...arguments); @@ -244,5 +248,12 @@ export default Controller.extend(CanCheckEmails, { connectAccount(method) { method.doLogin({ reconnect: true }); }, + + exportUserArchive() { + this.dialog.yesNoConfirm({ + message: I18n.t("user.download_archive.confirm"), + didConfirm: () => exportUserArchive(), + }); + }, }, }); diff --git a/app/assets/javascripts/discourse/app/templates/components/topic-progress.hbs b/app/assets/javascripts/discourse/app/templates/components/topic-progress.hbs index ea39c80f647..edbe065bff7 100644 --- a/app/assets/javascripts/discourse/app/templates/components/topic-progress.hbs +++ b/app/assets/javascripts/discourse/app/templates/components/topic-progress.hbs @@ -15,6 +15,7 @@