1
0
mirror of https://github.com/flarum/core.git synced 2025-07-24 18:21:33 +02:00

Add sticky permission

This commit is contained in:
Toby Zerner
2015-05-15 17:06:50 +09:30
parent 5872e041df
commit 30d546383e
3 changed files with 8 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ app.initializers.add('sticky', function() {
app.notificationComponentRegistry['discussionStickied'] = NotificationDiscussionStickied;
Discussion.prototype.isSticky = Model.prop('isSticky');
Discussion.prototype.canSticky = Model.prop('canSticky');
// Add a sticky badge to discussions.
extend(Discussion.prototype, 'badges', function(badges) {
@@ -42,7 +43,7 @@ app.initializers.add('sticky', function() {
// Add a sticky control to discussions.
extend(Discussion.prototype, 'controls', function(items) {
if (this.canEdit()) {
if (this.canSticky()) {
items.add('sticky', ActionButton.component({
label: this.isSticky() ? 'Unsticky' : 'Sticky',
icon: 'thumb-tack',