summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api4/channel.go11
-rw-r--r--model/channel.go3
2 files changed, 10 insertions, 4 deletions
diff --git a/api4/channel.go b/api4/channel.go
index 1599b6e70..d497c9793 100644
--- a/api4/channel.go
+++ b/api4/channel.go
@@ -97,10 +97,11 @@ func updateChannel(c *Context, w http.ResponseWriter, r *http.Request) {
}
var oldChannel *model.Channel
- var err *model.AppError
- if oldChannel, err = c.App.GetChannel(channel.Id); err != nil {
+ if originalOldChannel, err := c.App.GetChannel(channel.Id); err != nil {
c.Err = err
return
+ } else {
+ oldChannel = originalOldChannel.DeepCopy()
}
switch oldChannel.Type {
@@ -229,10 +230,12 @@ func patchChannel(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- oldChannel, err := c.App.GetChannel(c.Params.ChannelId)
- if err != nil {
+ var oldChannel *model.Channel
+ if originalOldChannel, err := c.App.GetChannel(c.Params.ChannelId); err != nil {
c.Err = err
return
+ } else {
+ oldChannel = originalOldChannel.DeepCopy()
}
switch oldChannel.Type {
diff --git a/model/channel.go b/model/channel.go
index 7a57496ae..09e5e389c 100644
--- a/model/channel.go
+++ b/model/channel.go
@@ -59,6 +59,9 @@ type ChannelPatch struct {
func (o *Channel) DeepCopy() *Channel {
copy := *o
+ if copy.SchemeId != nil {
+ copy.SchemeId = NewString(*o.SchemeId)
+ }
return &copy
}