[MM-55323] Allow end users to fetch the group members list of groups which allow @-mentions (#26551)

* Allow end users to fetch the group members list of groups which allow @-mentions

* Update server/channels/api4/group_test.go

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>

* Fix test name

* Move into subtest

---------

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Этот коммит содержится в:
Ben Schumacher
2024-04-12 19:41:50 +02:00
коммит произвёл GitHub
родитель 460b228837
Коммит df75277a0c
5 изменённых файлов: 111 добавлений и 40 удалений

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

@@ -7690,6 +7690,19 @@ func (c *Client4) PatchGroup(ctx context.Context, groupID string, patch *GroupPa
return &g, BuildResponse(r), nil
}
func (c *Client4) GetGroupMembers(ctx context.Context, groupID string) (*GroupMemberList, *Response, error) {
r, err := c.DoAPIGet(ctx, c.groupRoute(groupID)+"/members", "")
if err != nil {
return nil, BuildResponse(r), err
}
defer closeBody(r)
var ml GroupMemberList
if err := json.NewDecoder(r.Body).Decode(&ml); err != nil {
return nil, nil, NewAppError("UpsertGroupMembers", "api.unmarshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
}
return &ml, BuildResponse(r), nil
}
func (c *Client4) UpsertGroupMembers(ctx context.Context, groupID string, userIds *GroupModifyMembers) ([]*GroupMember, *Response, error) {
payload, err := json.Marshal(userIds)
if err != nil {

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

@@ -21,3 +21,8 @@ func (gm *GroupMember) IsValid() *AppError {
}
return nil
}
type GroupMemberList struct {
Members []*User `json:"members"`
Count int `json:"total_member_count"`
}