Support `/group/xyz` paths as well as `/groups/xyz`
This commit is contained in:
parent
366d7e892c
commit
216f718607
|
@ -129,7 +129,6 @@ Discourse.URL = Em.Object.createWithMixins({
|
||||||
path = path.replace(rootURL, '');
|
path = path.replace(rootURL, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Rewrite /my/* urls
|
// Rewrite /my/* urls
|
||||||
if (path.indexOf('/my/') === 0) {
|
if (path.indexOf('/my/') === 0) {
|
||||||
var currentUser = Discourse.User.current();
|
var currentUser = Discourse.User.current();
|
||||||
|
@ -141,6 +140,11 @@ Discourse.URL = Em.Object.createWithMixins({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rewrite /groups paths
|
||||||
|
if (path.indexOf('/group/') === 0) {
|
||||||
|
path = path.replace('group/', 'groups/');
|
||||||
|
}
|
||||||
|
|
||||||
if (this.navigatedToPost(oldPath, path)) { return; }
|
if (this.navigatedToPost(oldPath, path)) { return; }
|
||||||
// Schedule a DOM cleanup event
|
// Schedule a DOM cleanup event
|
||||||
Em.run.scheduleOnce('afterRender', Discourse.Route, 'cleanDOM');
|
Em.run.scheduleOnce('afterRender', Discourse.Route, 'cleanDOM');
|
||||||
|
|
|
@ -41,9 +41,11 @@ export default function(filter, extras) {
|
||||||
|
|
||||||
setupController: function(controller, model, trans) {
|
setupController: function(controller, model, trans) {
|
||||||
|
|
||||||
|
if (trans) {
|
||||||
controller.setProperties(Em.getProperties(trans, _.keys(queryParams).map(function(v){
|
controller.setProperties(Em.getProperties(trans, _.keys(queryParams).map(function(v){
|
||||||
return 'queryParams.' + v;
|
return 'queryParams.' + v;
|
||||||
})));
|
})));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var periods = this.controllerFor('discovery').get('periods'),
|
var periods = this.controllerFor('discovery').get('periods'),
|
||||||
|
|
|
@ -269,6 +269,10 @@ Discourse::Application.routes.draw do
|
||||||
get 'counts'
|
get 'counts'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# In case people try the wrong URL
|
||||||
|
get '/group/:id', to: redirect('/groups/%{id}')
|
||||||
|
get '/group/:id/members', to: redirect('/groups/%{id}/members')
|
||||||
|
|
||||||
resources :posts do
|
resources :posts do
|
||||||
put "bookmark"
|
put "bookmark"
|
||||||
put "wiki"
|
put "wiki"
|
||||||
|
|
Loading…
Reference in New Issue