Fixed Notify User Error when moving images XFMG 2.0.5

David G

Member
Affected version
2.0.5
An error occurs when performing inline moderation on media items. Moving them with selecting notify user of moderation action throws error. If the notify user of moderation is not selected no error occurs. The items are still moved properly whether in both situations.

Code:
Error: Call to a member function canSendModeratorActionAlert() on null src/addons/XFMG/InlineMod/Media/Move.php:163
Generated by:  Nov 14, 2018 at 5:01 PM
Stack trace
#0 src/XF/InlineMod/AbstractAction.php(80): XFMG\InlineMod\Media\Move->applyInternal(Object(XF\Mvc\Entity\ArrayCollection), Array)
#1 src/XF/Pub/Controller/InlineMod.php(131): XF\InlineMod\AbstractAction->apply(Object(XF\Mvc\Entity\ArrayCollection), Array)
#2 src/addons/Siropu/AdsManager/XF/Pub/Controller/InlineMod.php(54): XF\Pub\Controller\InlineMod->actionPerform()
#3 src/XF/Mvc/Dispatcher.php(249): Siropu\AdsManager\XF\Pub\Controller\InlineMod->actionPerform(Object(XF\Mvc\ParameterBag))
#4 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:InlineMod', 'Perform', 'json', Object(XF\Mvc\ParameterBag), '', Object(Siropu\AdsManager\XF\Pub\Controller\InlineMod), Object(XF\Mvc\Reply\Reroute))
#5 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#6 src/XF/App.php(1931): XF\Mvc\Dispatcher->run()
#7 src/XF.php(329): XF\App->run()
#8 index.php(13): XF::runApp('XF\\Pub\\App')
#9 {main}

Request state
array(4) {
  ["url"] => string(18) "/forum/inline-mod/"
  ["referrer"] => string(74) "https://domain.com/forum/media/categories/registered-user-testing.79/"
  ["_GET"] => array(1) {
    ["/forum/inline-mod/"] => string(0) ""
  }
  ["_POST"] => array(13) {
    ["target_type"] => string(8) "category"
    ["target_category_id"] => string(2) "81"
    ["author_alert"] => string(1) "1"
    ["author_alert_reason"] => string(4) "Test"
    ["ids"] => array(1) {
      [0] => string(5) "13065"
    }
    ["type"] => string(10) "xfmg_media"
    ["action"] => string(4) "move"
    ["confirmed"] => string(1) "1"
    ["_xfRedirect"] => string(74) "https://domain.com/forum/media/categories/registered-user-testing.79/"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(51) "/forum/media/categories/registered-user-testing.79/"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}


Code:
ErrorException: [E_NOTICE] Undefined variable: entity src/addons/XFMG/InlineMod/Media/Move.php:163
Generated by:  Nov 14, 2018 at 5:01 PM
Stack trace
#0 src/addons/XFMG/InlineMod/Media/Move.php(163): XF::handlePhpError(8, '[E_NOTICE] Unde...', '/home/nginx/dom...', 163, Array)
#1 src/XF/InlineMod/AbstractAction.php(80): XFMG\InlineMod\Media\Move->applyInternal(Object(XF\Mvc\Entity\ArrayCollection), Array)
#2 src/XF/Pub/Controller/InlineMod.php(131): XF\InlineMod\AbstractAction->apply(Object(XF\Mvc\Entity\ArrayCollection), Array)
#3 src/addons/Siropu/AdsManager/XF/Pub/Controller/InlineMod.php(54): XF\Pub\Controller\InlineMod->actionPerform()
#4 src/XF/Mvc/Dispatcher.php(249): Siropu\AdsManager\XF\Pub\Controller\InlineMod->actionPerform(Object(XF\Mvc\ParameterBag))
#5 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:InlineMod', 'Perform', 'json', Object(XF\Mvc\ParameterBag), '', Object(Siropu\AdsManager\XF\Pub\Controller\InlineMod), Object(XF\Mvc\Reply\Reroute))
#6 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#7 src/XF/App.php(1931): XF\Mvc\Dispatcher->run()
#8 src/XF.php(329): XF\App->run()
#9 index.php(13): XF::runApp('XF\\Pub\\App')
#10 {main}
Request state
array(4) {
  ["url"] => string(18) "/forum/inline-mod/"
  ["referrer"] => string(74) "https://domain.com/forum/media/categories/registered-user-testing.79/"
  ["_GET"] => array(1) {
    ["/forum/inline-mod/"] => string(0) ""
  }
  ["_POST"] => array(13) {
    ["target_type"] => string(8) "category"
    ["target_category_id"] => string(2) "81"
    ["author_alert"] => string(1) "1"
    ["author_alert_reason"] => string(4) "Test"
    ["ids"] => array(1) {
      [0] => string(5) "13065"
    }
    ["type"] => string(10) "xfmg_media"
    ["action"] => string(4) "move"
    ["confirmed"] => string(1) "1"
    ["_xfRedirect"] => string(74) "https://domain.com/forum/media/categories/registered-user-testing.79/"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(51) "/forum/media/categories/registered-user-testing.79/"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
 
Thank you for reporting this issue. The issue is now resolved and we are aiming to include that in a future XFMG release (2.0.6).

Change log:
Prevent error when opting into moderator action alerts when moving media.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Top Bottom