New-message composer URL reuses recipients from draft

AI-generated summary

flesser reports a bug where composing private messages (PMs) via URL reuses the recipient from a previously unfinished draft, even though the URL specifies a different username. While the title and body fields from the URL correctly override the draft, the username field does not — which flesser believes is the intended behavior. Steps to reproduce involve opening a PM URL to one user, closing without sending, then opening a second URL to a different user — the recipient remains the first user, despite the URL indicating the second. Expected behavior is for the new PM to reflect the username in the URL (possibly with a warning that the draft was discarded) and for missing title or body parameters to result in empty fields, not carry over from the draft. codinghorror asks for input from techAPJ, who replies that they cannot reproduce the issue on Meta, suggesting it may already be fixed.

We are using the tips from Customize email notification footer with links to reply privately and see user profiles on our installation to encourage users to reply by PM instead of publicly if only the sender is concerned.

However, sometimes the To: field of the PM is pre-filled with the wrong username, even though the one in the URL is correct.

It seems like composing PMs by URL reuses a previously unfinished PM instead of starting a clean new one. The title and body URL properties (silently) override the unfinished message’s values, but username doesn’t. (Which should be intended behaviour in my opinion).

Steps to reproduce:

  1. click on a link to compose a new PM by URL:
    https://discourse.example.com/new-message?username=user1&title=Title1&body=Body1

  2. close the compose popup without sending the PM

  3. click on another link to compose a PM to a different user:
    https://discourse.example.com/new-message?username=user2&title=Title2&body=Body2

Actual behaviour:

The compose popup opens, recipient still set to user1, but title and body updated to the “Title2” and “Body2” values from the URL.

(Also, if on the second link one of the parameters title or body is not set, the old values from the previous message appear instead of the intended empty string.)

Expected behaviour:

  • The compose popup opens with user2 as recipient. (Maybe also showing a warning that the previously unfinished message was discarded.)
  • If title or body are not set in the URL, those fields in the PM should be empty, too.
إعجابَين (2)

Any tips here @techAPJ?

إعجاب واحد (1)

I am not able to repro this here on meta. Seems like it’s fixed now.

إعجاب واحد (1)