FIX: System message wasn't fully translatable

FIX: System message wasn’t fully translatable

diff --git a/app/models/group.rb b/app/models/group.rb
index 358b089..e70eab6 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -841,10 +841,9 @@ class Group < ActiveRecord::Base
   def notify_added_to_group(user, owner: false)
     SystemMessage.create_from_system_user(
       user,
-      :user_added_to_group,
+      owner ? :user_added_to_group_as_owner : :user_added_to_group_as_member,
       group_name: self.full_name.presence || self.name,
-      group_path: "/g/#{self.name}",
-      membership_level: owner ? "an owner" : "a member"
+      group_path: "/g/#{self.name}"
     )
   end
 
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 4189c05..7343148 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -2909,11 +2909,17 @@ en:
         `‍`` text
         %{logs}
         `‍``
-    user_added_to_group:
-      title: "Added to Group"
-      subject_template: "You have been added as %{membership_level} of the %{group_name} group"
+    user_added_to_group_as_owner:
+      title: "Added to Group as Owner"
+      subject_template: "You have been added as an owner of the %{group_name} group"
       text_body_template: |
-        You have been added as a %{membership_level} of the [%{group_name}](%{base_url}%{group_path}) group.
+        You have been added as an owner of the [%{group_name}](%{base_url}%{group_path}) group.
+
+    user_added_to_group_as_member:
+      title: "Added to Group as Member"
+      subject_template: "You have been added as a member of the %{group_name} group"
+      text_body_template: |
+        You have been added as a member of the [%{group_name}](%{base_url}%{group_path}) group.
 
     csv_export_succeeded:
       title: "CSV Export Succeeded"
diff --git a/spec/requests/admin/groups_controller_spec.rb b/spec/requests/admin/groups_controller_spec.rb
index d51f3e7..f0d9320 100644
--- a/spec/requests/admin/groups_controller_spec.rb
+++ b/spec/requests/admin/groups_controller_spec.rb
@@ -131,7 +131,10 @@ RSpec.describe Admin::GroupsController do
       }
       expect(response.status).to eq(200)
 
-      topic = Topic.find_by(title: "You have been added as an owner of the #{group.name} group", archetype: "private_message")
+      topic = Topic.find_by(
+        title: I18n.t("system_messages.user_added_to_group_as_owner.subject_template", group_name: group.name),
+        archetype: "private_message"
+      )
       expect(topic.nil?).to eq(true)
     end
 
@@ -144,7 +147,10 @@ RSpec.describe Admin::GroupsController do
       }
       expect(response.status).to eq(200)
 
-      topic = Topic.find_by(title: "You have been added as an owner of the #{group.name} group", archetype: "private_message")
+      topic = Topic.find_by(
+        title: I18n.t("system_messages.user_added_to_group_as_owner.subject_template", group_name: group.name),
+        archetype: "private_message"
+      )
       expect(topic.nil?).to eq(false)
       expect(topic.topic_users.map(&:user_id)).to include(-1, user.id)
     end

GitHub sha: 31c1d572

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/how-to-set-localized-membership-level-text-in-discourse/162703/5