FIX: clicking a group mention on mobile was 404ing
(cc @featheredtoast)
This commit is contained in:
parent
6b1ff0edd3
commit
deaf3682e9
|
@ -1,7 +1,6 @@
|
||||||
import { wantsNewWindow } from 'discourse/lib/intercept-click';
|
import { wantsNewWindow } from 'discourse/lib/intercept-click';
|
||||||
import afterTransition from 'discourse/lib/after-transition';
|
import afterTransition from 'discourse/lib/after-transition';
|
||||||
import DiscourseURL from 'discourse/lib/url';
|
import DiscourseURL from 'discourse/lib/url';
|
||||||
import { userPath } from 'discourse/lib/url';
|
|
||||||
|
|
||||||
export default Ember.Mixin.create({
|
export default Ember.Mixin.create({
|
||||||
elementId: null, //click detection added for data-{elementId}
|
elementId: null, //click detection added for data-{elementId}
|
||||||
|
@ -28,7 +27,7 @@ export default Ember.Mixin.create({
|
||||||
|
|
||||||
// Don't show on mobile
|
// Don't show on mobile
|
||||||
if (this.site.mobileView) {
|
if (this.site.mobileView) {
|
||||||
DiscourseURL.routeTo(userPath(username));
|
DiscourseURL.routeTo($target.attr("href"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,10 +37,10 @@ export default Ember.Mixin.create({
|
||||||
}
|
}
|
||||||
|
|
||||||
const postId = $target.parents('article').data('post-id');
|
const postId = $target.parents('article').data('post-id');
|
||||||
|
|
||||||
const wasVisible = this.get('visible');
|
const wasVisible = this.get('visible');
|
||||||
const previousTarget = this.get('cardTarget');
|
const previousTarget = this.get('cardTarget');
|
||||||
const target = $target[0];
|
const target = $target[0];
|
||||||
|
|
||||||
if (wasVisible) {
|
if (wasVisible) {
|
||||||
this._close();
|
this._close();
|
||||||
if (target === previousTarget) { return; }
|
if (target === previousTarget) { return; }
|
||||||
|
|
|
@ -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');
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
|
@ -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');
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
|
@ -1,7 +1,8 @@
|
||||||
import { acceptance } from "helpers/qunit-helpers";
|
import { acceptance } from "helpers/qunit-helpers";
|
||||||
|
|
||||||
acceptance("User Card");
|
acceptance("User Card");
|
||||||
|
|
||||||
QUnit.test("card", assert => {
|
QUnit.test("user card", assert => {
|
||||||
visit('/');
|
visit('/');
|
||||||
|
|
||||||
assert.ok(invisible('#user-card'), 'user card is invisible by default');
|
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');
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
Loading…
Reference in New Issue