Commit de7dc925 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Use /group/name/ as the main page for the group.

We used to omit the slash, which users found confusing.
parent 5b1bc814
...@@ -3089,7 +3089,9 @@ async function serverConnect() { ...@@ -3089,7 +3089,9 @@ async function serverConnect() {
} }
function start() { function start() {
group = decodeURIComponent(location.pathname.replace(/^\/[a-z]*\//, '')); group = decodeURIComponent(
location.pathname.replace(/^\/[a-z]*\//, '').replace(/\/$/, '')
);
setTitle(capitalise(group)); setTitle(capitalise(group));
addFilters(); addFilters();
setMediaChoices(false).then(e => reflectSettings()); setMediaChoices(false).then(e => reflectSettings());
......
...@@ -24,7 +24,7 @@ document.getElementById('groupform').onsubmit = function(e) { ...@@ -24,7 +24,7 @@ document.getElementById('groupform').onsubmit = function(e) {
e.preventDefault(); e.preventDefault();
let group = document.getElementById('group').value.trim(); let group = document.getElementById('group').value.trim();
if(group !== '') if(group !== '')
location.href = '/group/' + group; location.href = '/group/' + group + '/';
}; };
async function listPublicGroups() { async function listPublicGroups() {
...@@ -59,8 +59,8 @@ async function listPublicGroups() { ...@@ -59,8 +59,8 @@ async function listPublicGroups() {
let tr = document.createElement('tr'); let tr = document.createElement('tr');
let td = document.createElement('td'); let td = document.createElement('td');
let a = document.createElement('a'); let a = document.createElement('a');
a.textContent = group.name; a.textContent = group.displayName || group.name;
a.href = '/group/' + encodeURIComponent(group.displayName || group.name); a.href = '/group/' + group.name + '/';
td.appendChild(a); td.appendChild(a);
tr.appendChild(td); tr.appendChild(td);
let td2 = document.createElement('td'); let td2 = document.createElement('td');
......
...@@ -283,8 +283,9 @@ func groupHandler(w http.ResponseWriter, r *http.Request) { ...@@ -283,8 +283,9 @@ func groupHandler(w http.ResponseWriter, r *http.Request) {
return return
} }
if r.URL.Path != "/group/"+name { if r.URL.Path != "/group/"+name+"/" {
http.Redirect(w, r, "/group/"+name, http.StatusPermanentRedirect) http.Redirect(w, r, "/group/"+name+"/",
http.StatusPermanentRedirect)
return return
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment