diff options
author | Jason Mojica <jason@jasonmojica.net> | 2018-10-25 17:24:43 +0000 |
---|---|---|
committer | Jesse Hallam <jesse.hallam@gmail.com> | 2018-10-25 13:24:43 -0400 |
commit | 1074a1c7ab0769b0da3525282fcabf961e2ddfce (patch) | |
tree | 4fc4f2701ccc6dc4f40c22f604e6581a168aa9d0 /app | |
parent | dd60ad0db76a00a92d25d7923bf8fb54ebf4a531 (diff) | |
download | chat-1074a1c7ab0769b0da3525282fcabf961e2ddfce.tar.gz chat-1074a1c7ab0769b0da3525282fcabf961e2ddfce.tar.bz2 chat-1074a1c7ab0769b0da3525282fcabf961e2ddfce.zip |
GH-9612 Add plugin API for GetChannelStats method (#9627)
* Add GetChannelStats plugin api
* Fix to return channel stats correctly
* Add server version; Handle error idiomatically
Diffstat (limited to 'app')
-rw-r--r-- | app/plugin_api.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/plugin_api.go b/app/plugin_api.go index c409a88f8..a07a07652 100644 --- a/app/plugin_api.go +++ b/app/plugin_api.go @@ -261,6 +261,14 @@ func (api *PluginAPI) GetChannelsForTeamForUser(teamId, userId string, includeDe return api.app.GetChannelsForUser(teamId, userId, includeDeleted) } +func (api *PluginAPI) GetChannelStats(channelId string) (*model.ChannelStats, *model.AppError) { + memberCount, err := api.app.GetChannelMemberCount(channelId) + if err != nil { + return nil, err + } + return &model.ChannelStats{ChannelId: channelId, MemberCount: memberCount}, nil +} + func (api *PluginAPI) GetDirectChannel(userId1, userId2 string) (*model.Channel, *model.AppError) { return api.app.GetDirectChannel(userId1, userId2) } |