Chat 2 by Siropu

Chat 2 by Siropu [Paid] 2.3.5

No permission to buy (€29.99)
Hey there,

I'm receiving the following error on XF2.1:

Code:
Server error log
[LIST]
[*]ErrorException: Template error: Invalid argument supplied for foreach()
[*]src\addons\Siropu\Chat\Repository\User.php:62
[*]Generated by: EyesOnly
[*]7 Feb 2019 at 18:35
[/LIST]
Stack trace
#0 src\addons\Siropu\Chat\Repository\User.php(62): XF\Template\Templater->handleTemplateError(2, 'Invalid argumen...', 'D:\\inetpub\\wwwr...', 62, Array)
#1 src\addons\Siropu\Chat\Data.php(129): Siropu\Chat\Repository\User->groupUsersByRoom(Object(XF\Mvc\Entity\ArrayCollection))
#2 src\addons\Siropu\Chat\Data.php(58): Siropu\Chat\Data->setRoomParams(Array)
#3 src\addons\Siropu\Chat\Widget\Chat.php(122): Siropu\Chat\Data->getViewParams(Array)
#4 internal_data\code_cache\widgets\_23_siropu_chat.php(5): Siropu\Chat\Widget\Chat->render()
#5 src\XF\Template\Templater.php(6569): XF\SubContainer\Widget->{closure}(Object(ThemeHouse\UIX\XF\Template\Templater), Array, Array)
#6 src\XF\SubContainer\Widget.php(168): XF\Template\Templater->renderWidgetClosure(Object(Closure), Array)
#7 src\XF\Template\Templater.php(1613): XF\SubContainer\Widget->getCompiledWidget(Array, Array)
#8 internal_data\code_cache\templates\l2\s19\public\forum_list.php(233): XF\Template\Templater->widgetPosition('siropu_chat_abo...', Array)
#9 src\XF\Template\Templater.php(1294): XF\Template\Templater->{closure}(Object(ThemeHouse\UIX\XF\Template\Templater), Array)
#10 src\XF\Template\Template.php(24): XF\Template\Templater->renderTemplate('forum_list', Array)
#11 src\XF\Mvc\Renderer\Html.php(48): XF\Template\Template->render()
#12 src\XF\Mvc\Dispatcher.php(418): XF\Mvc\Renderer\Html->renderView('XF:Forum\\Listin...', 'public:forum_li...', Array)
#13 src\XF\Mvc\Dispatcher.php(400): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#14 src\XF\Mvc\Dispatcher.php(360): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#15 src\XF\Mvc\Dispatcher.php(53): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#16 src\XF\App.php(2177): XF\Mvc\Dispatcher->run()
#17 src\XF.php(390): XF\App->run()
#18 index.php(20): XF::runApp('XF\\Pub\\App')
#19 {main}
 
Hey Siropu, thanks for all the work - such a great addon.

I was looking into an issue our forum has been having (using the default XF 2.1 theme as well) regarding the scrolling to the bottom of messages upon posting of images, mentioned here:

Possible to make the chat always scroll down to the newest message upon loading? It is cumbersome having to scroll down to the latest message every time I load the chat. (happens when a image has been posted)

Just check here:
https://www.theaocdungeon.com/chat/

The above post is from April and I see you attempted to address the issue however at least for me (and I'm assuming others probably have the same problem as well, though like you pointed it out it's a very interesting bug because it doesn't always happen) the problem still persists.

I'm wondering if it has to do with the fact that images aren't "immediately" loaded by the browser when a chat message is received - by this I mean that a message is received and THEN the image is loaded (even though it happens rather fast after a message is received). This can actually manifest itself in normal threads with images as well - since the dimensions of the image are not referenced in the img tag you will see the posts have a constant scroll/jitter until the images are fully loaded.

I would also venture a guess that if the chat messages are newest at the top of the div containing the chat content, this will probably not happen - but of course that's really only a workaround.

I think a solution might be to detect when the page is done loading images and then issue a scroll-to-bottom javascript command (of course, detecting if the user has manually scrolled to prevent it from ALWAYS scrolling to bottom when not wanted, such as in this case).

Any thoughts or solutions you've found regarding this issue? Thanks!
 
I'm wondering if it has to do with the fact that images aren't "immediately" loaded by the browser when a chat message is received - by this I mean that a message is received and THEN the image is loaded (even though it happens rather fast after a message is received). This can actually manifest itself in normal threads with images as well - since the dimensions of the image are not referenced in the img tag you will see the posts have a constant scroll/jitter until the images are fully loaded.
That's the problem.

I think a solution might be to detect when the page is done loading images and then issue a scroll-to-bottom javascript command (of course, detecting if the user has manually scrolled to prevent it from ALWAYS scrolling to bottom when not wanted, such as in this case).
I have already implemented something like this and doesn't seem to work as expected. I have made some changes, hopefully it will work better.
 
Siropu updated Chat 2 by Siropu with a new update entry:

Improvements & Bug Fixes

Added room option to prevent users from leaving the room.
Added admin option to set if XF user online status privacy applies to chat or not.

Bugs Fixed
Whispering from user menu doesn't show the username in brackets.
Setting chat as the board index in all pages mode, shows two chat instances.
Errors in certain situations.
Other code issues.

Read the rest of this update entry...
 
@Siropu I just purchased a year of updates just now and was able to get the money to go ahead with that. Thank you for your support. Your an amazing developer. I look forward to working with you in the coming year. Appreciate your business
 
Following error during upgrade. Don't know if it's relevant or not.
Code:
Error: Call to undefined method Siropu\Chat\Service\Message\Sorter::getHasImages() src/addons/Siropu/Chat/ControllerPlugin/Update.php:100
Generated by: MJ Feb 8, 2019 at 4:31 PM
Stack trace
#0 src/addons/Siropu/Chat/Pub/Controller/Chat.php(428): Siropu\Chat\ControllerPlugin\Update->getUpdates(Array)
#1 src/addons/Siropu/Chat/Pub/Controller/Chat.php(433): Siropu\Chat\Pub\Controller\Chat->getUpdates(Array)
#2 src/XF/Mvc/Dispatcher.php(321): Siropu\Chat\Pub\Controller\Chat->actionUpdate(Object(XF\Mvc\ParameterBag))
#3 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('Siropu\\Chat:Cha...', 'Update', Object(XF\Mvc\RouteMatch), Object(Siropu\Chat\Pub\Controller\Chat), NULL)
#4 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Siropu\Chat\Pub\Controller\Chat), NULL)
#5 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#6 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
#7 src/XF.php(390): XF\App->run()
#8 index.php(20): XF::runApp('XF\\Pub\\App')
#9 {main}
Request state
array(4) {
  ["url"] => string(791) "/xenforo/index.php?chat/update&users%5B1%5D=673%2C8418%2C252%2C2336%2C9032%2C8287%2C5015%2C7911%2C1656%2C2486%2C8687%2C9174%2C1759%2C8629%2C8531%2C3887%2C6674%2C3402%2C9120%2C1142%2C3656%2C7160%2C14%2C7732%2C976%2C8970%2C7734%2C9170%2C1453%2C6489%2C1%2C569%2C8361%2C195%2C9022%2C1192%2C8022%2C8979%2C9043%2C4736%2C5896%2C5118%2C9075%2C9038%2C7271%2C9051%2C8752%2C8615%2C4715%2C8941%2C6239%2C1625%2C7771%2C8148%2C8723%2C1864%2C2093%2C3403%2C30%2C5721%2C8278%2C8960%2C3412%2C6575%2C6839%2C8649&channel=room&room_id=1&last_id%5B1%5D=2363&conv_id=5&conv_only=0&conv_items=5%2C21&conv_last_active=1549664592&conv_last_update=1549665074&user_last_update=1549665074&is_chat_page=0&_xfRequestUri=%2Fxenforo%2F&_xfWithData=1&_xfToken=1549664592%2C7f0fd426b12aaf28affb77c9543f8ac9&_xfResponseType=json"
  ["referrer"] => string(35) "https://pointsixtyfive.com/xenforo/"
  ["_GET"] => array(16) {
    ["chat/update"] => string(0) ""
    ["users"] => array(1) {
      [1] => string(317) "673,8418,252,2336,9032,8287,5015,7911,1656,2486,8687,9174,1759,8629,8531,3887,6674,3402,9120,1142,3656,7160,14,7732,976,8970,7734,9170,1453,6489,1,569,8361,195,9022,1192,8022,8979,9043,4736,5896,5118,9075,9038,7271,9051,8752,8615,4715,8941,6239,1625,7771,8148,8723,1864,2093,3403,30,5721,8278,8960,3412,6575,6839,8649"
    }
    ["channel"] => string(4) "room"
    ["room_id"] => string(1) "1"
    ["last_id"] => array(1) {
      [1] => string(4) "2363"
    }
    ["conv_id"] => string(1) "5"
    ["conv_only"] => string(1) "0"
    ["conv_items"] => string(4) "5,21"
    ["conv_last_active"] => string(10) "1549664592"
    ["conv_last_update"] => string(10) "1549665074"
    ["user_last_update"] => string(10) "1549665074"
    ["is_chat_page"] => string(1) "0"
    ["_xfRequestUri"] => string(9) "/xenforo/"
    ["_xfWithData"] => string(1) "1"
    ["_xfToken"] => string(43) "1549664592,7f0fd426b12aaf28affb77c9543f8ac9"
    ["_xfResponseType"] => string(4) "json"
  }
  ["_POST"] => array(0) {
  }
}
 
That's the problem.

I have already implemented something like this and doesn't seem to work as expected. I have made some changes, hopefully it will work better.

I wonder if implementing an option to convert inserted images to thumbnails (and thus the dimensions would be able to be specified in the actual chat message data) would fix the issue. Of course, I hate when people suggest features and crap to me so no need to even consider it if you don't want to lol, but if it's something that really bugs you (the scroll issue) it might be a way to workaround the problem rather easily.
 
Top Bottom