Added post limit warning (#26793)
* Renamed user limit API to app limit API * Added post warning limit * Added tests * Fixed types * Renamed AppLimits to ServerLimits * Fixed tests and review fixes * Updated generated code * Updated server i18n * Fixed TestCreateUserOrGuest test * Exclude deleted posts from post count for liims * Reduced limits for ease of testing * Restored original limts
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4571c6e3a3
Коммит
b4a1b33d39
@@ -8953,20 +8953,20 @@ func (c *Client4) SubmitTrueUpReview(ctx context.Context, req map[string]any) (*
|
||||
return BuildResponse(r), nil
|
||||
}
|
||||
|
||||
func (c *Client4) GetUserLimits(ctx context.Context) (*UserLimits, *Response, error) {
|
||||
func (c *Client4) GetServerLimits(ctx context.Context) (*ServerLimits, *Response, error) {
|
||||
r, err := c.DoAPIGet(ctx, c.limitsRoute()+"/users", "")
|
||||
if err != nil {
|
||||
return nil, BuildResponse(r), err
|
||||
}
|
||||
defer closeBody(r)
|
||||
var userLimits UserLimits
|
||||
var serverLimits ServerLimits
|
||||
if r.StatusCode == http.StatusNotModified {
|
||||
return &userLimits, BuildResponse(r), nil
|
||||
return &serverLimits, BuildResponse(r), nil
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&userLimits); err != nil {
|
||||
return nil, nil, NewAppError("GetUserLimits", "api.unmarshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
if err := json.NewDecoder(r.Body).Decode(&serverLimits); err != nil {
|
||||
return nil, nil, NewAppError("GetServerLimits", "api.unmarshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
return &userLimits, BuildResponse(r), nil
|
||||
return &serverLimits, BuildResponse(r), nil
|
||||
}
|
||||
|
||||
// CreateChannelBookmark creates a channel bookmark based on the provided struct.
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
|
||||
package model
|
||||
|
||||
type UserLimits struct {
|
||||
type ServerLimits struct {
|
||||
MaxUsersLimit int64 `json:"maxUsersLimit"` // soft limit for max number of users.
|
||||
MaxUsersHardLimit int64 `json:"maxUsersHardLimit"` // hard limit for max number of active users.
|
||||
ActiveUserCount int64 `json:"activeUserCount"` // actual number of active users on server. Active = non deleted
|
||||
|
||||
MaxPostLimit int64 `json:"maxPostLimit"` // soft limit for max number of posts
|
||||
PostCount int64 `json:"postCount"` // actual number of posts in system.
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user