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/components/topic-footer-buttons.js.es6
Sam Saffron 3b8819f0ab FEATURE: add support for defer topic functionality
This feature allows end users to "defer" topics by marking them unread

The functionality is default disabled. This also introduces the new site
setting default_other_enable_defer: to enable this by default on new user
accounts.
2019-05-31 15:44:35 +10:00

68 lines
1.8 KiB
JavaScript

import computed from "ember-addons/ember-computed-decorators";
import { getTopicFooterButtons } from "discourse/lib/register-topic-footer-button";
export default Ember.Component.extend({
elementId: "topic-footer-buttons",
// Allow us to extend it
layoutName: "components/topic-footer-buttons",
@computed("topic.isPrivateMessage")
canArchive(isPM) {
return this.siteSettings.enable_personal_messages && isPM;
},
buttons: getTopicFooterButtons(),
@computed("buttons.[]")
inlineButtons(buttons) {
return buttons.filter(button => !button.dropdown);
},
// topic.assigned_to_user is for backward plugin support
@computed("buttons.[]", "topic.assigned_to_user")
dropdownButtons(buttons) {
return buttons.filter(button => button.dropdown);
},
@computed("topic.isPrivateMessage")
showNotificationsButton(isPM) {
return !isPM || this.siteSettings.enable_personal_messages;
},
canInviteTo: Ember.computed.alias("topic.details.can_invite_to"),
canDefer: Ember.computed.alias("currentUser.enable_defer"),
inviteDisabled: Ember.computed.or(
"topic.archived",
"topic.closed",
"topic.deleted"
),
@computed
showAdminButton() {
return (
!this.site.mobileView &&
this.currentUser &&
this.currentUser.get("canManageTopic")
);
},
showEditOnFooter: Ember.computed.and(
"topic.isPrivateMessage",
"site.can_tag_pms"
),
@computed("topic.message_archived")
archiveIcon: archived => (archived ? "envelope" : "folder"),
@computed("topic.message_archived")
archiveTitle: archived =>
archived ? "topic.move_to_inbox.help" : "topic.archive_message.help",
@computed("topic.message_archived")
archiveLabel: archived =>
archived ? "topic.move_to_inbox.title" : "topic.archive_message.title"
});