Howdy, Stranger!

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

Try Vanilla Forums Cloud product

Ready to contribute?

Amazing! Sign our contributors' agreement and then join us on GitHub.

Update for critical security issue in PHPMailer included in release Vanilla 2.3.1
Please upgrade to 2.3 here. The 2.2 and earlier branches are no longer being updated.

Posts appear twice when posting

This discussion is related to the Discussion Refresh addon.

Hi,

When posting a comment, it appears twice in the discussion (I assume because the plugin refreshes the view so you see the comment you just posted, and Vanilla by default displays it too without refreshing anything.)

Using Vanilla 2.1 :)

Comments

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Does that happen every time when you post? I have made no check for that, indeed, but it never happened to me.
    It can only happen, if the comment has already been commited, before the commets get fetched. So the writing action has been performed much faster than the reading action? That would be strange. But in order to avoid that, I could implement a check for only displaying comments that have not been posted by the current user.

    But if anyone uses more than one browser window, that would lead to ugly updates, too.

    Could you please keep an eye on that behaviour and tell me if it happens always, often or only from time to time?

  • Based on my testing it consistently happens for the first post after signing in. The latter posts are displayed only once. If I log out, then log back in, and post, it happens again.

    R_Jhgtonight
  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    I love reproducable errors! :)

    I'll take a look at that as soon as possible

    peregrineAccentUnderDog
  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Sorry, @Accent, but I couldn't reproduce that by now. Either it is something exotic on your side or I'm just a lucky guy.

    If no one else will get the same feedback, I think I will not change anything but if I would, I would do something like that: put $PreviousCommentID = $CommentID at the end of the foreach loop and enclose the inner foreach code in an if clause like that: if ($CommentID != $PreviousCommentID) {...} (must start after $CommentID = ...)
    If you still have got the problem, you might try to solve it that way.

    By now I have an untested version v0.2 on GitHub which is optimized for boards with cache enabled. After I've tested it, I will update the version here. This version works with $Comments as an array, so it would be easy to simply add $Comments = array_unique($Comments) right before the foreach loop. I guess I'll add that before I upload v0.2 to addons section

  • peregrineperegrine MVP
    edited August 2014

    @R_J said:
    I love reproducable errors! :)

    I love reproducable reproducible errors as well (as in I in i and not a). :( >:)

    but I only speak one language, you guys amaze me how fluent you are. You polyglots.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    UnderDog
  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    Only two languages here... Although I've tried to learn Spanish some time ago, but I never got past those useless beginner sentences. I guess I'll never enter a room, look around and proudly announce: "Buenas noches - yo soy un hombre! La mujer bebe leche e yo come una manzana! :)"

    peregrineUnderDog
  • peregrineperegrine MVP
    edited August 2014

    test to see if google translate can make a dry joke funny in another language :)

    A guy with a crocodile under his arm walks into a bar

    Guy with Crocodile says "Do you serve Software Developers"?
    Bartender says: "Sure, no problem"

    Guy with Crocodile says: "Ok, a beer for me, and a software developer for my crocodile."


    Un tipo con un cocodrilo bajo el brazo entra en un bar

    Individuo con el cocodrilo dice "¿Sirven los desarrolladores de software"?
    El camarero dice: "Claro, no hay problema"

    Individuo con el cocodrilo dice: "Ok, una cerveza para mí, y un desarrollador de software para mi cocodrilo."


    Ein Mann mit einem Krokodil unter dem Arm geht in eine Bar

    Guy mit Krokodil sagt: "Sie dienen Software-Entwickler"?
    Barkeeper sagt: "Klar, kein Problem"

    Guy mit Krokodil sagt: "Ok, ein Bier für mich, und ein Software-Entwickler für mein Krokodil."

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    R_JUnderDog
  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    @peregrine said:
    Ein Mann mit einem Krokodil unter dem Arm geht in eine Bar

    Guy mit Krokodil sagt: "Sie dienen Software-Entwickler"?
    Barkeeper sagt: "Klar, kein Problem"

    Guy mit Krokodil sagt: "Ok, ein Bier für mich, und ein Software-Entwickler für mein Krokodil."

    The catch is that there are two different words for the different meanings of "serve" in German and that's why it cannot be translated literally and translation bots must fail ;)

    But if we're testing Google translate, I'll give it a poem: the only one that I know by heart. It is called "Ottos Mops" by Ernst Jandl:

    ottos mops

    ottos mops trotzt
    otto: fort mops fort
    ottos mops hopst fort
    otto: soso

    otto holt koks
    otto holt obst
    otto horcht
    otto: mops mops
    otto hofft

    ottos mops klopft
    otto: komm mops komm
    ottos mops kommt
    ottos mops kotzt
    otto: ogottogott


    Google fails completely - not even "mops" is translated all the time...

    ottos mops

    ottos mops defying
    otto: fort mops continue
    ottos mops continue hops
    otto: soso

    otto brings coke
    otto brings fruit
    otto listens
    otto: pug pug
    otto hopes

    ottos mops knocking
    otto: come come pug
    ottos mops comes
    ottos mops pukes
    otto: ogottogott

    peregrineUnderDog
  • peregrineperegrine MVP
    edited August 2014

    @r_j here are some translations for Ottos Mops

    http://www.signandsight.com/features/290.html

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    R_JJesseW
  • businessdadbusinessdad Stealth contributor MVP

    @R_J said:
    I love reproducable errors! :)

    @R_J said:
    Sorry, Accent, but I couldn't reproduce that by now. Either it is something exotic on your side or I'm just a lucky guy.

    Ta-dah!

    R_J
  • oh boy this thread has deviated quite a bit hasn't it

    @R_J‌, okay, I'll let you know if other users on my board report the same problem and I'll try the new version when it's released :)

    R_Janiss
  • Mine is doing the same thing. I post and it shows up twice; once as posted, and once as if I am still writing comment.

Sign In or Register to comment.