FIX: clicking a group mention on mobile was 404ing

(cc @featheredtoast)
This commit is contained in:
Régis Hanol 2018-05-09 17:27:59 +02:00
parent 6b1ff0edd3
commit deaf3682e9
4 changed files with 34 additions and 17 deletions

View File

@ -1,7 +1,6 @@
import { wantsNewWindow } from 'discourse/lib/intercept-click';
import afterTransition from 'discourse/lib/after-transition';
import DiscourseURL from 'discourse/lib/url';
import { userPath } from 'discourse/lib/url';
export default Ember.Mixin.create({
elementId: null, //click detection added for data-{elementId}
@ -28,7 +27,7 @@ export default Ember.Mixin.create({
// Don't show on mobile
if (this.site.mobileView) {
DiscourseURL.routeTo(userPath(username));
DiscourseURL.routeTo($target.attr("href"));
return false;
}
@ -38,10 +37,10 @@ export default Ember.Mixin.create({
}
const postId = $target.parents('article').data('post-id');
const wasVisible = this.get('visible');
const previousTarget = this.get('cardTarget');
const target = $target[0];
if (wasVisible) {
this._close();
if (target === previousTarget) { return; }

View File

@ -0,0 +1,15 @@
import { acceptance } from "helpers/qunit-helpers";
acceptance("Group Card - Mobile", { mobileView: true });
QUnit.test("group card", assert => {
visit('/t/301/1');
assert.ok(invisible('#group-card'), 'user card is invisible by default');
click('a.mention-group:first');
andThen(() => {
assert.ok(visible('.group-details-container'), 'group page show be shown');
});
});

View File

@ -0,0 +1,15 @@
import { acceptance } from "helpers/qunit-helpers";
acceptance("Group Card");
QUnit.test("group card", assert => {
visit('/t/301/1');
assert.ok(invisible('#group-card'), 'user card is invisible by default');
click('a.mention-group:first');
andThen(() => {
assert.ok(visible('#group-card'), 'card should appear');
});
});

View File

@ -1,7 +1,8 @@
import { acceptance } from "helpers/qunit-helpers";
acceptance("User Card");
QUnit.test("card", assert => {
QUnit.test("user card", assert => {
visit('/');
assert.ok(invisible('#user-card'), 'user card is invisible by default');
@ -12,16 +13,3 @@ QUnit.test("card", assert => {
});
});
QUnit.test("group card", assert => {
visit('/t/301/1');
assert.ok(invisible('#group-card'), 'user card is invisible by default');
click('a.mention-group:first');
andThen(() => {
assert.ok(visible('#group-card'), 'card should appear');
});
});