Inconsistent link behaviour


  • sockdevs

    I think we've reported this before?

    @sloosecannon said:

    ?

    Left-click: error.
    Middle-click: works.

    :wtf:

    Note: Link leads to a thread in the Lounge, so you need to be at least TL3 to get to it


  • Winner of the 2016 Presidential Election

    Well it breaking makes sense. I did something totally unsupported.
    I put a link in an <a> tag.

    Wait a second...



  • All things I can do on my laptop cause the error.
    Left click: error.
    Ctrl+left click: error.
    Right click, open in new tab: error.

    edit: and three finger tap: error.


  • area_can

    :wtf:



  • Copying and pasting that URL into a new incognito window gives an error too, so it's something wrong with the URL or the page it tries to generate.


  • sockdevs

    For you it should say something along the lines of 'access denied', which is normal, as it's a Lounge thread, which you haven't yet earned the right to access :stuck_out_tongue:



  • Oh, that'll be why it always errors then.
    However - it's always this.




  • Where does it say "access denied"? Is it written in white text?


  • sockdevs

    Oh yeah, that's the wrong result; looks like @LB_ has the same issue


  • sockdevs

    This is what it should be:



  • Nope, it doesn't matter whether I am logged in or not, I just get the error. Google Chrome Version 45.0.2454.85 m (64-bit)


  • Winner of the 2016 Presidential Election

    Actually that might be the discocorrect message. There could be a bug throwing up the wrong message



  • Sadly this isn't the first time a bug has been discovered while reporting another bug.


  • Winner of the 2016 Presidential Election

    I think that's it...


  • sockdevs


  • Winner of the 2016 Presidential Election

    Huh.

    First one errors on left click only, second one works



  • The slug version gives the access denied message. When logged out, it asks to log in.


  • sockdevs

    And that's the wonders of Discourse ;)



  • :facepalm:


  • sockdevs

    In theory, the slug part (normally the topic title) is optional; however, the processing is fucked up, so omitting the slug hits a different error condition


  • Winner of the 2016 Presidential Election

    What tops the discoursistancy cake though, is the fact that it breaks even for logged in users... at least, until you middle mouse click it...



  • Isn't that a years-old WONTFIX TOOLAZY OHHEYABIKESHED?

    Thing is, when you open the link with a middle-click, you load its href. Said href is the shortened version of the link (t/nnnn), but that's okay, because Discourse's controller for that route simply issues a 301 Moved Permanently and redirects you to the proper, slugged link.

    Problem is, when you left-click, you run Discourse's magic click handler instead. That, instead of simply redirecting you to the t/xxxx controller, attempts to handle retrieving the slug client-side, and then load the page via AJAX. To do that, it first AJAXes to t/id_for/nnnn, which calls a different controller:

    def id_for_slug
        topic = Topic.find_by(slug: params[:slug].downcase)
        guardian.ensure_can_see!(topic)
        raise Discourse::NotFound unless topic
        render json: {slug: topic.slug, topic_id: topic.id, url: topic.url}
      end
    

    Which is all fine-and-dandy, but Discourse somehow (haven't pinned it down) chokes when sent an X-Requested-With: XMLHttpRequest header on that call.


  • Impossible Mission Players - A

    TIL I'm TL3. Nifty?
    Checking shadowmods...


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.