Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No slug? Then no '-' separator! #1351

Merged
merged 3 commits into from
Feb 8, 2018
Merged

No slug? Then no '-' separator! #1351

merged 3 commits into from
Feb 8, 2018

Conversation

johannsa
Copy link
Contributor

If there is no slug for the discussion then the '-' separator between the discussion id and the discussion slug is redundant and should not be used.

This would allow to have numeric only permalinks for discussions if slugs are empty.

If there is no slug for the discussion then the '-' separator is redundant and should not be used.
@dsevillamartin
Copy link
Member

dsevillamartin commented Jan 29, 2018

Looks like the dist files haven't been compiled. Only these JS files have been. Not sure what happened in that commit history lol.

image

EDIT: ignore me

@johannsa
Copy link
Contributor Author

I was not sure wether if it would be acceptable (or not) to push compiled files so I did not push them to this repository but if this is a requirement then just let me know... and I will do it!

(Please, note that there is also 2 .php files committed)

Copy link
Contributor

@tobyzerner tobyzerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from this one change, this looks good to me! No need to include compiled JS. Thanks @johannsa :)

@@ -35,7 +35,7 @@ export default function(app) {
*/
app.route.discussion = (discussion, near) => {
return app.route(near && near !== 1 ? 'discussion.near' : 'discussion', {
id: discussion.id() + '-' + discussion.slug(),
id: discussion.id() + (discussion.slug().trim() ? '-' + discussion.slug() : ''),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please extract discussion.slug() as a variable before the return statement (ie. const slug = discussion.slug())

@johannsa
Copy link
Contributor Author

johannsa commented Jan 30, 2018 via email

@tobyzerner
Copy link
Contributor

Please do not commit the compiled JS files, we will take care of that on our end :)

Copy link
Contributor

@franzliedke franzliedke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes as requested by @tobscure have been made, thanks!

General question, though: should we maybe move this calculation onto a further attribute computed in the Discussion model on the server-side? Then we don't need to re-create the logic twice.

@tobyzerner
Copy link
Contributor

@franz Good thinking. Outside of the scope of this PR so I've created a new issue. #1360

@tobyzerner tobyzerner merged commit 7721288 into flarum:master Feb 8, 2018
johannsa added a commit to johannsa/flarum-core that referenced this pull request Feb 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants