mirror of
https://github.com/flarum/framework.git
synced 2025-01-06 02:23:36 +08:00
Fix unnecessary ?near=1 in some URLs
This commit is contained in:
parent
f9c5d0f2d7
commit
7e37cf5568
|
@ -65,8 +65,10 @@ export default class DiscussionPage extends mixin(Component, evented) {
|
||||||
if (m.route.param('id') === this.discussion.id()) {
|
if (m.route.param('id') === this.discussion.id()) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (Number(m.route.param('near')) !== Number(this.near)) {
|
const near = Number(m.route.param('near')) || 1;
|
||||||
this.stream.goToNumber(m.route.param('near') || 1);
|
|
||||||
|
if (near !== Number(this.near)) {
|
||||||
|
this.stream.goToNumber(near);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.near = null;
|
this.near = null;
|
||||||
|
|
|
@ -35,10 +35,10 @@ export default function(app) {
|
||||||
* @return {String}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
app.route.discussion = (discussion, near) => {
|
app.route.discussion = (discussion, near) => {
|
||||||
return app.route(near ? 'discussion.near' : 'discussion', {
|
return app.route(near > 1 ? 'discussion.near' : 'discussion', {
|
||||||
id: discussion.id(),
|
id: discussion.id(),
|
||||||
slug: discussion.slug(),
|
slug: discussion.slug(),
|
||||||
near: near
|
near: near > 1 ? near : undefined
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user