Add create_at back to profile fields to fix analytics
Этот коммит содержится в:
@@ -5,6 +5,7 @@ package api
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
l4g "github.com/alecthomas/log4go"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/mattermost/platform/model"
|
||||
@@ -63,6 +64,18 @@ func addLicense(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
if success, licenseStr := utils.ValidateLicense(data); success {
|
||||
license = model.LicenseFromJson(strings.NewReader(licenseStr))
|
||||
|
||||
if result := <-Srv.Store.User().AnalyticsUniqueUserCount(""); result.Err != nil {
|
||||
c.Err = model.NewAppError("addLicense", "Unable to count total unique users.", fmt.Sprintf("err=%v", result.Err.Error()))
|
||||
return
|
||||
} else {
|
||||
uniqueUserCount := result.Data.(int64)
|
||||
|
||||
if uniqueUserCount > int64(*license.Features.Users) {
|
||||
c.Err = model.NewAppError("addLicense", fmt.Sprintf("This license only supports %d users, when your system has %d unique users. Unique users are counted distinctly by email address. You can see total user count under Site Reports -> View Statistics.", *license.Features.Users, uniqueUserCount), "")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if ok := utils.SetLicense(license); !ok {
|
||||
c.LogAudit("failed - expired or non-started license")
|
||||
c.Err = model.NewAppError("addLicense", "License is either expired or has not yet started.", "")
|
||||
|
||||
@@ -236,7 +236,6 @@ func (u *User) Sanitize(options map[string]bool) {
|
||||
}
|
||||
|
||||
func (u *User) ClearNonProfileFields() {
|
||||
u.CreateAt = 0
|
||||
u.UpdateAt = 0
|
||||
u.Password = ""
|
||||
u.AuthData = ""
|
||||
|
||||
@@ -55,6 +55,7 @@ func LoadLicense() {
|
||||
if success, licenseStr := ValidateLicense(buf.Bytes()); success {
|
||||
license := model.LicenseFromJson(strings.NewReader(licenseStr))
|
||||
SetLicense(license)
|
||||
return
|
||||
}
|
||||
|
||||
l4g.Warn("No valid enterprise license found")
|
||||
@@ -105,7 +106,7 @@ func ValidateLicense(signed []byte) (bool, string) {
|
||||
}
|
||||
|
||||
// remove null terminator
|
||||
if decoded[len(decoded)-1] == byte(0) {
|
||||
for decoded[len(decoded)-1] == byte(0) {
|
||||
decoded = decoded[:len(decoded)-1]
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ export default class SystemAnalytics extends React.Component {
|
||||
return (
|
||||
<div>
|
||||
<Analytics
|
||||
title={'the system'}
|
||||
title={'the System'}
|
||||
channelOpenCount={this.state.channel_open_count}
|
||||
channelPrivateCount={this.state.channel_private_count}
|
||||
postCount={this.state.post_count}
|
||||
|
||||
@@ -152,6 +152,10 @@ export default class TeamAnalytics extends React.Component {
|
||||
|
||||
var recentActive = [];
|
||||
for (let i = 0; i < usersList.length; i++) {
|
||||
if (usersList[i].last_activity_at == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
recentActive.push(usersList[i]);
|
||||
if (i > 19) {
|
||||
break;
|
||||
|
||||
Ссылка в новой задаче
Block a user