1
0
mirror of https://github.com/flarum/core.git synced 2025-07-12 20:36:28 +02:00

Make discussion slug URL parameter optional

This commit is contained in:
Toby Zerner
2015-08-25 19:32:41 +09:30
parent b49b3a14b4
commit b8fc0bc376
4 changed files with 10 additions and 14 deletions

View File

@ -62,7 +62,9 @@ export default class DiscussionPage extends mixin(Component, evented) {
// cancel the unloading of this controller and instead prompt the post
// stream to jump to the new 'near' param.
if (this.discussion) {
if (m.route.param('id') === this.discussion.id()) {
const idParam = m.route.param('id');
if (idParam && idParam.split('-')[0] === this.discussion.id()) {
e.preventDefault();
const near = Number(m.route.param('near')) || 1;
@ -143,7 +145,7 @@ export default class DiscussionPage extends mixin(Component, evented) {
} else {
const params = this.requestParams();
app.store.find('discussions', m.route.param('id'), params)
app.store.find('discussions', m.route.param('id').split('-')[0], params)
.then(this.init.bind(this));
}