Plugin API hook for Shared Channel file attachment sync (#25874)
* option for auto inviting plugin to all shared channels. * auto-invite remotes to shared channels when flag set * fix unit test * immediately ping new remotes; fix unique siteurl bug * make i18n-extract * fix translations * plugin hooks for file attachments * hook for profile image sync * fix profile image sync * fix unit test --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -130,3 +130,21 @@ func isNotFoundError(err error) bool {
|
||||
var errNotFound *store.ErrNotFound
|
||||
return errors.As(err, &errNotFound)
|
||||
}
|
||||
|
||||
func postsSliceToMap(posts []*model.Post) map[string]*model.Post {
|
||||
m := make(map[string]*model.Post, len(posts))
|
||||
for _, p := range posts {
|
||||
m[p.Id] = p
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
func reducePostsSliceInCache(posts []*model.Post, cache map[string]*model.Post) []*model.Post {
|
||||
reduced := make([]*model.Post, 0, len(posts))
|
||||
for _, p := range posts {
|
||||
if _, ok := cache[p.Id]; !ok {
|
||||
reduced = append(reduced, p)
|
||||
}
|
||||
}
|
||||
return reduced
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user