Restored ToJSON encoding (sans Integration) for Post APIs (#19279)
* Restored ToJSON encoding sans Integration for Post APIs * PR feedback + GetPost test Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
@@ -6,6 +6,7 @@ package model
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"sort"
|
||||
@@ -227,6 +228,11 @@ func (o *Post) ToJSON() (string, error) {
|
||||
return string(b), err
|
||||
}
|
||||
|
||||
func (o *Post) EncodeJSON(w io.Writer) error {
|
||||
o.StripActionIntegrations()
|
||||
return json.NewEncoder(w).Encode(o)
|
||||
}
|
||||
|
||||
type GetPostsSinceOptions struct {
|
||||
UserId string
|
||||
ChannelId string
|
||||
|
||||
@@ -5,6 +5,7 @@ package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"sort"
|
||||
)
|
||||
|
||||
@@ -80,6 +81,11 @@ func (o *PostList) ToJSON() (string, error) {
|
||||
return string(b), err
|
||||
}
|
||||
|
||||
func (o *PostList) EncodeJSON(w io.Writer) error {
|
||||
o.StripActionIntegrations()
|
||||
return json.NewEncoder(w).Encode(o)
|
||||
}
|
||||
|
||||
func (o *PostList) MakeNonNil() {
|
||||
if o.Order == nil {
|
||||
o.Order = make([]string, 0)
|
||||
|
||||
@@ -5,6 +5,7 @@ package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
)
|
||||
|
||||
type PostSearchMatches map[string][]string
|
||||
@@ -27,3 +28,8 @@ func (o *PostSearchResults) ToJSON() (string, error) {
|
||||
b, err := json.Marshal(©)
|
||||
return string(b), err
|
||||
}
|
||||
|
||||
func (o *PostSearchResults) EncodeJSON(w io.Writer) error {
|
||||
o.PostList.StripActionIntegrations()
|
||||
return json.NewEncoder(w).Encode(o)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user