summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/mattermost-server/v5/model/terms_of_service.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2023-08-05 20:43:19 +0200
committerGitHub <noreply@github.com>2023-08-05 20:43:19 +0200
commit56e7bd01ca09ad52b0c4f48f146a20a4f1b78696 (patch)
treeb1355645342667209263cbd355dc0b4254f1e8fe /vendor/github.com/mattermost/mattermost-server/v5/model/terms_of_service.go
parent9459495484d6e06a3d46de64fccd8d06f7ccc72c (diff)
downloadmatterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.tar.gz
matterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.tar.bz2
matterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.zip
Update dependencies and remove old matterclient lib (#2067)HEADmaster
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/v5/model/terms_of_service.go')
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v5/model/terms_of_service.go69
1 files changed, 0 insertions, 69 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/terms_of_service.go b/vendor/github.com/mattermost/mattermost-server/v5/model/terms_of_service.go
deleted file mode 100644
index 8ce5d350..00000000
--- a/vendor/github.com/mattermost/mattermost-server/v5/model/terms_of_service.go
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
-// See LICENSE.txt for license information.
-
-package model
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "net/http"
- "unicode/utf8"
-)
-
-const TERMS_OF_SERVICE_CACHE_SIZE = 1
-
-type TermsOfService struct {
- Id string `json:"id"`
- CreateAt int64 `json:"create_at"`
- UserId string `json:"user_id"`
- Text string `json:"text"`
-}
-
-func (t *TermsOfService) IsValid() *AppError {
- if !IsValidId(t.Id) {
- return InvalidTermsOfServiceError("id", "")
- }
-
- if t.CreateAt == 0 {
- return InvalidTermsOfServiceError("create_at", t.Id)
- }
-
- if !IsValidId(t.UserId) {
- return InvalidTermsOfServiceError("user_id", t.Id)
- }
-
- if utf8.RuneCountInString(t.Text) > POST_MESSAGE_MAX_RUNES_V2 {
- return InvalidTermsOfServiceError("text", t.Id)
- }
-
- return nil
-}
-
-func (t *TermsOfService) ToJson() string {
- b, _ := json.Marshal(t)
- return string(b)
-}
-
-func TermsOfServiceFromJson(data io.Reader) *TermsOfService {
- var termsOfService *TermsOfService
- json.NewDecoder(data).Decode(&termsOfService)
- return termsOfService
-}
-
-func InvalidTermsOfServiceError(fieldName string, termsOfServiceId string) *AppError {
- id := fmt.Sprintf("model.terms_of_service.is_valid.%s.app_error", fieldName)
- details := ""
- if termsOfServiceId != "" {
- details = "terms_of_service_id=" + termsOfServiceId
- }
- return NewAppError("TermsOfService.IsValid", id, map[string]interface{}{"MaxLength": POST_MESSAGE_MAX_RUNES_V2}, details, http.StatusBadRequest)
-}
-
-func (t *TermsOfService) PreSave() {
- if t.Id == "" {
- t.Id = NewId()
- }
-
- t.CreateAt = GetMillis()
-}