Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

[ReplyTo addon] ReplyTo Prevents Ajaxed Comments

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.
  • A conundrum indeed!
  • @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?.
  • LincLinc Admin
    So you're looking for a way to modify the $Redirect variable with a hook there?
  • LincLinc Admin
    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) {
  • With a current project and some holidays out the way, I'll get back to this (and test it on the latest Vanilla). Thanks.
  • LincLinc Admin
    I haven't added it to core yet, so be sure to let me know if that works.
  • 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.

Sign In or Register to comment.