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
Martin Brennan 628ba9d1e2
FEATURE: Promote bookmarks with reminders to core functionality (#9369)
The main thrust of this PR is to take all the conditional checks based on the `enable_bookmarks_with_reminders` away and only keep the code from the `true` path, making bookmarks with reminders the core bookmarks feature. There is also a migration to create `Bookmark` records out of `PostAction` bookmarks for a site.

### Summary

* Remove logic based on whether enable_bookmarks_with_reminders is true. This site setting is now obsolete, the old bookmark functionality is being removed. Retain the setting and set the value to `true` in a migration.
* Use the code from the rake task to create a database migration that creates bookmarks from post actions.
* Change the bookmark report to read from the new table.
* Get rid of old endpoints for bookmarks
* Link to the new bookmarks list from the user summary page
2020-04-22 13:44:19 +10:00

42 lines
1.2 KiB
JavaScript

import { alias } from "@ember/object/computed";
import { inject as service } from "@ember/service";
import Controller, { inject as controller } from "@ember/controller";
import { exportUserArchive } from "discourse/lib/export-csv";
import { observes } from "discourse-common/utils/decorators";
export default Controller.extend({
application: controller(),
user: controller(),
router: service(),
userActionType: null,
canDownloadPosts: alias("user.viewingSelf"),
@observes("userActionType", "model.stream.itemsLoaded")
_showFooter: function() {
var showFooter;
if (this.userActionType) {
const stat = (this.get("model.stats") || []).find(
s => s.action_type === this.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);
},
actions: {
exportUserArchive() {
bootbox.confirm(
I18n.t("user.download_archive.confirm"),
I18n.t("no_value"),
I18n.t("yes_value"),
confirmed => (confirmed ? exportUserArchive() : null)
);
}
}
});