Added the SearchPostsInTeam method to the plugin API (#10106)
Этот коммит содержится в:
коммит произвёл
Hanzei
родитель
87e36a3ecf
Коммит
c08fda1337
@@ -21,6 +21,14 @@ func NewPostList() *PostList {
|
||||
}
|
||||
}
|
||||
|
||||
func (o *PostList) ToSlice() []*Post {
|
||||
var posts []*Post
|
||||
for _, id := range o.Order {
|
||||
posts = append(posts, o.Posts[id])
|
||||
}
|
||||
return posts
|
||||
}
|
||||
|
||||
func (o *PostList) WithRewrittenImageURLs(f func(string) string) *PostList {
|
||||
copy := *o
|
||||
copy.Posts = make(map[string]*Post)
|
||||
|
||||
@@ -90,3 +90,21 @@ func TestPostListSortByCreateAt(t *testing.T) {
|
||||
assert.EqualValues(t, pl.Order[1], p1.Id)
|
||||
assert.EqualValues(t, pl.Order[2], p2.Id)
|
||||
}
|
||||
|
||||
func TestPostListToSlice(t *testing.T) {
|
||||
pl := PostList{}
|
||||
p1 := &Post{Id: NewId(), Message: NewId(), CreateAt: 2}
|
||||
pl.AddPost(p1)
|
||||
p2 := &Post{Id: NewId(), Message: NewId(), CreateAt: 1}
|
||||
pl.AddPost(p2)
|
||||
p3 := &Post{Id: NewId(), Message: NewId(), CreateAt: 3}
|
||||
pl.AddPost(p3)
|
||||
|
||||
pl.AddOrder(p1.Id)
|
||||
pl.AddOrder(p2.Id)
|
||||
pl.AddOrder(p3.Id)
|
||||
|
||||
want := []*Post{p1, p2, p3}
|
||||
|
||||
assert.Equal(t, want, pl.ToSlice())
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ type SearchParams struct {
|
||||
OrTerms bool
|
||||
IncludeDeletedChannels bool
|
||||
TimeZoneOffset int
|
||||
// True if this search doesn't originate from a "current user".
|
||||
SearchWithoutUserId bool
|
||||
}
|
||||
|
||||
// Returns the epoch timestamp of the start of the day specified by SearchParams.AfterDate
|
||||
|
||||
Ссылка в новой задаче
Block a user