Restore previously archived groups (#22597)
* add ability to restore groups from the user group modal * factory selector for groups to reduce number of renders across the app * react window and infinite scroll for user groups * adding archive groups to dropdown * restore user group from the view modal * component cleanup * lint * adding websocket for archiveGroup * updating tests * adding some tests and fixing types * lint * fixing broken test * fixing snapshot * fixing infinitescroll * lint * increasing max-height and updating snapshots * fixing PR comments * fixing case for button * snapshot and translation * fixing PR comments * tiding up repition and creating new hook * fixing tests * add additional parammeter for call to getGroups() * make sure popup is visible for all rows * update text for admin console * update css for lint * fix edge cases found in review * revert package-lock.json * revert adding query to GetGroupsParam * fixing lint * change include_archived to false in team_controller --------- Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local> Co-authored-by: Scott Bishel <scott.bishel@mattermost.com> Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -213,6 +213,22 @@ func (a *App) DeleteGroup(groupID string) (*model.Group, *model.AppError) {
|
||||
}
|
||||
}
|
||||
|
||||
count, err := a.Srv().Store().Group().GetMemberCount(groupID)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("DeleteGroup", "app.group.id.app_error", nil, "", http.StatusBadRequest).Wrap(err)
|
||||
}
|
||||
|
||||
deletedGroup.MemberCount = model.NewInt(int(count))
|
||||
|
||||
messageWs := model.NewWebSocketEvent(model.WebsocketEventReceivedGroup, "", "", "", nil, "")
|
||||
|
||||
groupJSON, err := json.Marshal(deletedGroup)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("DeleteGroup", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
messageWs.Add("group", string(groupJSON))
|
||||
a.Publish(messageWs)
|
||||
|
||||
return deletedGroup, nil
|
||||
}
|
||||
|
||||
@@ -228,6 +244,22 @@ func (a *App) RestoreGroup(groupID string) (*model.Group, *model.AppError) {
|
||||
}
|
||||
}
|
||||
|
||||
count, err := a.Srv().Store().Group().GetMemberCount(groupID)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("RestoreGroup", "app.group.id.app_error", nil, "", http.StatusBadRequest).Wrap(err)
|
||||
}
|
||||
|
||||
restoredGroup.MemberCount = model.NewInt(int(count))
|
||||
|
||||
messageWs := model.NewWebSocketEvent(model.WebsocketEventReceivedGroup, "", "", "", nil, "")
|
||||
|
||||
groupJSON, err := json.Marshal(restoredGroup)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("RestoreGroup", "api.marshal_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
messageWs.Add("group", string(groupJSON))
|
||||
a.Publish(messageWs)
|
||||
|
||||
return restoredGroup, nil
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user