MM-14768: Switches field type from sql.NullBool to a bool pointer. (#10526)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
a186592257
Коммит
020ba82cdb
@@ -5,7 +5,6 @@ package model
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
||||
"database/sql"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"io"
|
||||
@@ -52,7 +51,7 @@ type Channel struct {
|
||||
CreatorId string `json:"creator_id"`
|
||||
SchemeId *string `json:"scheme_id"`
|
||||
Props map[string]interface{} `json:"props" db:"-"`
|
||||
GroupConstrained sql.NullBool `json:"group_constrained"`
|
||||
GroupConstrained *bool `json:"group_constrained"`
|
||||
}
|
||||
|
||||
type ChannelWithTeamData struct {
|
||||
@@ -191,7 +190,7 @@ func (o *Channel) Patch(patch *ChannelPatch) {
|
||||
}
|
||||
|
||||
if patch.GroupConstrained != nil {
|
||||
o.GroupConstrained.Bool = *patch.GroupConstrained
|
||||
o.GroupConstrained = patch.GroupConstrained
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,8 +59,8 @@ func TestChannelPatch(t *testing.T) {
|
||||
if *p.Purpose != o.Purpose {
|
||||
t.Fatal("do not match")
|
||||
}
|
||||
if *p.GroupConstrained != o.GroupConstrained.Bool {
|
||||
t.Fatalf("expected %v got %v", *p.GroupConstrained, o.GroupConstrained.Bool)
|
||||
if *p.GroupConstrained != *o.GroupConstrained {
|
||||
t.Fatalf("expected %v got %v", *p.GroupConstrained, *o.GroupConstrained)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -42,7 +41,7 @@ type Team struct {
|
||||
AllowOpenInvite bool `json:"allow_open_invite"`
|
||||
LastTeamIconUpdate int64 `json:"last_team_icon_update,omitempty"`
|
||||
SchemeId *string `json:"scheme_id"`
|
||||
GroupConstrained sql.NullBool `json:"group_constrained"`
|
||||
GroupConstrained *bool `json:"group_constrained"`
|
||||
}
|
||||
|
||||
type TeamPatch struct {
|
||||
@@ -278,7 +277,7 @@ func (t *Team) Patch(patch *TeamPatch) {
|
||||
}
|
||||
|
||||
if patch.GroupConstrained != nil {
|
||||
t.GroupConstrained.Bool = *patch.GroupConstrained
|
||||
t.GroupConstrained = patch.GroupConstrained
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ func TestTeamPatch(t *testing.T) {
|
||||
if *p.AllowOpenInvite != o.AllowOpenInvite {
|
||||
t.Fatal("AllowOpenInvite did not update")
|
||||
}
|
||||
if *p.GroupConstrained != o.GroupConstrained.Bool {
|
||||
t.Fatalf("expected %v got %v", *p.GroupConstrained, o.GroupConstrained.Bool)
|
||||
if *p.GroupConstrained != *o.GroupConstrained {
|
||||
t.Fatalf("expected %v got %v", *p.GroupConstrained, *o.GroupConstrained)
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user