Ein Antwortfenster per URL öffnen

Hi All,

I know that we can create a new topic via url with special param.
But I want my users to click a link to reply a specific topic. Is there a way to add special params in the url query to auto open reply window for my users? If not, is there a way I can do this?

5 „Gefällt mir“

Yes, @techapj added this a while ago, details are here:

1 „Gefällt mir“

Hi Jeff,

Thank you for your reply, but what I want is that I want my users to reply
a topic which has already been created by others.
eg. I have a topic A in my forum, and I want every user click this link to
reply under topic A, not to create another topic.

What I want is when I open this link, the reply window popup, I want this
action equals to click the “reply” button under a topic.

1 „Gefällt mir“

It has been a while and I haven’t found a way to do it.
I just want to be able to create a link that when clicked opens a specific topic with the reply box activated and with the focus on it.

Something like:
https://meta.discourse.org/t/how-to-open-reply-window-via-url/#reply

Anyone knows how can it be achieved?
Thanks,

2 „Gefällt mir“

What I posted above works, but remember you don’t need to be on a specific topic to reply to it.

If your requirement is “must navigate to topic page, and then open the composer to reply”, then we don’t have that… but again it’s not required, you can reply to any topic from any other topic (or any location in the Discourse app, in fact) in the composer.

That post only mentions new-topic, where is the handy url to post a reply?

I believe there is one, cc @techAPJ

I’m aiming to use that link outside of Discourse. For example, putting a link on my blog, and when clicked it opens a new tab and starts a reply on a particular topic of the forum.

Is there a way to do it?

Thanks for your help.

Yes, the answer above works as you describe. Perhaps @techapj can help me explain because I seem to be failing at explaining this at the moment.

2 „Gefällt mir“

The feature we have right now only supports creating new topic via URL.

What @magoz wants is to have a URL for an existing topic that will open composer and user can start replying on that topic as soon as they visit that URL. This is currently not available and is not on my list right now.

Should we add support for this feature?

8 „Gefällt mir“

Not sure about it seems very uncommon

3 „Gefällt mir“

My bad @magoz I was indeed misunderstanding. I could have sworn we had a pre-filled reply URL though.

3 „Gefällt mir“

Apologies for my late reply.

Opening the composer (in a blank state) from an URL would be useful for those who have external websites working with Discourse and ask their users to reply to a particular Discourse topic.

For instance, I have a private website where I teach online lessons. I ask my students to reply to specific discourse topics to introduce themselves, to post their homework, etc.

It would be nice to be able to add something like ?reply at the end of any topic’s URL, and share that link with them.

For example:

<a href="https://meta.discourse.org/t/how-to-open-reply-window-via-url/44781?reply">link</a>

It would open a new reply to that topic with the composer open.

7 „Gefällt mir“

I would love to see it, too. Including template-support for answers, so it’s not just for topics :slight_smile:

6 „Gefällt mir“

Ist das jetzt möglich?

Wir würden diese Funktion ebenfalls sehr begrüßen :folded_hands: Würde es, falls dies noch nicht möglich ist, viel zusätzlichen Aufwand erfordern?

Einige unserer Community-Mitglieder sind Thought Leader oder Fachexperten (SMEs), die YouTube-Live-Sessions veranstalten. Das ist für Q&A in Ordnung (höchstens), aber schrecklich für tiefgehende Diskussionen.

Wir möchten in der Lage sein, Benutzer direkt zu einem bestehenden Event-Thema zu leiten (wo wir das Events-Plugin verwendet haben), sodass das Antwortfenster automatisch aufspringt und sicherstellen, dass die Personen mit den Fragen in das jeweilige SME-Thema posten.

Einer unserer großen Mehrwert für viele der Personen, mit denen wir zusammenarbeiten, besteht darin, dass wir ihnen einen Ort bieten, an dem sie in tiefgehenden Diskussionen mit ihren Nutzern interagieren können.

Wenn sie eine YouTube- oder Facebook-Live-Übertragung durchführen, beginnen sie lediglich das Gespräch. Discourse ist das perfekte Werkzeug, um das Gespräch fortzusetzen.

Wenn wir den Prozess vereinfachen könnten, indem wir eine direkte URL bereitstellen, auf die Leute klicken können, und dabei das Antwortdialogfeld automatisch öffnen und mit einem vorformulierten Text vorfüllen, wäre das unglaublich hilfreich!!

2 „Gefällt mir“

Gleichermaßen. Das wäre für unsere Community super nützlich.

1 „Gefällt mir“

Ich verwende dafür in meiner Instanz eine einfache Theme-Komponente. Nachfolgend eine angepasste Version meiner Lösung – diese unterstützt neben #reply auch #upload (ein neuer Beitrag, der auf dem Desktop das Upload-Fenster öffnet) und #edit (für Wiki-OPs).

Es ist noch etwas Arbeit nötig, wie etwa die Vermeidung von setTimeout und das korrekte Management von draftSequence (ich glaube nicht, dass topic.draft_sequence richtig ist), und ich weiß nicht, was hier die beste Praxis wäre. Dennoch funktioniert es für mich einwandfrei.

Das Navigieren zu einem beliebigen Thema wie /t/[slug]/[id]#reply öffnet den Editor mit einer neuen, leeren Antwort.

Falls Sie vorab ausgefüllten Text benötigen, ist dies durch Setzen des reply-Attributs im Objekt möglich, das an composer.open übergeben wird. Außerdem wird, falls bereits ein Entwurf für dieses Thema existiert, gefragt, ob Sie diesen speichern oder verwerfen möchten, bevor diese neue Antwort erstellt wird – draftSequence muss korrekt sein, wenn das gewünschte Verhalten das Fortsetzen dieses Entwurfs ist.

<script type="text/discourse-plugin" version="0.4">
  if (/.*#reply$/g.test(document.URL)) {
    const { REPLY } = require('discourse/models/composer').default;
    
    const composer = Discourse.__container__.lookup('controller:composer');
    
    setTimeout(function() {
      const topic = Discourse.__container__.lookup("controller:topic").get("model");
      if (topic) {
        composer.open({
            action: REPLY,
            draftKey: topic.draft_key,
            draftSequence: topic.draft_sequence,
            topic,
        });
      }
    }, 0)
  }
</script>

Ich hoffe, das hilft weiter.

13 „Gefällt mir“

Haben Sie dies seitdem geändert/aktualisiert? Es wäre wirklich nützlich – ich habe gerade einen Anwendungsfall dafür in meiner Instanz gefunden:

Leuten eine einfache Ein-Klick-Möglichkeit zu geben, auf ein Banner-Thema zu antworten

1 „Gefällt mir“

Die einzige Änderung, an die ich mich erinnere, war die Erzwingung des Anmeldevorgangs, wenn der Benutzer nicht bereits angemeldet ist, so etwas wie:

        if (!Discourse.User.current()) {
            Discourse.__container__.lookup("route:application").send("showLogin");
        }

Ich benutze es immer noch in meiner Community, um Benutzer von meiner React-App direkt zu einigen dieser Abläufe in Discourse zu leiten (Antworten, Bearbeiten, Hochladen usw.).

2 „Gefällt mir“