* This PR changes the user activity bookmarks stream to show a new list of bookmarks based on the Bookmark record. * If a bookmark has a name or reminder it will be shown as metadata above the topic title in the list * The categories, tags, topic status, and assigned show for each bookmarked post based on the post topic * Bookmarks can be deleted from the [...] menu in the list * As well as this, the list of bookmarks from the quick access panel is now drawn from the Bookmarks table for a user: * All of this new functionality is gated behind the enable_bookmarks_with_reminders site setting The /bookmarks/ route now redirects directly to /user/:username/activity/bookmarks-with-reminders * The structure of the Ember for the list of bookmarks is not ideal, this is an MVP PR so we can start testing this functionality internally. There is a little repeated code from topic.js.es6. There is an ongoing effort to start standardizing these lists that will be addressed in future PRs. * This PR also fixes issues with feature detection for at_desktop bookmark reminders
44 lines
1.3 KiB
JavaScript
44 lines
1.3 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";
|
|
import { setting } from "discourse/lib/computed";
|
|
|
|
export default Controller.extend({
|
|
application: controller(),
|
|
user: controller(),
|
|
router: service(),
|
|
userActionType: null,
|
|
|
|
canDownloadPosts: alias("user.viewingSelf"),
|
|
bookmarksWithRemindersEnabled: setting("enable_bookmarks_with_reminders"),
|
|
|
|
@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)
|
|
);
|
|
}
|
|
}
|
|
});
|