diff --git a/Gemfile b/Gemfile index f2d2289ec..12af45dd9 100644 --- a/Gemfile +++ b/Gemfile @@ -94,9 +94,9 @@ gem "js-routes", "1.2.9" source "https://rails-assets.org" do gem "rails-assets-jquery", "2.2.4" # Should be kept in sync with jquery-rails - gem "rails-assets-markdown-it", "8.0.0" + gem "rails-assets-markdown-it", "8.2.2" gem "rails-assets-markdown-it-hashtag", "0.4.0" - gem "rails-assets-markdown-it-diaspora-mention", "1.0.0" + gem "rails-assets-markdown-it-diaspora-mention", "1.1.0" gem "rails-assets-markdown-it-sanitizer", "0.4.3" gem "rails-assets-markdown-it--markdown-it-for-inline", "0.1.1" gem "rails-assets-markdown-it-sub", "1.0.0" diff --git a/Gemfile.lock b/Gemfile.lock index 597609ce8..20de910d6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -665,8 +665,8 @@ GEM rails-assets-jquery.ui (1.11.4) rails-assets-jquery (>= 1.6) rails-assets-markdown-it--markdown-it-for-inline (0.1.1) - rails-assets-markdown-it (8.0.0) - rails-assets-markdown-it-diaspora-mention (1.0.0) + rails-assets-markdown-it (8.2.2) + rails-assets-markdown-it-diaspora-mention (1.1.0) rails-assets-markdown-it-hashtag (0.4.0) rails-assets-markdown-it-sanitizer (0.4.3) rails-assets-markdown-it-sub (1.0.0) @@ -1000,9 +1000,9 @@ DEPENDENCIES rails-assets-jquery (= 2.2.4)! rails-assets-jquery-placeholder (= 2.3.1)! rails-assets-jquery-textchange (= 0.2.3)! - rails-assets-markdown-it (= 8.0.0)! + rails-assets-markdown-it (= 8.2.2)! rails-assets-markdown-it--markdown-it-for-inline (= 0.1.1)! - rails-assets-markdown-it-diaspora-mention (= 1.0.0)! + rails-assets-markdown-it-diaspora-mention (= 1.1.0)! rails-assets-markdown-it-hashtag (= 0.4.0)! rails-assets-markdown-it-sanitizer (= 0.4.3)! rails-assets-markdown-it-sub (= 1.0.0)! diff --git a/spec/javascripts/app/helpers/text_formatter_spec.js b/spec/javascripts/app/helpers/text_formatter_spec.js index eca62cb4d..eb6f95686 100644 --- a/spec/javascripts/app/helpers/text_formatter_spec.js +++ b/spec/javascripts/app/helpers/text_formatter_spec.js @@ -86,6 +86,25 @@ describe("app.helpers.textFormatter", function(){ expect(wrapper.find("a[href='/people/" + this.alice.guid + "']")).not.toHaveClass('hovercardable'); expect(wrapper.find("a[href='/people/" + this.bob.guid + "']")).toHaveClass('hovercardable'); }); + + it("supports mentions without a given name", function() { + this.statusMessage.set({text: "hey there @{alice@example.com} and @{bob@example.com}"}); + var formattedText = this.formatter(this.statusMessage.get("text"), this.statusMessage.get("mentioned_people")); + var wrapper = $("
").html(formattedText); + + _.each([this.alice, this.bob], function(person) { + expect(wrapper.find("a[href='/people/" + person.guid + "']").text()).toContain(person.name); + }); + }); + + it("it uses the name given in the mention if it exists", function() { + this.statusMessage.set({text: "hey there @{Alice Awesome; alice@example.com} and @{bob@example.com}"}); + var formattedText = this.formatter(this.statusMessage.get("text"), this.statusMessage.get("mentioned_people")); + var wrapper = $("
").html(formattedText); + + expect(wrapper.find("a[href='/people/" + this.alice.guid + "']").text()).toContain("Alice Awesome"); + expect(wrapper.find("a[href='/people/" + this.bob.guid + "']").text()).toContain(this.bob.name); + }); }); context("highlight", function(){