Jump to content

Recommended Posts

Posted

Seeing below error when I try to post on user profile... it happens randomly but it's consistent and can be reproduced - especially, when you try to comment on existing profile status update.  How do I figure out which application or IPS code is causing it? Thanks. 

Could contain: File, Monitor, Screen, Computer Hardware, Hardware, Electronics, Webpage, Pc, Computer

 

;(function($,_,undefined){"use strict";ips.controller.register('core.front.statuses.status',{_commentStatusID:null,initialize:function(){this.on('click','[data-action="loadPreviousComments"], [data-action="loadNextComments"]',this.paginate);this.on('submit','[data-role="replyComment"]',this.quickReply);this.on(document,'addToStatusFeed',this.addToStatusFeed);this.setup();},setup:function(){this._commentStatusID=this.scope.attr('data-statusID');},paginate:function(e){e.preventDefault();var feed=$(e.currentTarget).closest('[data-role="statusComments"]');var paginateRow=$(e.currentTarget).closest('.cStatusUpdates_pagination');paginateRow.html(ips.templates.render('core.statuses.loadingComments'));ips.getAjax()($(e.currentTarget).attr('href')).done(function(response){paginateRow.replaceWith(response);feed.find('meta').remove().end();$(document).trigger('contentChange',[feed]);}).fail(function(response){paginateRow.replaceWith('');ips.ui.alert.show({type:'alert',icon:'warn',message:_.isUndefined(response.responseJSON)?ips.getString('errorLoadingContent'):response.responseJSON,});});},quickReply:function(e){var form=this.scope.find('[data-role="replyComment"] form');if(form.attr('data-noAjax')){return;}
e.preventDefault();e.stopPropagation();var self=this;var feed=$(e.currentTarget).closest('[data-role="statusComments"]');var replyArea=this.scope.find('[data-role="replyComment"]');var submit=this.scope.find('[type="submit"]');var page=feed.attr('data-currentPage');if(!page){page=1;}
var currentText=submit.text();submit.prop('disabled',true).text(ips.getString('saving'));ips.getAjax()(form.attr('action'),{data:form.serialize()+'&submitting=1&currentPage='+page,type:'post'}).done(function(response){self.trigger('addToStatusFeed',{content:response.content,statusID:self._commentStatusID});}).fail(function(){form.attr('data-noAjax','true');form.submit();}).always(function(){submit.prop('disabled',false).text(currentText);});},addToStatusFeed:function(e,data){if(!data.content||data.statusID!=this._commentStatusID){return;}
var content=$('<div/>').append(data.content);this.scope.find('[data-role="statusComments"]').append(content);ips.utils.anim.go('fadeInDown',content);ips.ui.editor.getObj(this.scope.find('[data-role="replyComment"] [data-ipsEditor]')).reset();$(document).trigger('contentChange',[this.scope]);}});}(jQuery,_));;
;(function($,_,undefined){"use strict";ips.controller.register('core.front.statuses.statusFeed',{initialize:function(){this.on('submit','[data-role="newStatus"] form',this.submitNewStatus);this.setup();},setup:function(){},submitNewStatus:function(e){e.preventDefault();e.stopPropagation();var self=this;var feed=this.scope.find('[data-role="activityStream"]');var replyArea=this.scope.find('[data-role="replyComment"]');var form=this.scope.find('[data-role="newStatus"] form');var submit=this.scope.find('[data-action="submitComment"]');var textarea=form.find('textarea');var currentText=submit.text();if(!textarea.val()){ips.ui.alert.show({type:'alert',message:ips.getString('validation_required'),icon:'warn'});return;}
submit.prop('disabled',true).text(ips.getString('saving'));ips.getAjax()(form.attr('action'),{data:form.serialize(),type:'post',bypassRedirect:true}).done(function(response){var content=$('<div/>').append(response);var comment=content.find('.ipsComment,.ipsStreamItem').first();feed.prepend(comment);ips.utils.anim.go('fadeInDown',comment);$('textarea[name="'+textarea.attr('name')+'"]').closest('[data-ipsEditor]').data('_editor').reset();$(document).trigger('contentChange',[comment]);}).fail(function(xhr){self.scope.find('#elStatusSubmit').parent().html(xhr.responseText);$(document).trigger('contentChange',[self.scope.find('#elStatusSubmit').parent()]);}).always(function(){submit.prop('disabled',false).text(currentText);});}});}(jQuery,_));;

 

Posted

I've literally just been debugging this same issue over at Neowin - we've been experiencing it at least since September.

From my testing, the issue only arises if you attempt to reply to a status the first time you load the page you're making the reply on. If you refresh, or navigate away and return, you can reply without issue.

Stepping through the JS, I believe I've tracked down the cause of the issue, but I don't understand the internal working of the IPB JS well enough to suggest a fix. I've tracked the issue back to the ips.ui.editor.getObj(this.scope.find('[data-role="replyComment"] [data-ipsEditor]')) call returning undefined, rather than the ckeditor object.

Tracing this back, I think this is happening due to some code called from the core.front.profile.main controller - in the 'setup' method there, the browser history state is having section: 'goToProfile' ammended onto it. There is other code in the controller that watches for the history state being modified, and fires some code that unsets all IPB widgets on the page. I believe this is clearing the editor object from the .data('_editor') property on the editor element, which in turn causes the ips.ui.editor.getObj to return undefined.

When the page is reloaded / visited again, because the section: 'goToProfile' value is already set on the history state for the page, then it's not set again, so no state change happens, and the code that unsets the widgets is not fired.

I would assume the fix is either to not unset the widgets in the first place, or to ensure that they're set again properly afterwards. Someone on the IPB team that knows the code way better than me would have to figure out exactly what needs to happen, but hopefully this can point them in the right direction.

Posted (edited)
36 minutes ago, DaveLegg said:

From my testing, the issue only arises if you attempt to reply to a status the first time you load the page you're making the reply on. If you refresh, or navigate away and return, you can reply without issue.

 

I agree. It drove me nuts. I started with our Firewall, CF, apps, etc. and then was able to figure out based on console error. 

I hope someone from IPS will take a look and fix this issues. Makes forum profile unstable because people don't refresh and it's getting annoying for them.

I am happy, that I am not alone. Please share the fix in case if you create custom fix for your site. You got pretty popular site their and I used to be active user on it when I was little younger. 

Thanks!

Edited by AlexJ
Posted
10 minutes ago, Marc Stridgen said:

Is this something that is causing you an issue on the page itself, or something that is just showing in console only?

It causes the reply to not show on the page, the editor to not be cleared, and the button to remain disabled - it looks to the user like the reply failed to go through - or is stuck in the process of submitting - on refresh they can then see it

  • 2 weeks later...
Posted

In the first instance, please test this on a default theme, with no 3rd party items enabled. If you are then still having problems, please let me know which browser you are using

Posted
15 hours ago, Marc Stridgen said:

In the first instance, please test this on a default theme, with no 3rd party items enabled. If you are then still having problems, please let me know which browser you are using

Have issue in Chrome latest version on default theme. 

  • 2 weeks later...
Posted
On 1/31/2023 at 4:25 AM, Marc Stridgen said:

Ive been doing some testing on the latest beta and Im unable to replicate this at all currently. Please test this once that is released and let us know if you see the same

Error still exist with latest version 😞  

Posted
13 hours ago, AlexJ said:

Error still exist with latest version 😞  

Have you tried disabling all third party applications/plugins and switching to an unmodified theme? Just like my colleague, I cannot reproduce this on my test install on the latest release.

Posted

I haven't had a chance to try the new version yet. Just wanted to flag that when testing you'll need to ensure that you're trying to post the reply the first time you've loaded that specific URL in order to encounter the bug. If you've been to the page before, or refresh it, then the issue won't occur

Posted

Could you also let me know which OS you have chrome on? I will then try and replicate in the same environment, or escalate your own site to devs so we can get to the bottom of the issue

Posted (edited)

Yep, I have the same error.

2 hours ago, Marc Stridgen said:

Could you also let me know which OS you have chrome on?

Windows 11 and the latest Edge.

Edited by SeNioR-
  • 3 weeks later...
Posted (edited)
On 2/15/2023 at 1:40 PM, Marc Stridgen said:

Ah, indeed. We have a bug report open for this

Any progress? May we know when it will be fixed? We've been struggling with this for months 😕 

Quote

Uncaught TypeError: Cannot read properties of undefined (reading 'reset')
    at baseController.addToStatusFeed (front_front_statuses.js?v=27b94d900c1678047906:4:234)
    at nr (root_library.js?v=27b94d900c1678047906:1:7597)
    at HTMLDocument.<anonymous> (root_library.js?v=27b94d900c1678047906:1:8025)
    at HTMLDocument.<anonymous> (root_library.js?v=27b94d900c1678047906:1:1076)
    at HTMLDocument.dispatch (root_library.js?v=27b94d900c1678047906:2:43090)
    at v.handle (root_library.js?v=27b94d900c1678047906:2:41074)
    at Object.trigger (root_library.js?v=27b94d900c1678047906:2:71513)
    at HTMLLIElement.<anonymous> (root_library.js?v=27b94d900c1678047906:2:72108)
    at Function.each (root_library.js?v=27b94d900c1678047906:2:2976)
    at jQuery.fn.init.each (root_library.js?v=27b94d900c1678047906:2:1454)

Edited by SeNioR-
  • 9 months later...
Posted

I am still having an issue when posting profile comments on our site. Do you guys have any solution planned? This bug is open since months now. 

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...