summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-04-27 10:57:58 -0400
committerCorey Hulen <corey@hulen.com>2017-04-27 07:57:58 -0700
commit5a60ea0d756531fef4e6e94be1377c10a7022260 (patch)
tree894421b688ec276dbae0f0e530eca100d4da4541
parent9a87bb3af68216b53ee8f89d6604c715c7b85b2d (diff)
downloadchat-5a60ea0d756531fef4e6e94be1377c10a7022260.tar.gz
chat-5a60ea0d756531fef4e6e94be1377c10a7022260.tar.bz2
chat-5a60ea0d756531fef4e6e94be1377c10a7022260.zip
PLT-6268 Clear blue bar correctly when removing expiring license (#6247)
* Don't sanitize license for system admin * Clear blue bar error whe removing expiring license * Fix unit test
-rw-r--r--api4/system.go10
-rw-r--r--api4/system_test.go7
-rw-r--r--webapp/components/admin_console/license_settings.jsx2
3 files changed, 18 insertions, 1 deletions
diff --git a/api4/system.go b/api4/system.go
index 7e860ba76..1f4589bf5 100644
--- a/api4/system.go
+++ b/api4/system.go
@@ -231,6 +231,14 @@ func getClientLicense(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
+ var clientLicense map[string]string
+
+ if app.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) {
+ clientLicense = utils.ClientLicense
+ } else {
+ clientLicense = utils.GetSanitizedClientLicense()
+ }
+
w.Header().Set(model.HEADER_ETAG_SERVER, etag)
- w.Write([]byte(model.MapToJson(utils.GetSanitizedClientLicense())))
+ w.Write([]byte(model.MapToJson(clientLicense)))
}
diff --git a/api4/system_test.go b/api4/system_test.go
index ba30dd1eb..850705040 100644
--- a/api4/system_test.go
+++ b/api4/system_test.go
@@ -180,6 +180,13 @@ func TestGetOldClientLicense(t *testing.T) {
if _, err := Client.DoApiGet("/license/client?format=junk", ""); err == nil || err.StatusCode != http.StatusBadRequest {
t.Fatal("should have errored with 400")
}
+
+ license, resp = th.SystemAdminClient.GetOldClientLicense("")
+ CheckNoError(t, resp)
+
+ if len(license["IsLicensed"]) == 0 {
+ t.Fatal("license not returned correctly")
+ }
}
func TestGetAudits(t *testing.T) {
diff --git a/webapp/components/admin_console/license_settings.jsx b/webapp/components/admin_console/license_settings.jsx
index 84867ab2e..844dd0569 100644
--- a/webapp/components/admin_console/license_settings.jsx
+++ b/webapp/components/admin_console/license_settings.jsx
@@ -5,6 +5,7 @@ import $ from 'jquery';
import ReactDOM from 'react-dom';
import * as Utils from 'utils/utils.jsx';
+import ErrorStore from 'stores/error_store.jsx';
import {uploadLicenseFile, removeLicenseFile} from 'actions/admin_actions.jsx';
import {injectIntl, intlShape, defineMessages, FormattedMessage, FormattedHTMLMessage} from 'react-intl';
@@ -80,6 +81,7 @@ class LicenseSettings extends React.Component {
() => {
$('#remove-button').button('reset');
this.setState({fileSelected: false, fileName: null, serverError: null});
+ ErrorStore.clearLastError(true);
window.location.reload(true);
},
(error) => {