FIX: Do not show nested user cards. (#6621)

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

View File

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

View File

@ -1,4 +1,5 @@
import { acceptance } from "helpers/qunit-helpers";
import DiscourseURL from "discourse/lib/url";
acceptance("User Card");
@ -8,4 +9,8 @@ QUnit.test("user card", async assert => {
await click("a[data-user-card=eviltrout]:first");
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"));
});

View File

@ -124,9 +124,9 @@ export default {
last_posted_at: "2015-05-07T15:23:35.074Z",
last_seen_at: "2015-05-13T14:34:23.188Z",
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:
'<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",
website: "http://eviltrout.com",
location: "Toronto",
@ -150,7 +150,7 @@ export default {
can_send_private_messages: true,
can_send_private_message_to_user: false,
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,
moderator: true,
admin: true,