[KL] Notification Service Framework (NSF) [Deleted]

Lukas W.

Well-known member
katsulynx submitted a new resource:

[KL] Notification Service Framework (NSF) - A framework for integrating various 3rd party notification services.

[KL] Notification Service Framework (NSF)
Description

A collection of services and functions that allow for easy 3rd party notification service integration.

Please note: This addon does not provide any useful standalone functionality. You will need to install at least one addon specifically built for NSF!

Features...

Read more about this resource...
 
Hi, if i activate this addon and i use [TH] Reactions i get this error:
Code:
InvalidArgumentException: Template public:alert_post_react error: Container key 'container' was not found src/XF/Container.php:43
Generated by: testacc Jan 23, 2018 at 9:59 PM
Stack trace
#0 src/XF/App.php(1953): XF\Container->offsetGet('container')
#1 src/addons/ThemeHouse/Reactions/XF/Template/Templater.php(218): XF\App->__get('container')
#2 src/addons/ThemeHouse/Reactions/XF/Template/Templater.php(71): ThemeHouse\Reactions\XF\Template\Templater->getReactionStyleProperties()
#3 [internal function]: ThemeHouse\Reactions\XF\Template\Templater->fnReaction(Object(KL\UserImprovements\Template\Templater), false, Array, 'alert')
#4 src/XF/Template/Templater.php(861): call_user_func_array(Array, Array)
#5 internal_data/code_cache/templates/l3/s0/public/alert_post_react.php(9): XF\Template\Templater->fn('reaction', Array, false)
#6 src/XF/Template/Templater.php(1230): XF\Template\Templater->{closure}(Object(KL\UserImprovements\Template\Templater), Array)
#7 src/XF/Alert/AbstractHandler.php(67): XF\Template\Templater->renderTemplate('alert_post_reac...', Array)
#8 src/addons/KL/NotificationServiceFramework/Entity/UserAlert.php(22): XF\Alert\AbstractHandler->render(Object(KL\NotificationServiceFramework\Entity\UserAlert))
#9 src/XF/Mvc/Entity/Entity.php(1137): KL\NotificationServiceFramework\Entity\UserAlert->_postSave()
#10 src/XF/Repository/UserAlert.php(105): XF\Mvc\Entity\Entity->save()
#11 src/XF/Repository/UserAlert.php(71): XF\Repository\UserAlert->insertAlert(1, 566, 'testacc', 'post', 9014, 'react', Array)
#12 src/addons/ThemeHouse/Reactions/React/AbstractHandler.php(377): XF\Repository\UserAlert->alertFromUser(Object(KL\UserImprovements\Entity\User), Object(KL\UserImprovements\Entity\User), 'post', 9014, 'react', Array)
#13 src/addons/ThemeHouse/Reactions/Repository/ReactedContent.php(105): ThemeHouse\Reactions\React\AbstractHandler->sendReactAlert(Object(ThemeHouse\Reactions\Entity\ReactedContent), Object(ThemeHouse\Reactions\XF\Entity\Post))
#14 src/addons/ThemeHouse/Reactions/ControllerPlugin/React.php(22): ThemeHouse\Reactions\Repository\ReactedContent->insertReact(Object(ThemeHouse\Reactions\XF\Entity\Post), Object(ThemeHouse\Reactions\Entity\ReactedContent))
#15 src/addons/ThemeHouse/Reactions/Pub/Controller/React.php(27): ThemeHouse\Reactions\ControllerPlugin\React->actionToggleReact(Object(ThemeHouse\Reactions\XF\Entity\Post), Object(ThemeHouse\Reactions\Entity\ReactedContent), 'insert')
#16 src/XF/Mvc/Dispatcher.php(249): ThemeHouse\Reactions\Pub\Controller\React->actionReact(Object(XF\Mvc\ParameterBag))
#17 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('ThemeHouse\\Reac...', 'React', 'json', Object(XF\Mvc\ParameterBag), 'reactions', Object(ThemeHouse\Reactions\Pub\Controller\React), NULL)
#18 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#19 src/XF/App.php(1880): XF\Mvc\Dispatcher->run()
#20 src/XF.php(328): XF\App->run()
#21 index.php(13): XF::runApp('XF\\Pub\\App')
#22 {main}
Request state
array(4) {
  ["url"] => string(29) "/reactions/react/post/9014/14"
  ["referrer"] => string(66) "https://anzahcraft.de/threads/anzahcraft-mit-steam-verbinden.2167/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(4) {
    ["_xfRequestUri"] => string(45) "/threads/anzahcraft-mit-steam-verbinden.2167/"
    ["_xfWithData"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    ["_xfResponseType"] => string(4) "json"
  }
}
 
@Tealk I don't own that add-on, so I can't do a lot about it. Judging from the error the top of the stack trace it seems to be their end. Have you reported it to them? If so, what did they reply?
 
He have wrote this
I'm not 100% sure if that's causing the issue, but if when you enable it, it's saying that the container key is missing then it is overwriting it somewhere.
 
From my understanding of the issue (@silence was handling the ticket previously):

We have a class extension on \XF\Template\Templater, with an getReactionStyleProperties function that containst he following:

PHP:
protected function getReactionStyleProperties()
{
    // This should be impossible, but some add-ons are breaking people's boards.
    if (!$this->style) {
        $this->setStyle(\XF::app()->container->style);
    }

    return [
        'imageDimensions' => $this->style->getProperty('thReactionsImageDimensions'),
        'triggerType' => $this->style->getProperty('th_triggerType_reactions'),
        'triggerValue' => $this->style->getProperty('th_triggerValue_reactions'),
        'reactionBarPositions' => $this->style->getProperty('th_reactionBar_location_reactions')
    ];
}

I'm not 100% sure what he had run into that caused $this->style to not be defined and require that code but there was something. I can't imagine a circumstance where \XF::app()->container wouldn't exist
 
@Jake B. thanks for the explanation! I'll have another look into my add-on with these information next week. It might be that I just dropped a parameter somewhere that wasn't necessary up to that point, but we'll know more when I look through the files.
 
Hi, if i activate this addon and i use [TH] Reactions i get this error:
Code:
InvalidArgumentException: Template public:alert_post_react error: Container key 'container' was not found src/XF/Container.php:43
Generated by: testacc Jan 23, 2018 at 9:59 PM
Stack trace
#0 src/XF/App.php(1953): XF\Container->offsetGet('container')
#1 src/addons/ThemeHouse/Reactions/XF/Template/Templater.php(218): XF\App->__get('container')
#2 src/addons/ThemeHouse/Reactions/XF/Template/Templater.php(71): ThemeHouse\Reactions\XF\Template\Templater->getReactionStyleProperties()
#3 [internal function]: ThemeHouse\Reactions\XF\Template\Templater->fnReaction(Object(KL\UserImprovements\Template\Templater), false, Array, 'alert')
#4 src/XF/Template/Templater.php(861): call_user_func_array(Array, Array)
#5 internal_data/code_cache/templates/l3/s0/public/alert_post_react.php(9): XF\Template\Templater->fn('reaction', Array, false)
#6 src/XF/Template/Templater.php(1230): XF\Template\Templater->{closure}(Object(KL\UserImprovements\Template\Templater), Array)
#7 src/XF/Alert/AbstractHandler.php(67): XF\Template\Templater->renderTemplate('alert_post_reac...', Array)
#8 src/addons/KL/NotificationServiceFramework/Entity/UserAlert.php(22): XF\Alert\AbstractHandler->render(Object(KL\NotificationServiceFramework\Entity\UserAlert))
#9 src/XF/Mvc/Entity/Entity.php(1137): KL\NotificationServiceFramework\Entity\UserAlert->_postSave()
#10 src/XF/Repository/UserAlert.php(105): XF\Mvc\Entity\Entity->save()
#11 src/XF/Repository/UserAlert.php(71): XF\Repository\UserAlert->insertAlert(1, 566, 'testacc', 'post', 9014, 'react', Array)
#12 src/addons/ThemeHouse/Reactions/React/AbstractHandler.php(377): XF\Repository\UserAlert->alertFromUser(Object(KL\UserImprovements\Entity\User), Object(KL\UserImprovements\Entity\User), 'post', 9014, 'react', Array)
#13 src/addons/ThemeHouse/Reactions/Repository/ReactedContent.php(105): ThemeHouse\Reactions\React\AbstractHandler->sendReactAlert(Object(ThemeHouse\Reactions\Entity\ReactedContent), Object(ThemeHouse\Reactions\XF\Entity\Post))
#14 src/addons/ThemeHouse/Reactions/ControllerPlugin/React.php(22): ThemeHouse\Reactions\Repository\ReactedContent->insertReact(Object(ThemeHouse\Reactions\XF\Entity\Post), Object(ThemeHouse\Reactions\Entity\ReactedContent))
#15 src/addons/ThemeHouse/Reactions/Pub/Controller/React.php(27): ThemeHouse\Reactions\ControllerPlugin\React->actionToggleReact(Object(ThemeHouse\Reactions\XF\Entity\Post), Object(ThemeHouse\Reactions\Entity\ReactedContent), 'insert')
#16 src/XF/Mvc/Dispatcher.php(249): ThemeHouse\Reactions\Pub\Controller\React->actionReact(Object(XF\Mvc\ParameterBag))
#17 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('ThemeHouse\\Reac...', 'React', 'json', Object(XF\Mvc\ParameterBag), 'reactions', Object(ThemeHouse\Reactions\Pub\Controller\React), NULL)
#18 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#19 src/XF/App.php(1880): XF\Mvc\Dispatcher->run()
#20 src/XF.php(328): XF\App->run()
#21 index.php(13): XF::runApp('XF\\Pub\\App')
#22 {main}
Request state
array(4) {
  ["url"] => string(29) "/reactions/react/post/9014/14"
  ["referrer"] => string(66) "https://anzahcraft.de/threads/anzahcraft-mit-steam-verbinden.2167/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(4) {
    ["_xfRequestUri"] => string(45) "/threads/anzahcraft-mit-steam-verbinden.2167/"
    ["_xfWithData"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    ["_xfResponseType"] => string(4) "json"
  }
}


Did this issue was solved, i am getting same issue with my other addon functionality with TH Reaction and TH reaction points to KL User Improvement addon for the cause of erro and the error is same i.e. - container key.
 
From my understanding of the issue (@silence was handling the ticket previously):

We have a class extension on \XF\Template\Templater, with an getReactionStyleProperties function that containst he following:

PHP:
protected function getReactionStyleProperties()
{
    // This should be impossible, but some add-ons are breaking people's boards.
    if (!$this->style) {
        $this->setStyle(\XF::app()->container->style);
    }

    return [
        'imageDimensions' => $this->style->getProperty('thReactionsImageDimensions'),
        'triggerType' => $this->style->getProperty('th_triggerType_reactions'),
        'triggerValue' => $this->style->getProperty('th_triggerValue_reactions'),
        'reactionBarPositions' => $this->style->getProperty('th_reactionBar_location_reactions')
    ];
}

I'm not 100% sure what he had run into that caused $this->style to not be defined and require that code but there was something. I can't imagine a circumstance where \XF::app()->container wouldn't exist


How it can be fixed?

Please help on it, my issue is with KL User Improvement, another addon and TH reaction but error is same container key
 
I honestly have no idea how to fix it. I'm instanciating the alert handler class and call render on it with the alert as first parameter. There's no fancy magic or hacks happening, and it works fine with all of XFs default. I've had a few looks on my files after @Jake B.'s comment, but I haven't seen anything that I'm missing or that I could do to improve it.
 
I honestly have no idea how to fix it. I'm instanciating the alert handler class and call render on it with the alert as first parameter. There's no fancy magic or hacks happening, and it works fine with all of XFs default. I've had a few looks on my files after @Jake B.'s comment, but I haven't seen anything that I'm missing or that I could do to improve it.

I've installed this as well as our Reactions add-on at the same time and have still been unable to replicate this error. If anyone is having this issue and is willing to create a clone of their site and get me access to that clone for debugging I'll see what I can do to track down the root cause of this issue as I see no reason container wouldn't be defined under normal circumstances
 
there may be something which might be trowing error - xenforo software system itself might be doing this (A guess - not sure).
 
@Jake B. I could give you access to my forum, giving you an account with admin rights, but I can't give you a full clone of my forum.
 
Top Bottom