New-message composer URL reuses recipients from draft

We are using the tips from Email notification footer with links for Reply Privately, Sender Profile, and User Profile 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 Likes

Any tips here @techAPJ?

1 Like

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

1 Like