Expose public/ API as submodule (#23345)
* model -> public/model * plugin -> public/plugin * public/model/utils -> public/utils * platform/shared/mlog -> public/shared/mlog * platform/shared/i18n -> public/shared/i18n * platform/shared/markdown -> public/shared/markdown * platform/services/timezones -> public/shared/timezones * channels/einterfaces -> einterfaces * expose public/ submodule * go mod tidy * .github: cache-dependency-path, setup-go-work * modules-tidy for public/ too * remove old gomodtidy
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
070ee26081
Коммит
bb02b35048
41
server/public/model/post_search_results.go
Обычный файл
41
server/public/model/post_search_results.go
Обычный файл
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
)
|
||||
|
||||
type PostSearchMatches map[string][]string
|
||||
|
||||
type PostSearchResults struct {
|
||||
*PostList
|
||||
Matches PostSearchMatches `json:"matches"`
|
||||
}
|
||||
|
||||
func MakePostSearchResults(posts *PostList, matches PostSearchMatches) *PostSearchResults {
|
||||
return &PostSearchResults{
|
||||
posts,
|
||||
matches,
|
||||
}
|
||||
}
|
||||
|
||||
func (o *PostSearchResults) ToJSON() (string, error) {
|
||||
copy := *o
|
||||
copy.PostList.StripActionIntegrations()
|
||||
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)
|
||||
}
|
||||
|
||||
func (o *PostSearchResults) ForPlugin() *PostSearchResults {
|
||||
copy := *o
|
||||
copy.PostList = copy.PostList.ForPlugin()
|
||||
return ©
|
||||
}
|
||||
Ссылка в новой задаче
Block a user