This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/controllers/user-activity.js.es6
2018-11-19 11:46:26 +01:00

36 lines
1.0 KiB
JavaScript

import { exportUserArchive } from "discourse/lib/export-csv";
export default Ember.Controller.extend({
application: Ember.inject.controller(),
user: Ember.inject.controller(),
userActionType: null,
canDownloadPosts: Ember.computed.alias("user.viewingSelf"),
_showFooter: function() {
var showFooter;
if (this.get("userActionType")) {
const stat = (this.get("model.stats") || []).find(
s => s.action_type === this.get("userActionType")
);
showFooter = stat && stat.count <= this.get("model.stream.itemsLoaded");
} else {
showFooter =
this.get("model.statsCountNonPM") <=
this.get("model.stream.itemsLoaded");
}
this.set("application.showFooter", showFooter);
}.observes("userActionType", "model.stream.itemsLoaded"),
actions: {
exportUserArchive() {
bootbox.confirm(
I18n.t("user.download_archive.confirm"),
I18n.t("no_value"),
I18n.t("yes_value"),
confirmed => (confirmed ? exportUserArchive() : null)
);
}
}
});