diff --git a/js/admin.actions.js b/js/admin.actions.js index a1389d0..083a63e 100644 --- a/js/admin.actions.js +++ b/js/admin.actions.js @@ -31,8 +31,8 @@ jQuery(document).ready(function($) { // Hide the advanced settings $('#AdvancedActionSettings').children('div').hide(); - $('#AdvancedActionSettings').click(function(){ - $(this).children('div').slideToggle(); + $('#AdvancedActionSettings span').click(function(){ + $(this).siblings().slideToggle(); }); // If someone types in the class manually, deselect icons and select if needed diff --git a/models/class.reactionmodel.php b/models/class.reactionmodel.php index e0307d5..60e0395 100644 --- a/models/class.reactionmodel.php +++ b/models/class.reactionmodel.php @@ -80,6 +80,7 @@ class ReactionModel extends Gdn_Model { $ReactionSet[$Index]->Tooltip = $Action->Tooltip; $ReactionSet[$Index]->CssClass = $Action->CssClass; $ReactionSet[$Index]->AwardValue = $Action->AwardValue; + $ReactionSet[$Index]->Permission = $Action->Permission; $Reactions = $this->SQL ->Select('InsertUserID as UserID, DateInserted') diff --git a/settings/class.hooks.php b/settings/class.hooks.php index 656947f..c4a57aa 100755 --- a/settings/class.hooks.php +++ b/settings/class.hooks.php @@ -127,7 +127,7 @@ class YagaHooks implements Gdn_IPlugin { */ protected function _RenderCurrentReactions($ID, $Type) { // check to see if allowed to view reactions - if(!Gdn::Session()->CheckPermission('Plugins.Reactions.View')) { + if(!Gdn::Session()->CheckPermission('Yaga.Reactions.View')) { return; } @@ -165,7 +165,7 @@ class YagaHooks implements Gdn_IPlugin { $Sender->AddJsFile('reactions.js', 'yaga'); $Sender->AddCssFile('reactions.css', 'yaga'); // check to see if allowed to add reactions - if(!Gdn::Session()->CheckPermission('Plugins.Reactions.Add')) { + if(!Gdn::Session()->CheckPermission('Yaga.Reactions.Add')) { return; } @@ -196,7 +196,7 @@ class YagaHooks implements Gdn_IPlugin { } // check to see if allowed to add reactions - if(!Gdn::Session()->CheckPermission('Plugins.Reactions.Add')) { + if(!Gdn::Session()->CheckPermission('Yaga.Reactions.Add')) { return; } @@ -229,11 +229,13 @@ class YagaHooks implements Gdn_IPlugin { $Reactions = $this->_ReactionModel->GetReactions($ID, $Type); $ActionsString = ''; foreach($Reactions as $Action) { - $ActionsString .= Anchor( - Wrap(' ', 'span', array('class' => 'ReactSprite React-' . $Action->ActionID . ' ' . $Action->CssClass)) . - WrapIf(count($Action->UserIDs), 'span', array('class' => 'Count')) . - Wrap($Action->Name, 'span', array('class' => 'ReactLabel')), 'react/' . $Type . '/' . $ID . '/' . $Action->ActionID, 'Hijack ReactButton' - ); + if(CheckPermission($Action->Permission)) { + $ActionsString .= Anchor( + Wrap(' ', 'span', array('class' => 'ReactSprite React-' . $Action->ActionID . ' ' . $Action->CssClass)) . + WrapIf(count($Action->UserIDs), 'span', array('class' => 'Count')) . + Wrap($Action->Name, 'span', array('class' => 'ReactLabel')), 'react/' . $Type . '/' . $ID . '/' . $Action->ActionID, 'Hijack ReactButton' + ); + } } $AllActionsString = Wrap($ActionsString, 'span', array('class' => 'ReactMenu'));