FIX: Do not show nested user cards. ()

This commit is contained in:
Bianca Nenciu 2018-11-19 11:01:22 +02:00 committed by Régis Hanol
parent ba63cca747
commit f2c227432c
3 changed files with 11 additions and 5 deletions
app/assets/javascripts/discourse/mixins
test/javascripts

@ -25,8 +25,9 @@ export default Ember.Mixin.create({
username = Ember.Handlebars.Utils.escapeExpression(username.toString()); username = Ember.Handlebars.Utils.escapeExpression(username.toString());
// Don't show on mobile // Don't show on mobile or nested
if (this.site.mobileView) { if (this.site.mobileView || $target.parents(".card-content").length) {
this._close();
DiscourseURL.routeTo($target.attr("href")); DiscourseURL.routeTo($target.attr("href"));
return false; return false;
} }

@ -1,4 +1,5 @@
import { acceptance } from "helpers/qunit-helpers"; import { acceptance } from "helpers/qunit-helpers";
import DiscourseURL from "discourse/lib/url";
acceptance("User Card"); acceptance("User Card");
@ -8,4 +9,8 @@ QUnit.test("user card", async assert => {
await click("a[data-user-card=eviltrout]:first"); await click("a[data-user-card=eviltrout]:first");
assert.ok(visible("#user-card"), "card should appear"); assert.ok(visible("#user-card"), "card should appear");
sandbox.stub(DiscourseURL, "routeTo");
await click(".card-content a.mention");
assert.ok(DiscourseURL.routeTo.calledWith("/u/eviltrout"));
}); });

@ -124,9 +124,9 @@ export default {
last_posted_at: "2015-05-07T15:23:35.074Z", last_posted_at: "2015-05-07T15:23:35.074Z",
last_seen_at: "2015-05-13T14:34:23.188Z", last_seen_at: "2015-05-13T14:34:23.188Z",
bio_raw: bio_raw:
'Co-founder of Discourse. Previously, I created <a href="http://forumwarz.com">Forumwarz</a>. <a href="https://twitter.com/eviltrout">Follow me on Twitter</a>.', 'Co-founder of Discourse. Previously, I created <a href="http://forumwarz.com">Forumwarz</a>. <a href="https://twitter.com/eviltrout">Follow me on Twitter</a>. I am @eviltrout.',
bio_cooked: bio_cooked:
'<p>Co-founder of Discourse. Previously, I created <a href="http://forumwarz.com">Forumwarz</a>. <a href="https://twitter.com/eviltrout">Follow me on Twitter</a>.</p>', '<p>Co-founder of Discourse. Previously, I created <a href="http://forumwarz.com">Forumwarz</a>. <a href="https://twitter.com/eviltrout">Follow me on Twitter</a>. I am <a class="mention" href="/u/eviltrout">@eviltrout</a>.</p>',
created_at: "2013-02-03T15:19:22.704Z", created_at: "2013-02-03T15:19:22.704Z",
website: "http://eviltrout.com", website: "http://eviltrout.com",
location: "Toronto", location: "Toronto",
@ -150,7 +150,7 @@ export default {
can_send_private_messages: true, can_send_private_messages: true,
can_send_private_message_to_user: false, can_send_private_message_to_user: false,
bio_excerpt: bio_excerpt:
'Co-founder of Discourse. Previously, I created <a href="http://forumwarz.com">Forumwarz</a>. <a href="https://twitter.com/eviltrout">Follow me on Twitter</a>.', '<p>Co-founder of Discourse. Previously, I created <a href="http://forumwarz.com">Forumwarz</a>. <a href="https://twitter.com/eviltrout">Follow me on Twitter</a>. I am <a class="mention" href="/u/eviltrout">@eviltrout</a>.</p>',
trust_level: 4, trust_level: 4,
moderator: true, moderator: true,
admin: true, admin: true,