zammad / zammad

Zammad is a web based open source helpdesk/customer support system
https://zammad.org
GNU Affero General Public License v3.0
4.34k stars 738 forks source link

Zammad Chat No JQuery version don't work without button element #2561

Closed BertrandGouny closed 4 years ago

BertrandGouny commented 5 years ago

Infos:

Expected behavior:

Chat should work if no open button element exists ?

Actual behavior:

Uncaught TypeError: Cannot read property 'classList' of null
    at s.onError (chat-no-jquery.min.js:1)
    at Object.onError (chat-no-jquery.min.js:1)
    at WebSocket.ws.onclose (chat-no-jquery.min.js:1)

Problematic line : https://github.com/zammad/zammad/blob/2de61bd4c53df469df5838173cc0147447364418/public/assets/chat/chat-no-jquery.js#L745

Steps to reproduce the behavior:

remove that line : https://github.com/zammad/zammad/blob/2de61bd4c53df469df5838173cc0147447364418/public/assets/chat/znuny-no-jquery.html#L113

MrGeneration commented 5 years ago

Please use the complete issue form and describe your problem better. If it helps, you can also use screencasts.

BertrandGouny commented 5 years ago

@MrGeneration reading the 2 lines of code quoted should be enough for any javascript developer to see that document.querySelector("." + this.options.buttonClass) might be null so document.querySelector("." + this.options.buttonClass).classList.add(this.inactiveClass); give the error

not sure why you need a screencast for that

MrGeneration commented 5 years ago

Again: Please do complete the issue template, as it is incomplete. I will have to close this if it's not completed.

mantas commented 5 years ago

@BertrandGouny developer here. Knowing which line causes the crash won't tell me how to reproduce the bug.

BertrandGouny commented 5 years ago

@mantas as stated in "Steps to reproduce the behavior" you can reproduce the bug by taking back znuny-no-jquery.html example file and removing the dom element with class="open-zammad-chat"

mantas commented 4 years ago

Closing as this issue seems to be fixed along the way in develop branch.

BertrandGouny commented 4 years ago

thanks :)