Skip to content
Permalink
Browse files

FIX: Group pages should work when group name contains periods.

  • Loading branch information
Guo Xiang Tan
Guo Xiang Tan committed Apr 12, 2018
1 parent deab048 commit a389baeb0766a1fb0b363999db519e24cece0e7a
@@ -0,0 +1,7 @@
import RestAdapter from 'discourse/adapters/rest';

export default RestAdapter.extend({
appendQueryParams(path, findArgs) {
return this._super(path, findArgs, '.json');
},
});
@@ -40,19 +40,19 @@ export default Ember.Object.extend({
return "/";
},

appendQueryParams(path, findArgs) {
appendQueryParams(path, findArgs, extension) {
if (findArgs) {
if (typeof findArgs === "object") {
const queryString = Object.keys(findArgs)
.reject(k => !findArgs[k])
.map(k => k + "=" + encodeURIComponent(findArgs[k]));

if (queryString.length) {
return path + "?" + queryString.join('&');
return `${path}${extension ? extension : ''}?${queryString.join('&')}`;
}
} else {
// It's serializable as a string if not an object
return path + "/" + findArgs;
return `${path}/${findArgs}${extension ? extension : ''}`;
}
}
return path;
@@ -626,7 +626,7 @@
get "private-messages-archive/:username" => "list#private_messages_archive", as: "topics_private_messages_archive"
get "private-messages-unread/:username" => "list#private_messages_unread", as: "topics_private_messages_unread"
get "private-messages-tags/:username/:tag_id.json" => "list#private_messages_tag", as: "topics_private_messages_tag", constraints: StaffConstraint.new
get "groups/:group_name.json" => "list#group_topics", as: "group_topics"
get "groups/:group_name" => "list#group_topics", as: "group_topics", group_name: RouteFormat.username

scope "/private-messages-group/:username", group_name: RouteFormat.username do
get ":group_name.json" => "list#private_messages_group", as: "topics_private_messages_group"
@@ -11,7 +11,7 @@ acceptance("Group logs", {
];
};

server.get('/groups/snorlax', () => { // eslint-disable-line no-undef
server.get('/groups/snorlax.json', () => { // eslint-disable-line no-undef
return response({"group":{"id":41,"automatic":false,"name":"snorlax","user_count":1,"alias_level":0,"visible":true,"automatic_membership_email_domains":"","automatic_membership_retroactive":false,"primary_group":true,"title":"Team Snorlax","grant_trust_level":null,"incoming_email":null,"has_messages":false,"flair_url":"","flair_bg_color":"","flair_color":"","bio_raw":"","bio_cooked":null,"public":true,"is_group_user":true,"is_group_owner":true}});
});

@@ -1,5 +1,5 @@
export default {
"/groups/moderators":{
"/groups/moderators.json":{
"group": {
"id": 50,
"automatic": true,
@@ -32,7 +32,7 @@ export default {
"messageable": true
},
},
"/groups/discourse":{
"/groups/discourse.json":{
"group":{
"id":47,
"automatic":false,

1 comment on commit a389bae

@discoursebot

This comment has been minimized.

Copy link

discoursebot commented on a389bae Apr 12, 2018

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/group-name-cant-have-dot-inside/48658/5

Please sign in to comment.
You can’t perform that action at this time.