Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter
Support for Vanilla Forums Cloud product

In this Discussion

Follow Us


[ReplyTo addon] ReplyTo Prevents Ajaxed Comments

edited February 2011 in Questions
This discussion is related to the ReplyTo addon.
The ReplyTo plugin is preventing comments from being submitted without a page reload. I ran several tests on a fresh install to confirm. The problem affects replies as well as normal comments. Any idea how to fix this?
Tagged:

Comments

  • Wow....my apologies. I just noticed this issue is already mentioned in the plugin's ReadMe file. Any progress on fixing this?
  • judgejjudgej
    edited December 2010
    No, there is no progress on this, and unlikely to be any until I can find some documentation on the whole AJAX-oriented framework that Vanillla uses.

    My question is also: any idea how to fix this?

    I'm not sure why it affects non-reply comments though, as I didn't think I touched that bit of the code.
  • @judgej AJAX does not get disabled. It still works via AJAX, but adds a redirect. Here is why. There is something in applications/vanilla/controllers/class.postcontroller.php:
    $Redirect =  !in_array($OrderBy, array('c.DateInserted', 'c.CommentID'))
    And later:
    if ($Redirect) {
    // The user posted a comment on a page other than the last one, so just redirect to the last page.
    $this->RedirectUrl = Gdn::Request()->Url("discussion/comment/$CommentID/#Comment_$CommentID", TRUE);
    You change OrderBy, so thats why it redirects. Simple fix would be adding both c.DateInserted and c.CommentID to order by clause.

    Longer, and possibly more correct way would be changing the way how Redirect is checked in main vanilla code.
  • judgejjudgej
    edited February 2011
    Nice fix - thanks! I'll get that added (probably next week now, as I'm pretty busy this week), but I will get it in. It does seem like it could be a workaround with limited life though.

    I guess a proper fix would be to use an API to check what page the post would be on, and redirect only if it is on a different page. If you replied to the last comment on page one of a two-page discussion, then that would require a redirect to take you to page two.

    This redirect will happen even without this module if you do not have massively-long pages (like this forum, and may even be why this forum page length has been set so high) so it does look like a core problem with a fix needing to go in to the core. I expect a longer-term fix would be to use AJAX to replace much larger portions of the page, i.e. all of the discussion displayed on the page and not just individual comments.

    -- Jason
  • Nope, this simple fix won't work. It checks for first element in order by clause. Something has to be done with postcontroller itself. Maybe add new event before that if mentioned above.

    @mark, @Todd, any ideas?.
  • LincolnLincoln Community Instigator Vanilla Staff
    So you're looking for a way to modify the $Redirect variable with a hook there?

    Sr Developer at Vanilla Forums [GitHub, Twitter]

  • LincolnLincoln Community Instigator Vanilla Staff
    edited July 2011
    Something like this?
       $Redirect = !in_array($OrderBy, array('c.DateInserted', 'c.CommentID'));
    $DisplayNewCommentOnly = $this->Form->GetFormValue('DisplayNewCommentOnly');

    $this->EventArguments['Redirect'] &= $Redirect;
    $this->FireEvent('BeforeCommentRedirect');

    if (!$Redirect) {

    Sr Developer at Vanilla Forums [GitHub, Twitter]

  • With a current project and some holidays out the way, I'll get back to this (and test it on the latest Vanilla). Thanks.
  • LincolnLincoln Community Instigator Vanilla Staff
    I haven't added it to core yet, so be sure to let me know if that works.

    Sr Developer at Vanilla Forums [GitHub, Twitter]

  • I am trying to implement this fix to have Reply To play nice with an embedded installation of Vanilla but the fix suggested above does not seem to work. Any other ideas to prevent the redirect when Vanilla is embedded?

  • I was having issues with email notifications on my forum and narrowed it down to one of the plugins. Turns out, this plugin caused my "new comment" emails to not go out! Disabled it and all notifications were back to normal. It's most likely related to the AJAX issues mentioned above.

    hgtonight
Sign In or Register to comment.