Adding a link in the message invitations

When users are invited to a message, it sends them an email with the user_notifications.invited_to_private_message_body template:

%{username} invited you to a message

> **%{topic_title}**
>
> %{topic_excerpt}

at

> %{site_title} -- %{site_description}

Is there a way to add a link to the message in the template? I tried %{base_url}%{url}, but it seems to be invalid for that template.

Users are getting confused, since there is nothing to click. If it isn’t possible to link to the message, I can just send them to the /my/messages path, which seems to redirect them to their messages list.

3 Likes

Do you try to insert the direct link as https://meta.discourse.org or user html

<a href="https://meta.discourse.org">https://meta.discourse.org</a>
1 Like

Currently, I’ve overridden the template to send users to forum.example.com/my/messages, but that’s just the list of all messages. I’m hoping to send them directly to the specific message that they have been invited to.

It seems odd that we don’t include a link in this email @techAPJ? Can you repro?

2 Likes

Yes, this seems like a recent regression from email HTML customization feature. We used to include “Visit Message” link in email footer, not anymore. Will fix on priority.

2 Likes

PR here:

https://github.com/discourse/discourse/pull/8194

Will merge once the PR is reviewed by @neil.

Note that this change is specific to inviting existing users. Inviting new user via email already includes topic/message link per template.

4 Likes

Instead of adding a new .html.erb template file I updated the existing user’s invite template to include topic/PM link (similar to what we do for new user invite link) in topic title and at the bottom of email. This also allows staff to use and repurpose topic_link as they see fit while customizing invite email template.

https://github.com/discourse/discourse/commit/600233482f3bf499e7655a1596908eee32f8cbbb

Topic:

PM:

4 Likes

Thanks, that looks great.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.