[MM-51201/MM-60406/MM-60404] CrossTeam Search posts and files (#28478)

* poc - wip

* add search files across teams

* eslint

* fix existing tests

* fix webapp style

* fix test

* add api doc

* change initial state in test

* add tests on API

* add tests on file info layer

* fix file search tags

* add rhs reducer test

* reset team selected when the RHS is suppressed

* change css to reflect UI

* fix style

* fix doc wording

* make getSearchTeam return currentTeamId when value is not set

* await is unnecessary

* revert boolean check and add test

* add comment to getSearchTeam to let dev knows it defaults to currentTeam

* remove redundant team check

* simplfy test

* fix style check

---------

Co-authored-by: Caleb Roseland <caleb@calebroseland.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Julien Tant
2024-11-21 13:40:46 -07:00
коммит произвёл GitHub
родитель f0280d6dd4
Коммит 3b1eb64e02
25 изменённых файлов: 573 добавлений и 150 удалений

Просмотреть файл

@@ -4415,7 +4415,12 @@ func (c *Client4) SearchFilesWithParams(ctx context.Context, teamId string, para
if err != nil {
return nil, nil, NewAppError("SearchFilesWithParams", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
r, err := c.DoAPIPost(ctx, c.teamRoute(teamId)+"/files/search", string(js))
route := c.teamRoute(teamId) + "/files/search"
if teamId == "" {
route = c.filesRoute() + "/search"
}
r, err := c.DoAPIPost(ctx, route, string(js))
if err != nil {
return nil, BuildResponse(r), err
}
@@ -4428,6 +4433,15 @@ func (c *Client4) SearchFilesWithParams(ctx context.Context, teamId string, para
return &list, BuildResponse(r), nil
}
// SearchFilesAcrossTeams returns any posts with matching terms string.
func (c *Client4) SearchFilesAcrossTeams(ctx context.Context, terms string, isOrSearch bool) (*FileInfoList, *Response, error) {
params := SearchParameter{
Terms: &terms,
IsOrSearch: &isOrSearch,
}
return c.SearchFilesWithParams(ctx, "", &params)
}
// SearchPosts returns any posts with matching terms string.
func (c *Client4) SearchPosts(ctx context.Context, teamId string, terms string, isOrSearch bool) (*PostList, *Response, error) {
params := SearchParameter{

Просмотреть файл

@@ -55,6 +55,8 @@ type FeatureFlags struct {
NotificationMonitoring bool
ExperimentalAuditSettingsSystemConsoleUI bool
ExperimentalCrossTeamSearch bool
}
func (f *FeatureFlags) SetDefaults() {
@@ -78,6 +80,7 @@ func (f *FeatureFlags) SetDefaults() {
f.WebSocketEventScope = true
f.NotificationMonitoring = true
f.ExperimentalAuditSettingsSystemConsoleUI = false
f.ExperimentalCrossTeamSearch = false
}
// ToMap returns the feature flags as a map[string]string