All three of the following links are to the second post in this topic. However, only the first two work. The third one worked until very recently, and we use it pretty extensively in our community to avoid cluttering wiki posts that reference several posts within the topic. That third link now just loads endlessly and never actually shows the content.
[full title link](https://meta.discourse.org/t/link-to-post-within-same-topic-doesnt-work-if-there-is-no-title-in-the-url/121455/2) full title link
[short title link](https://meta.discourse.org/t/short/121455/2) short title link
[no title link](https://meta.discourse.org/t/121455/2) no title link
P.S. Sorry about not using try.discourse.com earlier. I’ll create an account over there for next time.
This has been hacked up to work, when people accidentally omit the topic ID, we guess that if the “topic title” is all numeric, they meant the topic ID:
https://meta.discourse.org/t/{topic-id}
So this works
https://meta.discourse.org/t/121455
but this cannot, for what I hope are obvious reasons
https://meta.discourse.org/t/topic-title
But adding the post number to that is riskier.
I recommend not relying on sort of hacky undocumented behaviors, though, and switching to this formally supported form
The third link does work if you open it in a new tab. It’s only when you click within one tab that it breaks. And it breaks bad - you can’t even click the logo to go back to the front page of the forum.
TypeError: Cannot read property 'get' of undefined
at n.setupController (application-779d3dc401b01d1322f0bf8b26cb0e5f4c83a62f26cbecbd52159a94370dffc3.br.js:68)
at n.a.setup (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:8)
at i (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17)
at u.n.routeEnteredOrUpdated (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17)
at u.n.setupContexts (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17)
at u.n.finalizeTransition (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17)
at ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17
at f (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17)
at T (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17)
at E (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17)
Error while processing route: topic.fromParams Cannot read property 'get' of undefined TypeError: Cannot read property 'get' of undefined
at n.setupController (https://d11a6trkgmumsb.cloudfront.net/assets/application-779d3dc401b01d1322f0bf8b26cb0e5f4c83a62f26cbecbd52159a94370dffc3.br.js:68:14673)
at n.a.setup (https://d11a6trkgmumsb.cloudfront.net/assets/ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:8:6889)
at i (https://d11a6trkgmumsb.cloudfront.net/assets/ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17:23930)
at u.n.routeEnteredOrUpdated (https://d11a6trkgmumsb.cloudfront.net/assets/ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17:24069)
at u.n.setupContexts (https://d11a6trkgmumsb.cloudfront.net/assets/ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17:23260)
at u.n.finalizeTransition (https://d11a6trkgmumsb.cloudfront.net/assets/ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17:22253)
at https://d11a6trkgmumsb.cloudfront.net/assets/ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17:21378
at f (https://d11a6trkgmumsb.cloudfront.net/assets/ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17:29538)
at T (https://d11a6trkgmumsb.cloudfront.net/assets/ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17:30915)
at E (https://d11a6trkgmumsb.cloudfront.net/assets/ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17:30814)
Uncaught TypeError: Cannot read property 'cancelFilter' of undefined
at n.deactivate (application-779d3dc401b01d1322f0bf8b26cb0e5f4c83a62f26cbecbd52159a94370dffc3.br.js:68)
at n [as deactivate] (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:10)
at n.a.exit (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:8)
at u.n.setupContexts (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17)
at u.n.getTransitionByIntent (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17)
at u.n.transitionByIntent (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17)
at u.n.doTransition (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17)
at u.n.intermediateTransitionTo (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:17)
at n.s.intermediateTransitionTo (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:8)
at n.a.intermediateTransitionTo (ember_jquery-0ae86c6a7527a99c2b9b8a11521273bd9cb4f7d41bc546df081b7ee94f26d9c3.br.js:8)
Unfortunately we had no way of knowing that this wasn’t officially supported behavior. As far as we were concerned, it worked. So we used it. I’ll try to let people know not to use that approach from now on, but unfortunately that doesn’t help us now when we have hundreds of these floating around.
As @Dannii said, it only breaks when it’s clicked to load in the same tab, and pretty badly. Even if it’s only really supported for when people do this by accident, doesn’t that still mean it should be fixed? Especially since it works when the topic is different.
Puoi cercare nei tuoi post gli URL che corrispondono a un’espressione regolare. Per quanto ne sappia, devi solo specificare qualcosa nel campo del titolo; non deve essere per forza il titolo, ma è necessario inserire qualcosa.
Puoi specificare qualsiasi cosa per il titolo, sì. Non è però semplice come trovare i miei post. È diventato una pratica comune in una parte della nostra comunità rimuovere completamente il titolo per evitare URL troppo lunghi. Di conseguenza, diversi utenti dovrebbero correggere tutti i propri link.
Perché è stato spostato in supporto? Il fatto che la pagina giri all’infinito è chiaramente un bug, anche se la correzione non farà funzionare di nuovo gli URL senza titolo. Inoltre, che funzioni in alcuni casi (link a diversi post; accesso diretto all’URL nella barra degli indirizzi) ma non in questo, a mio parere, non ha molto senso.
Poiché si tratta di qualcosa che devi correggere a causa di un utilizzo non previsto, non è mai stato qualcosa di supportabile. Un bug è una funzionalità che ha smesso di funzionare, il che non è il caso qui.
Ho anche aggiornato il titolo per riflettere ciò che è effettivamente accaduto: i link non vengono creati senza un titolo. Questo problema è sorto perché i link sono stati inseriti manualmente o i loro titoli sono stati rimossi. Discourse non è in alcun modo la fonte del problema, quindi non può essere considerato un bug di Discourse.
Puoi identificare tutti i link rotti in un’unica operazione consultando il tuo database; i tuoi utenti non devono tornare indietro e correggerli manualmente, ma devi assolutamente riaddestrarli per evitare che lo facciano in futuro.
A lungo termine devono correggere i loro link, poiché quello che stavano facendo era essenzialmente un hack non supportato.
Come ho detto, l’ID dell’argomento da solo è effettivamente una forma ufficialmente supportata (per coprire il caso “oops ho dimenticato il titolo”), ma l’ID dell’argomento più l’ID del post non lo è.
Cosa ne pensi @eviltrout su come dovrebbe comportarsi il sistema (vedi il terzo link nel primo post)?
Oh, è interessante. Qual è il ragionamento alla base di questa differenza di trattamento? Non è forse vero che le persone dimenticano ancora il titolo ma sono interessate a un post specifico?
È un trucco piuttosto brutto, perché stiamo trattando il testo come numerico. In sostanza, è una valvola di sfogo del tipo: “Wow, l’utente è davvero confuso, supponiamo che faremo del nostro meglio”. Non è inteso come un metodo di navigazione principale su cui le persone dovrebbero fare affidamento, specialmente una volta che entrano in gioco anche gli ID dei post.
Il rilevamento avviene solo al click sul link? Potremmo rilevarlo quando il post viene generato e applicare una classe a eventuali link malformati?
Se è una questione così importante per la tua comunità, perché gli amministratori non ne stanno discutendo qui? Sono loro che dovranno alla fine applicare eventuali correzioni.
È interessante notare che la gestione lato server funziona. Esiste una rotta specifica per /t/:topic_id/:post_number.
La corrispondenza avviene solo quando topic_id e post_number sono numerici. In tal caso, viene cercato lo slug corretto del topic e viene effettuato un reindirizzamento.
Dato che è supportato lato server, penso che dovremmo implementare anche il supporto lato client. Non ha senso mostrare una pagina di errore quando possiamo eseguire una ricerca AJAX dello slug corretto e visualizzarlo. Detto questo, sconsiglio di utilizzare quei link, perché quella ricerca aggiuntiva comporta una richiesta web in più per un motivo in gran parte inutile.
L’ho notato per caso, quindi l’ho segnalato. È una comunità molto lasciata libera, quindi cerco di coinvolgere gli amministratori solo quando è davvero necessario. Sono molto attivo nella comunità, in particolare nel sottogruppo che sarebbe più colpito da questo cambiamento.
Hacky, non intenzionale o comunque sia, penso che questo bug debba essere risolto. Ora che è stato scoperto, i troll potrebbero creare intenzionalmente questi link. Ricorda che non si tratta solo del fatto che il topic non viene caricato: rompe l’intero sito.