You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
1.3 KiB

define(["jquery","core/templates","core/str","core/notification","mod_forum/subscription_toggle","mod_forum/selectors","mod_forum/repository"],function(a,b,c,d,e,f,g){var h=function(e){e.on("click",f.favourite.toggle,function(){var b=a(this),c=b.data("forumid"),e=b.data("discussionid"),f=b.data("targetstate");g.setFavouriteDiscussionState(c,e,f).then(function(){return location.reload()})["catch"](d.exception)}),e.on("click",f.pin.toggle,function(b){b.preventDefault();var c=a(this),e=c.data("forumid"),f=c.data("discussionid"),h=c.data("targetstate");g.setPinDiscussionState(e,f,h).then(function(){return location.reload()})["catch"](d.exception)}),e.on("click",f.lock.toggle,function(e){var h=a(this),i=h.data("forumid"),j=h.data("discussionid"),k=h.data("state");g.setDiscussionLockState(i,j,k).then(function(a){var b=h.parents(f.summary.actions).find(f.lock.icon);return a.locked?b.removeClass("hidden"):b.addClass("hidden"),a}).then(function(a){return a.forumid=i,b.render("mod_forum/discussion_lock_toggle",a)}).then(function(a,c){return b.replaceNode(h,a,c)}).then(function(){return c.get_string("lockupdated","forum").done(function(a){return d.addNotification({message:a,type:"info"})})})["catch"](d.exception),e.preventDefault()})};return{init:function(a){e.init(a),h(a)}}});