Skip to content
Extraits de code Groupes Projets
Valider ac75b476 rédigé par Jonne Haß's avatar Jonne Haß
Parcourir les fichiers

Merge pull request #5652 from svbergerem/add-hovercards-to-mentions

Add hovercards for mentions
parents 1c202db3 7112cb11
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -89,9 +89,9 @@ gem 'rails-assets-jquery', '1.11.1' # Should be kep
gem 'js_image_paths', '0.0.1'
gem 'js-routes', '0.9.9'
gem 'rails-assets-punycode', '1.3.2'
gem 'rails-assets-markdown-it', '3.0.3'
gem 'rails-assets-markdown-it', '3.0.5'
gem 'rails-assets-markdown-it-hashtag', '0.2.3'
gem 'rails-assets-markdown-it-diaspora-mention', '0.1.2'
gem 'rails-assets-markdown-it-diaspora-mention', '0.2.0'
gem 'rails-assets-markdown-it-sanitizer', '0.2.0'
gem 'rails-assets-markdown-it--markdown-it-for-inline', '0.1.0'
gem 'rails-assets-markdown-it-sub', '0.1.0'
......
......@@ -444,8 +444,8 @@ GEM
rails-assets-jquery.slimscroll (1.3.3)
rails-assets-jquery (>= 1.7)
rails-assets-markdown-it--markdown-it-for-inline (0.1.0)
rails-assets-markdown-it (3.0.3)
rails-assets-markdown-it-diaspora-mention (0.1.2)
rails-assets-markdown-it (3.0.5)
rails-assets-markdown-it-diaspora-mention (0.2.0)
rails-assets-markdown-it-hashtag (0.2.3)
rails-assets-markdown-it-sanitizer (0.2.0)
rails-assets-markdown-it-sub (0.1.0)
......@@ -698,9 +698,9 @@ DEPENDENCIES
rails-assets-jquery-idletimer (= 1.0.1)
rails-assets-jquery-placeholder (= 2.0.8)
rails-assets-jquery-textchange (= 0.2.3)
rails-assets-markdown-it (= 3.0.3)
rails-assets-markdown-it (= 3.0.5)
rails-assets-markdown-it--markdown-it-for-inline (= 0.1.0)
rails-assets-markdown-it-diaspora-mention (= 0.1.2)
rails-assets-markdown-it-diaspora-mention (= 0.2.0)
rails-assets-markdown-it-hashtag (= 0.2.3)
rails-assets-markdown-it-sanitizer (= 0.2.0)
rails-assets-markdown-it-sub (= 0.1.0)
......
......@@ -59,7 +59,11 @@
});
var mentionPlugin = window.markdownitDiasporaMention;
md.use(mentionPlugin, mentions);
md.use(mentionPlugin, {
mentions: mentions,
allowHovercards: true,
currentUserId: app.currentUser.get('guid')
});
var subPlugin = window.markdownitSub;
md.use(subPlugin);
......
......@@ -33,12 +33,14 @@ describe("app.helpers.textFormatter", function(){
this.alice = factory.author({
name : "Alice Smith",
diaspora_id : "alice@example.com",
guid: "555",
id : "555"
});
this.bob = factory.author({
name : "Bob Grimm",
diaspora_id : "bob@example.com",
guid: "666",
id : "666"
});
......@@ -70,12 +72,20 @@ describe("app.helpers.textFormatter", function(){
expect(wrapper.find("a[href='googlebot.com']").text()).toContain(freshBob.name);
});
it('returns the name of the mention if the mention does not exist in the array', function(){
it("returns the name of the mention if the mention does not exist in the array", function(){
var text = "hey there @{Chris Smith; chris@example.com}";
var formattedText = this.formatter(text, []);
expect(formattedText.match(/<a/)).toBeNull();
expect(formattedText).toContain('Chris Smith');
});
it("makes mentions hovercardable unless the current user has been mentioned", function() {
app.currentUser.get = jasmine.createSpy().and.returnValue(this.alice.guid);
var formattedText = this.formatter(this.statusMessage.get("text"), this.statusMessage.get("mentioned_people"));
var wrapper = $("<div>").html(formattedText);
expect(wrapper.find("a[href='/people/" + this.alice.guid + "']")).not.toHaveClass('hovercardable');
expect(wrapper.find("a[href='/people/" + this.bob.guid + "']")).toHaveClass('hovercardable');
});
});
context("markdown", function(){
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter