mirror of
https://github.com/mattermost/mattermost.git
synced 2026-08-27 05:37:15 -05:00
[MM-67157] Remove format parameter requirement from client license endpoint (#37167)
* MM-67157: Remove unused format flag from /license/client endpoint The `format` query parameter on the `/license/client` (and local variant) endpoint was effectively dead: it was required but only ever accepted the single value `old`, returning an error otherwise. This mirrors the earlier removal of the same flag from `/config/client`, where the server now ignores the parameter while clients continue to send `format=old` for compatibility with pre-v11 servers. The server no longer inspects the `format` parameter, so requests with no format, `format=old`, or any other value all succeed. The unused i18n string and the parameter/response documentation in the OpenAPI spec are removed accordingly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Audz4JLNQN5SJxcPwyQBd * MM-67157: document format=old retention in webapp client Mirror the getClientConfig comment so the format=old query param on getClientLicenseOld is not mistakenly removed; clients keep sending it for compatibility with pre-v11 servers even though current servers now ignore it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Audz4JLNQN5SJxcPwyQBd * MM-67157: stop sending format=old from webapp client Now that the server ignores the format parameter on /license/client, drop format=old from the @mattermost/client getClientLicenseOld call and update the e2e intercepts/helpers that matched the old query string. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018Audz4JLNQN5SJxcPwyQBd * Drop unneeded wildcard from license/client cy.intercept path The format query param is gone from GET /license/client requests, so the trailing * used to match it is no longer needed. --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -28,18 +28,6 @@ func (api *API) InitLicense() {
|
||||
}
|
||||
|
||||
func getClientLicense(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
format := r.URL.Query().Get("format")
|
||||
|
||||
if format == "" {
|
||||
c.Err = model.NewAppError("getClientLicense", "api.license.client.old_format.app_error", nil, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if format != "old" {
|
||||
c.SetInvalidParam("format")
|
||||
return
|
||||
}
|
||||
|
||||
var clientLicense map[string]string
|
||||
|
||||
if c.App.SessionHasPermissionTo(*c.AppContext.Session(), model.PermissionReadLicenseInformation) {
|
||||
|
||||
@@ -103,18 +103,6 @@ func localRemoveLicense(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func localGetClientLicense(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
format := r.URL.Query().Get("format")
|
||||
|
||||
if format == "" {
|
||||
c.Err = model.NewAppError("localGetClientLicense", "api.license.client.old_format.app_error", nil, "", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if format != "old" {
|
||||
c.SetInvalidParam("format")
|
||||
return
|
||||
}
|
||||
|
||||
clientLicense := c.App.Srv().ClientLicense()
|
||||
|
||||
if _, err := w.Write([]byte(model.MapToJSON(clientLicense))); err != nil {
|
||||
|
||||
@@ -38,14 +38,12 @@ func TestGetOldClientLicense(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
resp, err := client.DoAPIGet(context.Background(), "/license/client", "")
|
||||
require.Error(t, err, "get /license/client did not return an error")
|
||||
require.Equal(t, http.StatusBadRequest, resp.StatusCode,
|
||||
"expected 400 bad request")
|
||||
require.NoError(t, err, "get /license/client should not return an error")
|
||||
require.Equal(t, http.StatusOK, resp.StatusCode, "expected 200 OK")
|
||||
|
||||
resp, err = client.DoAPIGet(context.Background(), "/license/client?format=junk", "")
|
||||
require.Error(t, err, "get /license/client?format=junk did not return an error")
|
||||
require.Equal(t, http.StatusBadRequest, resp.StatusCode,
|
||||
"expected 400 Bad Request")
|
||||
require.NoError(t, err, "get /license/client?format=junk should not return an error")
|
||||
require.Equal(t, http.StatusOK, resp.StatusCode, "expected 200 OK")
|
||||
|
||||
license, _, err = th.SystemAdminClient.GetOldClientLicense(context.Background(), "")
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -2700,10 +2700,6 @@
|
||||
"id": "api.license.add_license.wrong_environment_test.app_error",
|
||||
"translation": "This is a test or development license, but this server is running in a production environment. Test or development licenses can only be used on test or development servers."
|
||||
},
|
||||
{
|
||||
"id": "api.license.client.old_format.app_error",
|
||||
"translation": "New format for the client license is not supported yet. Please specify format=old in the query string."
|
||||
},
|
||||
{
|
||||
"id": "api.license.load_metric.app_error",
|
||||
"translation": "Failed to compute monthly active users."
|
||||
|
||||
Reference in New Issue
Block a user