[MM-29217] Remove Posts.ParentId (#17923)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
757dc96461
Коммит
d181ae9262
@@ -14,7 +14,6 @@ type CommandWebhook struct {
|
||||
UserId string
|
||||
ChannelId string
|
||||
RootId string
|
||||
ParentId string
|
||||
UseCount int
|
||||
}
|
||||
|
||||
@@ -57,9 +56,5 @@ func (o *CommandWebhook) IsValid() *AppError {
|
||||
return NewAppError("CommandWebhook.IsValid", "model.command_hook.root_id.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if o.ParentId != "" && !IsValidId(o.ParentId) {
|
||||
return NewAppError("CommandWebhook.IsValid", "model.command_hook.parent_id.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -43,8 +43,6 @@ func TestCommandWebhookIsValid(t *testing.T) {
|
||||
{func() { h.ChannelId = NewId() }, ""},
|
||||
{func() { h.RootId = "asd" }, "model.command_hook.root_id.app_error"},
|
||||
{func() { h.RootId = NewId() }, ""},
|
||||
{func() { h.ParentId = "asd" }, "model.command_hook.parent_id.app_error"},
|
||||
{func() { h.ParentId = NewId() }, ""},
|
||||
} {
|
||||
tmp := h
|
||||
test.Transform()
|
||||
|
||||
@@ -30,7 +30,6 @@ type CompliancePost struct {
|
||||
PostUpdateAt int64
|
||||
PostDeleteAt int64
|
||||
PostRootId string
|
||||
PostParentId string
|
||||
PostOriginalId string
|
||||
PostMessage string
|
||||
PostType string
|
||||
@@ -60,7 +59,6 @@ func CompliancePostHeader() []string {
|
||||
"PostUpdateAt",
|
||||
"PostDeleteAt",
|
||||
"PostRootId",
|
||||
"PostParentId",
|
||||
"PostOriginalId",
|
||||
"PostMessage",
|
||||
"PostType",
|
||||
@@ -113,7 +111,6 @@ func (cp *CompliancePost) Row() []string {
|
||||
postDeleteAt,
|
||||
|
||||
cp.PostRootId,
|
||||
cp.PostParentId,
|
||||
cp.PostOriginalId,
|
||||
cleanComplianceStrings(cp.PostMessage),
|
||||
cp.PostType,
|
||||
|
||||
@@ -81,7 +81,6 @@ type Post struct {
|
||||
UserId string `json:"user_id"`
|
||||
ChannelId string `json:"channel_id"`
|
||||
RootId string `json:"root_id"`
|
||||
ParentId string `json:"parent_id"`
|
||||
OriginalId string `json:"original_id"`
|
||||
|
||||
Message string `json:"message"`
|
||||
@@ -194,7 +193,6 @@ func (o *Post) ShallowCopy(dst *Post) error {
|
||||
dst.UserId = o.UserId
|
||||
dst.ChannelId = o.ChannelId
|
||||
dst.RootId = o.RootId
|
||||
dst.ParentId = o.ParentId
|
||||
dst.OriginalId = o.OriginalId
|
||||
dst.Message = o.Message
|
||||
dst.MessageSource = o.MessageSource
|
||||
@@ -302,14 +300,6 @@ func (o *Post) IsValid(maxPostSize int) *AppError {
|
||||
return NewAppError("Post.IsValid", "model.post.is_valid.root_id.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if !(IsValidId(o.ParentId) || o.ParentId == "") {
|
||||
return NewAppError("Post.IsValid", "model.post.is_valid.parent_id.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if len(o.ParentId) == 26 && o.RootId == "" {
|
||||
return NewAppError("Post.IsValid", "model.post.is_valid.root_parent.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
if !(len(o.OriginalId) == 26 || o.OriginalId == "") {
|
||||
return NewAppError("Post.IsValid", "model.post.is_valid.original_id.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
@@ -56,16 +56,7 @@ func TestPostIsValid(t *testing.T) {
|
||||
require.NotNil(t, err)
|
||||
|
||||
o.RootId = ""
|
||||
o.ParentId = "123"
|
||||
err = o.IsValid(maxPostSize)
|
||||
require.NotNil(t, err)
|
||||
|
||||
o.ParentId = NewId()
|
||||
o.RootId = ""
|
||||
err = o.IsValid(maxPostSize)
|
||||
require.NotNil(t, err)
|
||||
|
||||
o.ParentId = ""
|
||||
o.Message = strings.Repeat("0", maxPostSize+1)
|
||||
err = o.IsValid(maxPostSize)
|
||||
require.NotNil(t, err)
|
||||
|
||||
Ссылка в новой задаче
Block a user