# Bulk Invite from File resets the Invite Forum Mailer customized text

**URL:** https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606
**Category:** Support
**Created:** [7 Agosto, 2017 17:25 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606 "2017-08-07T17:25:46Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Nicholas\_Tolstoshev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nicholas_tolstoshev/32/62714_2.png) [@Nicholas\_Tolstoshev](https://meta.discourse.org/u/Nicholas_Tolstoshev)
#### Post date: [7 Agosto, 2017 17:25 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/1 "2017-08-07T17:25:47Z")

</div>

This started happening after I upgraded to v1.9.0.beta5 +30.

When I do a bulk invite from file, I change the Invite Forum Mailer text to be specific for that set of invitations. Then I change it back to a different text for single manual invites. This worked fine until I upgraded to the latest version.

Now what happens is that I change the Invite Forum Mailer and save it, and it looks like it saves ok. But when I actually send an invite it uses the old text, although when I look at the Invite Forum Mailer setting again, it appears to have the new text in it. If I do a bulk invite from file, then it sends out the old text and it resets the text in the Invite Forum Mailer custom text window to the previous version.

Anyone else have this issue or able to reproduce it?

---

<div class="post-metadata">

### Author: ![Nicholas\_Tolstoshev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nicholas_tolstoshev/32/62714_2.png) [@Nicholas\_Tolstoshev](https://meta.discourse.org/u/Nicholas_Tolstoshev)
#### Post date: [8 Agosto, 2017 17:31 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/2 "2017-08-08T17:31:57Z")

</div>

I’ve also reproduced the issue on our test site, so it doesn’t appear to be something specific to our particular installation.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [10 Agosto, 2017 22:32 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/3 "2017-08-10T22:32:19Z")

</div>

@techAPJ maybe have a 👀

---

<div class="post-metadata">

### Author: ![Nicholas\_Tolstoshev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nicholas_tolstoshev/32/62714_2.png) [@Nicholas\_Tolstoshev](https://meta.discourse.org/u/Nicholas_Tolstoshev)
#### Post date: [10 Agosto, 2017 23:28 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/4 "2017-08-10T23:28:12Z")

</div>

Thanks for taking a look at it!

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [11 Agosto, 2017 05:37 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/5 "2017-08-11T05:37:27Z")

</div>

I am unable to repro this on latest Discourse version.

@Nicholas_Tolstoshev are you seeing any error in `/logs`?

---

<div class="post-metadata">

### Author: ![Nicholas\_Tolstoshev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nicholas_tolstoshev/32/62714_2.png) [@Nicholas\_Tolstoshev](https://meta.discourse.org/u/Nicholas_Tolstoshev)
#### Post date: [11 Agosto, 2017 15:44 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/6 "2017-08-11T15:44:16Z")

</div>

Thanks for checking! I’ll look at the logs and do some more troubleshooting on my end to see if I can figure out what the problem is.

---

<div class="post-metadata">

### Author: ![Nicholas\_Tolstoshev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nicholas_tolstoshev/32/62714_2.png) [@Nicholas\_Tolstoshev](https://meta.discourse.org/u/Nicholas_Tolstoshev)
#### Post date: [11 Agosto, 2017 18:40 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/7 "2017-08-11T18:40:36Z")

</div>

Ok I think I’m making some progress with this. I removed all custom themes and plugins from my test install and the issue is still happening.

What I’ve found is that if you don’t include the variables %{invitee\_name} and %{site\_domain\_name} in the Invite Forum Mailer subject line, then the template will not save properly and will revert to what it was before. If I go to the Text Context tab under Customize, and try to save a change to invite\_forum\_mailer.subject\_template that doesn’t include both of those variables, I get the following error message:  
The following interpolation key(s) are missing: “invitee\_name, site\_domain\_name”

So what appears to be happening is that trying to save the Invite Forum Mailer template does a behind the scenes check to make sure those variables are in the subject line and if they aren’t there, the change does not save even though no error message is given.

Steps to reproduce:

1. Go to Settings-\>Customize-\>Email Templates
2. Select Invite Forum Mailer
3. Change the Subject to something that doesn’t include the necessary variables. For example just put in “test”
4. Save Changes
5. Exit the customization screen
6. Go back to Settings-\>Customize-\>Email Templates
7. Select Invite Forum Mailer
8. Note that the Subject changes back to the default of “%{invitee\_name} invited you to join %{site\_domain\_name}”
9. If you attempt the above steps and make changes to the Subject that keep two required variables, the change will save properly. For example, change the Subject to “%{invitee\_name} test %{site\_domain\_name}” and that change will save properly because the two variables are still in the Subject line.

Can you please try out the above procedure and let me know if you are able to reproduce it @techAPJ?

---

<div class="post-metadata">

### Author: ![Nicholas\_Tolstoshev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nicholas_tolstoshev/32/62714_2.png) [@Nicholas\_Tolstoshev](https://meta.discourse.org/u/Nicholas_Tolstoshev)
#### Post date: [11 Agosto, 2017 20:04 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/9 "2017-08-11T20:04:40Z")

</div>

Also note that this behavior is new to this version. On previous versions of Discourse I was able to save any subject line without it requiring the variables in question.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [11 Agosto, 2017 22:57 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/10 "2017-08-11T22:57:02Z")

</div>

That is because we validate the field to make sure it has all the required translations / substitutions, which @tgxworld worked on.

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [11 Agosto, 2017 23:27 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/11 "2017-08-11T23:27:48Z")

</div>

Validation is good, of course, but wouldn’t a warning / error message be appropriate?

> [@Nicholas\_Tolstoshev](#):
>
> the change does not save even though no error message is given.

---

<div class="post-metadata">

### Author: ![Nicholas\_Tolstoshev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nicholas_tolstoshev/32/62714_2.png) [@Nicholas\_Tolstoshev](https://meta.discourse.org/u/Nicholas_Tolstoshev)
#### Post date: [11 Agosto, 2017 23:52 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/12 "2017-08-11T23:52:43Z")

</div>

> [@codinghorror](#):
>
> That is because we validate the field to make sure it has all the required translations / substitutions, which @tgxworld worked on.

Is the validation new for this version?

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [13 Agosto, 2017 23:41 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/13 "2017-08-13T23:41:43Z")

</div>

It does seem like the code path isn’t checking if the translation was saved successfully at all for email template customizations.

---

<div class="post-metadata">

### Author: ![Nicholas\_Tolstoshev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nicholas_tolstoshev/32/62714_2.png) [@Nicholas\_Tolstoshev](https://meta.discourse.org/u/Nicholas_Tolstoshev)
#### Post date: [15 Agosto, 2017 15:40 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/14 "2017-08-15T15:40:44Z")

</div>

So I’m left with a few questions on this one?

a) Is this expected behavior (and if so can we get an error message)?  
b) Why did this start happening on the latest version when it wasn’t before? Is this indeed a new feature? Or was it an old feature that wasn’t working properly and got fixed?  
c) Can this be an optional check or a warning, as I’d like to be able to customize the text of the invite fully rather than being constrained to include those variables?

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [17 Agosto, 2017 07:34 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/16 "2017-08-17T07:34:28Z")

</div>

> [@Nicholas\_Tolstoshev](#):
>
> Is this expected behavior (and if so can we get an error message)?

Agreed, I’m adding it to my list.

> [@Nicholas\_Tolstoshev](#):
>
> c) Can this be an optional check or a warning, as I’d like to be able to customize the text of the invite fully rather than being constrained to include those variables?

I’ll see if I can make the validation smarter here

---

<div class="post-metadata">

### Author: ![Nicholas\_Tolstoshev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nicholas_tolstoshev/32/62714_2.png) [@Nicholas\_Tolstoshev](https://meta.discourse.org/u/Nicholas_Tolstoshev)
#### Post date: [17 Agosto, 2017 15:51 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/17 "2017-08-17T15:51:08Z")

</div>

Thank you for looking at this!

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [20 Noviembre, 2017 12:44 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/18 "2017-11-20T12:44:25Z")

</div>

I have a PR up for this in

[https://github.com/discourse/discourse/pull/5328](https://github.com/discourse/discourse/pull/5328)

that re-enables the invalid interpolation keys check while reverting to the previous behavior where interpolation keys can be left out in customizations.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [30 Noviembre, 2017 05:10 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/25 "2017-11-30T05:10:21Z")

</div>

Merged

[https://github.com/discourse/discourse/commit/1c2d1682ae29c36190c959b827d07e162acccffe](https://github.com/discourse/discourse/commit/1c2d1682ae29c36190c959b827d07e162acccffe)

The current and correct behavior now is that:

1. Interpolation keys are allowed to be left out.
2. Invalid interpolations keys are not allowed.
3. Custom interpolation keys that we secretly allow are [whitelisted](https://github.com/discourse/discourse/blob/1c2d1682ae29c36190c959b827d07e162acccffe/app/models/translation_override.rb#L5-L12) in a constant. The whitelist isn’t the best solution I’ve got but I think the invalid interpolation keys is more important to have as it protects users from creating an invalid translation override.

---

<div class="post-metadata">

### Author: ![Nicholas\_Tolstoshev](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nicholas_tolstoshev/32/62714_2.png) [@Nicholas\_Tolstoshev](https://meta.discourse.org/u/Nicholas_Tolstoshev)
#### Post date: [30 Noviembre, 2017 16:13 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/26 "2017-11-30T16:13:04Z")

</div>

Thanks for taking care of this one!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [12 Abril, 2023 15:21 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/30 "2023-04-12T15:21:50Z")

</div>



---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [12 Abril, 2023 15:43 UTC](https://meta.discourse.org/t/bulk-invite-from-file-resets-the-invite-forum-mailer-customized-text/67606/31 "2023-04-12T15:43:58Z")

</div>


