mirror of
https://github.com/flarum/framework.git
synced 2024-12-13 07:03:35 +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()) {
|
||||
e.preventDefault();
|
||||
|
||||
if (Number(m.route.param('near')) !== Number(this.near)) {
|
||||
this.stream.goToNumber(m.route.param('near') || 1);
|
||||
const near = Number(m.route.param('near')) || 1;
|
||||
|
||||
if (near !== Number(this.near)) {
|
||||
this.stream.goToNumber(near);
|
||||
}
|
||||
|
||||
this.near = null;
|
||||
|
|
|
@ -35,10 +35,10 @@ export default function(app) {
|
|||
* @return {String}
|
||||
*/
|
||||
app.route.discussion = (discussion, near) => {
|
||||
return app.route(near ? 'discussion.near' : 'discussion', {
|
||||
return app.route(near > 1 ? 'discussion.near' : 'discussion', {
|
||||
id: discussion.id(),
|
||||
slug: discussion.slug(),
|
||||
near: near
|
||||
near: near > 1 ? near : undefined
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user