FIX: remove mystery "d" from edits

FIX: remove mystery “d” from edits

diff --git a/app/models/shared_edit_revision.rb b/app/models/shared_edit_revision.rb
index 33b1805..adb4da8 100644
--- a/app/models/shared_edit_revision.rb
+++ b/app/models/shared_edit_revision.rb
@@ -107,7 +107,17 @@ class SharedEditRevision < ActiveRecord::Base
           .where(post: post).limit(1).order('number desc').first
 
         reason = last_post_revision.modifications["edit_reason"] || ""
-        usernames = reason[1]&.split(",")&.map(&:strip) || []
+
+        if Array === reason
+          reason = reason[1]
+        end
+
+        usernames = reason&.split(",")&.map(&:strip) || []
+
+        if usernames.length > 0
+          reason_length = I18n.t("shared_edits.reason", users: "").length
+          usernames[0] = usernames[0][reason_length..-1]
+        end
 
         User.where(id: editors).pluck(:username).each do |name|
           usernames << name
diff --git a/spec/models/shared_edit_revision_spec.rb b/spec/models/shared_edit_revision_spec.rb
index 64c2b26..ef24f01 100644
--- a/spec/models/shared_edit_revision_spec.rb
+++ b/spec/models/shared_edit_revision_spec.rb
@@ -85,6 +85,7 @@ describe SharedEditRevision do
     reason = rev.modifications["edit_reason"].to_s
     expect(reason).to include(user1.username)
     expect(reason).to include(user2.username)
+    expect(reason).not_to include("d,")
 
     edit_rev = SharedEditRevision.where(post_id: post.id).order('version desc').first
 

GitHub sha: 0398ca5e