GroupStore migration (#15795)
* Migration completed * Fix tests * Fix tests * Fix tests * Suggestions * Trigger CI * Suggestions * Merge with master * Migration completed * Fix typo * fix err check Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
2ebc8ec90f
Коммит
95221d9ace
@@ -4,7 +4,6 @@
|
||||
package api4
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
@@ -166,7 +165,7 @@ func linkLdapGroup(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
group, err := c.App.GetGroupByRemoteID(ldapGroup.RemoteId, model.GroupSourceLdap)
|
||||
if err != nil && err.DetailedError != sql.ErrNoRows.Error() {
|
||||
if err != nil && err.Id != "app.group.no_rows" {
|
||||
c.Err = err
|
||||
return
|
||||
}
|
||||
|
||||
321
app/group.go
321
app/group.go
@@ -12,27 +12,84 @@ import (
|
||||
)
|
||||
|
||||
func (a *App) GetGroup(id string) (*model.Group, *model.AppError) {
|
||||
return a.Srv().Store.Group().Get(id)
|
||||
group, err := a.Srv().Store.Group().Get(id)
|
||||
if err != nil {
|
||||
var nfErr *store.ErrNotFound
|
||||
switch {
|
||||
case errors.As(err, &nfErr):
|
||||
return nil, model.NewAppError("GetGroup", "app.group.no_rows", nil, nfErr.Error(), http.StatusNotFound)
|
||||
default:
|
||||
return nil, model.NewAppError("GetGroup", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
return group, nil
|
||||
}
|
||||
|
||||
func (a *App) GetGroupByName(name string, opts model.GroupSearchOpts) (*model.Group, *model.AppError) {
|
||||
return a.Srv().Store.Group().GetByName(name, opts)
|
||||
group, err := a.Srv().Store.Group().GetByName(name, opts)
|
||||
if err != nil {
|
||||
var nfErr *store.ErrNotFound
|
||||
switch {
|
||||
case errors.As(err, &nfErr):
|
||||
return nil, model.NewAppError("GetGroupByName", "app.group.no_rows", nil, nfErr.Error(), http.StatusNotFound)
|
||||
default:
|
||||
return nil, model.NewAppError("GetGroupByName", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
return group, nil
|
||||
}
|
||||
|
||||
func (a *App) GetGroupByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, *model.AppError) {
|
||||
return a.Srv().Store.Group().GetByRemoteID(remoteID, groupSource)
|
||||
group, err := a.Srv().Store.Group().GetByRemoteID(remoteID, groupSource)
|
||||
if err != nil {
|
||||
var nfErr *store.ErrNotFound
|
||||
switch {
|
||||
case errors.As(err, &nfErr):
|
||||
return nil, model.NewAppError("GetGroupByRemoteID", "app.group.no_rows", nil, nfErr.Error(), http.StatusNotFound)
|
||||
default:
|
||||
return nil, model.NewAppError("GetGroupByRemoteID", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
return group, nil
|
||||
}
|
||||
|
||||
func (a *App) GetGroupsBySource(groupSource model.GroupSource) ([]*model.Group, *model.AppError) {
|
||||
return a.Srv().Store.Group().GetAllBySource(groupSource)
|
||||
groups, err := a.Srv().Store.Group().GetAllBySource(groupSource)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetGroupsBySource", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return groups, nil
|
||||
}
|
||||
|
||||
func (a *App) GetGroupsByUserId(userId string) ([]*model.Group, *model.AppError) {
|
||||
return a.Srv().Store.Group().GetByUser(userId)
|
||||
groups, err := a.Srv().Store.Group().GetByUser(userId)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetGroupsByUserId", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return groups, nil
|
||||
}
|
||||
|
||||
func (a *App) CreateGroup(group *model.Group) (*model.Group, *model.AppError) {
|
||||
return a.Srv().Store.Group().Create(group)
|
||||
group, err := a.Srv().Store.Group().Create(group)
|
||||
if err != nil {
|
||||
var invErr *store.ErrInvalidInput
|
||||
var appErr *model.AppError
|
||||
switch {
|
||||
case errors.As(err, &appErr):
|
||||
return nil, appErr
|
||||
case errors.As(err, &invErr):
|
||||
return nil, model.NewAppError("CreateGroup", "app.group.id.app_error", nil, invErr.Error(), http.StatusBadRequest)
|
||||
default:
|
||||
return nil, model.NewAppError("CreateGroup", "app.insert_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
return group, nil
|
||||
}
|
||||
|
||||
func (a *App) UpdateGroup(group *model.Group) (*model.Group, *model.AppError) {
|
||||
@@ -44,7 +101,20 @@ func (a *App) UpdateGroup(group *model.Group) (*model.Group, *model.AppError) {
|
||||
a.Publish(messageWs)
|
||||
}
|
||||
|
||||
return updatedGroup, err
|
||||
if err != nil {
|
||||
var nfErr *store.ErrNotFound
|
||||
var appErr *model.AppError
|
||||
switch {
|
||||
case errors.As(err, &appErr):
|
||||
return nil, appErr
|
||||
case errors.As(err, &nfErr):
|
||||
return nil, model.NewAppError("UpdateGroup", "app.group.no_rows", nil, nfErr.Error(), http.StatusNotFound)
|
||||
default:
|
||||
return nil, model.NewAppError("UpdateGroup", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
return updatedGroup, nil
|
||||
}
|
||||
|
||||
func (a *App) DeleteGroup(groupID string) (*model.Group, *model.AppError) {
|
||||
@@ -56,42 +126,88 @@ func (a *App) DeleteGroup(groupID string) (*model.Group, *model.AppError) {
|
||||
a.Publish(messageWs)
|
||||
}
|
||||
|
||||
return deletedGroup, err
|
||||
if err != nil {
|
||||
var nfErr *store.ErrNotFound
|
||||
switch {
|
||||
case errors.As(err, &nfErr):
|
||||
return nil, model.NewAppError("DeleteGroup", "app.group.no_rows", nil, nfErr.Error(), http.StatusNotFound)
|
||||
default:
|
||||
return nil, model.NewAppError("DeleteGroup", "app.update_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
return deletedGroup, nil
|
||||
}
|
||||
|
||||
func (a *App) GetGroupMemberCount(groupID string) (int64, *model.AppError) {
|
||||
return a.Srv().Store.Group().GetMemberCount(groupID)
|
||||
count, err := a.Srv().Store.Group().GetMemberCount(groupID)
|
||||
if err != nil {
|
||||
return 0, model.NewAppError("GetGroupMemberCount", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (a *App) GetGroupMemberUsers(groupID string) ([]*model.User, *model.AppError) {
|
||||
return a.Srv().Store.Group().GetMemberUsers(groupID)
|
||||
users, err := a.Srv().Store.Group().GetMemberUsers(groupID)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetGroupMemberUsers", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return users, nil
|
||||
}
|
||||
|
||||
func (a *App) GetGroupMemberUsersPage(groupID string, page int, perPage int) ([]*model.User, int, *model.AppError) {
|
||||
members, err := a.Srv().Store.Group().GetMemberUsersPage(groupID, page, perPage)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
return nil, 0, model.NewAppError("GetGroupMemberUsersPage", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
count, err := a.GetGroupMemberCount(groupID)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
count, appErr := a.GetGroupMemberCount(groupID)
|
||||
if appErr != nil {
|
||||
return nil, 0, appErr
|
||||
}
|
||||
return members, int(count), nil
|
||||
}
|
||||
|
||||
func (a *App) UpsertGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError) {
|
||||
return a.Srv().Store.Group().UpsertMember(groupID, userID)
|
||||
groupMember, err := a.Srv().Store.Group().UpsertMember(groupID, userID)
|
||||
if err != nil {
|
||||
var invErr *store.ErrInvalidInput
|
||||
var appErr *model.AppError
|
||||
switch {
|
||||
case errors.As(err, &appErr):
|
||||
return nil, appErr
|
||||
case errors.As(err, &invErr):
|
||||
return nil, model.NewAppError("UpsertGroupMember", "app.group.uniqueness_error", nil, invErr.Error(), http.StatusBadRequest)
|
||||
default:
|
||||
return nil, model.NewAppError("UpsertGroupMember", "app.update_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
return groupMember, nil
|
||||
}
|
||||
|
||||
func (a *App) DeleteGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError) {
|
||||
return a.Srv().Store.Group().DeleteMember(groupID, userID)
|
||||
groupMember, err := a.Srv().Store.Group().DeleteMember(groupID, userID)
|
||||
if err != nil {
|
||||
var nfErr *store.ErrNotFound
|
||||
switch {
|
||||
case errors.As(err, &nfErr):
|
||||
return nil, model.NewAppError("DeleteGroupMember", "app.group.no_rows", nil, nfErr.Error(), http.StatusNotFound)
|
||||
default:
|
||||
return nil, model.NewAppError("DeleteGroupMember", "app.update_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
return groupMember, nil
|
||||
}
|
||||
|
||||
func (a *App) UpsertGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError) {
|
||||
gs, err := a.Srv().Store.Group().GetGroupSyncable(groupSyncable.GroupId, groupSyncable.SyncableId, groupSyncable.Type)
|
||||
if err != nil && err.Id != "store.sql_group.no_rows" {
|
||||
return nil, err
|
||||
var notFoundErr *store.ErrNotFound
|
||||
if err != nil && !errors.As(err, ¬FoundErr) {
|
||||
return nil, model.NewAppError("UpsertGroupSyncable", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
// reject the syncable creation if the group isn't already associated to the parent team
|
||||
@@ -122,7 +238,7 @@ func (a *App) UpsertGroupSyncable(groupSyncable *model.GroupSyncable) (*model.Gr
|
||||
var teamGroups []*model.GroupWithSchemeAdmin
|
||||
teamGroups, err = a.Srv().Store.Group().GetGroupsByTeam(channel.TeamId, model.GroupSearchOpts{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, model.NewAppError("UpsertGroupSyncable", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
var permittedGroup bool
|
||||
for _, teamGroup := range teamGroups {
|
||||
@@ -132,12 +248,12 @@ func (a *App) UpsertGroupSyncable(groupSyncable *model.GroupSyncable) (*model.Gr
|
||||
}
|
||||
}
|
||||
if !permittedGroup {
|
||||
return nil, model.NewAppError("App.UpsertGroupSyncable", "group_not_associated_to_synced_team", nil, "", http.StatusBadRequest)
|
||||
return nil, model.NewAppError("UpsertGroupSyncable", "group_not_associated_to_synced_team", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
} else {
|
||||
_, err = a.UpsertGroupSyncable(model.NewGroupTeam(groupSyncable.GroupId, team.Id, groupSyncable.AutoAdd))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
_, appErr := a.UpsertGroupSyncable(model.NewGroupTeam(groupSyncable.GroupId, team.Id, groupSyncable.AutoAdd))
|
||||
if appErr != nil {
|
||||
return nil, appErr
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -145,12 +261,27 @@ func (a *App) UpsertGroupSyncable(groupSyncable *model.GroupSyncable) (*model.Gr
|
||||
if gs == nil {
|
||||
gs, err = a.Srv().Store.Group().CreateGroupSyncable(groupSyncable)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var nfErr *store.ErrNotFound
|
||||
var appErr *model.AppError
|
||||
switch {
|
||||
case errors.As(err, &appErr):
|
||||
return nil, appErr
|
||||
case errors.As(err, &nfErr):
|
||||
return nil, model.NewAppError("UpsertGroupSyncable", "store.sql_channel.get.existing.app_error", nil, nfErr.Error(), http.StatusNotFound)
|
||||
default:
|
||||
return nil, model.NewAppError("UpsertGroupSyncable", "app.insert_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
gs, err = a.Srv().Store.Group().UpdateGroupSyncable(groupSyncable)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var appErr *model.AppError
|
||||
switch {
|
||||
case errors.As(err, &appErr):
|
||||
return nil, appErr
|
||||
default:
|
||||
return nil, model.NewAppError("UpsertGroupSyncable", "app.update_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,24 +298,48 @@ func (a *App) UpsertGroupSyncable(groupSyncable *model.GroupSyncable) (*model.Gr
|
||||
}
|
||||
|
||||
func (a *App) GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError) {
|
||||
return a.Srv().Store.Group().GetGroupSyncable(groupID, syncableID, syncableType)
|
||||
group, err := a.Srv().Store.Group().GetGroupSyncable(groupID, syncableID, syncableType)
|
||||
if err != nil {
|
||||
var nfErr *store.ErrNotFound
|
||||
switch {
|
||||
case errors.As(err, &nfErr):
|
||||
return nil, model.NewAppError("GetGroupSyncable", "app.group.no_rows", nil, nfErr.Error(), http.StatusNotFound)
|
||||
default:
|
||||
return nil, model.NewAppError("GetGroupSyncable", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
return group, nil
|
||||
}
|
||||
|
||||
func (a *App) GetGroupSyncables(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, *model.AppError) {
|
||||
return a.Srv().Store.Group().GetAllGroupSyncablesByGroupId(groupID, syncableType)
|
||||
groups, err := a.Srv().Store.Group().GetAllGroupSyncablesByGroupId(groupID, syncableType)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetGroupSyncables", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return groups, nil
|
||||
}
|
||||
|
||||
func (a *App) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError) {
|
||||
var gs *model.GroupSyncable
|
||||
var err *model.AppError
|
||||
|
||||
if groupSyncable.DeleteAt == 0 {
|
||||
// updating a *deleted* GroupSyncable, so no need to ensure the GroupTeam is present (as done in the upsert)
|
||||
gs, err = a.Srv().Store.Group().UpdateGroupSyncable(groupSyncable)
|
||||
} else {
|
||||
// do an upsert to ensure that there's an associated GroupTeam
|
||||
gs, err = a.UpsertGroupSyncable(groupSyncable)
|
||||
gs, err := a.Srv().Store.Group().UpdateGroupSyncable(groupSyncable)
|
||||
if err != nil {
|
||||
var appErr *model.AppError
|
||||
switch {
|
||||
case errors.As(err, &appErr):
|
||||
return nil, appErr
|
||||
default:
|
||||
return nil, model.NewAppError("UpdateGroupSyncable", "app.update_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
return gs, nil
|
||||
}
|
||||
|
||||
// do an upsert to ensure that there's an associated GroupTeam
|
||||
gs, err := a.UpsertGroupSyncable(groupSyncable)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -195,20 +350,38 @@ func (a *App) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.Gr
|
||||
func (a *App) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError) {
|
||||
gs, err := a.Srv().Store.Group().DeleteGroupSyncable(groupID, syncableID, syncableType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var invErr *store.ErrInvalidInput
|
||||
var nfErr *store.ErrNotFound
|
||||
switch {
|
||||
case errors.As(err, &nfErr):
|
||||
return nil, model.NewAppError("DeleteGroupSyncable", "app.group.no_rows", nil, nfErr.Error(), http.StatusNotFound)
|
||||
case errors.As(err, &invErr):
|
||||
return nil, model.NewAppError("DeleteGroupSyncable", "app.group.group_syncable_already_deleted", nil, invErr.Error(), http.StatusBadRequest)
|
||||
default:
|
||||
return nil, model.NewAppError("DeleteGroupSyncable", "app.update_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
// if a GroupTeam is being deleted delete all associated GroupChannels
|
||||
if gs.Type == model.GroupSyncableTypeTeam {
|
||||
allGroupChannels, err := a.Srv().Store.Group().GetAllGroupSyncablesByGroupId(gs.GroupId, model.GroupSyncableTypeChannel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, model.NewAppError("DeleteGroupSyncable", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
for _, groupChannel := range allGroupChannels {
|
||||
_, err = a.Srv().Store.Group().DeleteGroupSyncable(groupChannel.GroupId, groupChannel.SyncableId, groupChannel.Type)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var invErr *store.ErrInvalidInput
|
||||
var nfErr *store.ErrNotFound
|
||||
switch {
|
||||
case errors.As(err, &nfErr):
|
||||
return nil, model.NewAppError("DeleteGroupSyncable", "app.group.no_rows", nil, nfErr.Error(), http.StatusNotFound)
|
||||
case errors.As(err, &invErr):
|
||||
return nil, model.NewAppError("DeleteGroupSyncable", "app.group.group_syncable_already_deleted", nil, invErr.Error(), http.StatusBadRequest)
|
||||
default:
|
||||
return nil, model.NewAppError("DeleteGroupSyncable", "app.update_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,30 +400,50 @@ func (a *App) DeleteGroupSyncable(groupID string, syncableID string, syncableTyp
|
||||
}
|
||||
|
||||
func (a *App) TeamMembersToAdd(since int64, teamID *string) ([]*model.UserTeamIDPair, *model.AppError) {
|
||||
return a.Srv().Store.Group().TeamMembersToAdd(since, teamID)
|
||||
userTeams, err := a.Srv().Store.Group().TeamMembersToAdd(since, teamID)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("TeamMembersToAdd", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return userTeams, nil
|
||||
}
|
||||
|
||||
func (a *App) ChannelMembersToAdd(since int64, channelID *string) ([]*model.UserChannelIDPair, *model.AppError) {
|
||||
return a.Srv().Store.Group().ChannelMembersToAdd(since, channelID)
|
||||
userChannels, err := a.Srv().Store.Group().ChannelMembersToAdd(since, channelID)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("ChannelMembersToAdd", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return userChannels, nil
|
||||
}
|
||||
|
||||
func (a *App) TeamMembersToRemove(teamID *string) ([]*model.TeamMember, *model.AppError) {
|
||||
return a.Srv().Store.Group().TeamMembersToRemove(teamID)
|
||||
teamMembers, err := a.Srv().Store.Group().TeamMembersToRemove(teamID)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("TeamMembersToRemove", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return teamMembers, nil
|
||||
}
|
||||
|
||||
func (a *App) ChannelMembersToRemove(teamID *string) ([]*model.ChannelMember, *model.AppError) {
|
||||
return a.Srv().Store.Group().ChannelMembersToRemove(teamID)
|
||||
channelMembers, err := a.Srv().Store.Group().ChannelMembersToRemove(teamID)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("ChannelMembersToRemove", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return channelMembers, nil
|
||||
}
|
||||
|
||||
func (a *App) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.AppError) {
|
||||
groups, err := a.Srv().Store.Group().GetGroupsByChannel(channelId, opts)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
return nil, 0, model.NewAppError("GetGroupsByChannel", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
count, err := a.Srv().Store.Group().CountGroupsByChannel(channelId, opts)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
return nil, 0, model.NewAppError("GetGroupsByChannel", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return groups, int(count), nil
|
||||
@@ -260,12 +453,12 @@ func (a *App) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) (
|
||||
func (a *App) GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.AppError) {
|
||||
groups, err := a.Srv().Store.Group().GetGroupsByTeam(teamId, opts)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
return nil, 0, model.NewAppError("GetGroupsByTeam", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
count, err := a.Srv().Store.Group().CountGroupsByTeam(teamId, opts)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
return nil, 0, model.NewAppError("GetGroupsByTeam", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return groups, int(count), nil
|
||||
@@ -274,14 +467,19 @@ func (a *App) GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) ([]*mod
|
||||
func (a *App) GetGroupsAssociatedToChannelsByTeam(teamId string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, *model.AppError) {
|
||||
groupsAssociatedByChannelId, err := a.Srv().Store.Group().GetGroupsAssociatedToChannelsByTeam(teamId, opts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, model.NewAppError("GetGroupsAssociatedToChannelsByTeam", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return groupsAssociatedByChannelId, nil
|
||||
}
|
||||
|
||||
func (a *App) GetGroups(page, perPage int, opts model.GroupSearchOpts) ([]*model.Group, *model.AppError) {
|
||||
return a.Srv().Store.Group().GetGroups(page, perPage, opts)
|
||||
groups, err := a.Srv().Store.Group().GetGroups(page, perPage, opts)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetGroups", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return groups, nil
|
||||
}
|
||||
|
||||
// TeamMembersMinusGroupMembers returns the set of users on the given team minus the set of users in the given
|
||||
@@ -292,7 +490,7 @@ func (a *App) GetGroups(page, perPage int, opts model.GroupSearchOpts) ([]*model
|
||||
func (a *App) TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, int64, *model.AppError) {
|
||||
users, err := a.Srv().Store.Group().TeamMembersMinusGroupMembers(teamID, groupIDs, page, perPage)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
return nil, 0, model.NewAppError("TeamMembersMinusGroupMembers", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
// parse all group ids of all users
|
||||
@@ -310,9 +508,9 @@ func (a *App) TeamMembersMinusGroupMembers(teamID string, groupIDs []string, pag
|
||||
}
|
||||
|
||||
// retrieve groups from DB
|
||||
groups, err := a.GetGroupsByIDs(allUsersGroupIDSlice)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
groups, appErr := a.GetGroupsByIDs(allUsersGroupIDSlice)
|
||||
if appErr != nil {
|
||||
return nil, 0, appErr
|
||||
}
|
||||
|
||||
// map groups by id
|
||||
@@ -334,13 +532,18 @@ func (a *App) TeamMembersMinusGroupMembers(teamID string, groupIDs []string, pag
|
||||
|
||||
totalCount, err := a.Srv().Store.Group().CountTeamMembersMinusGroupMembers(teamID, groupIDs)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
return nil, 0, model.NewAppError("TeamMembersMinusGroupMembers", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
return users, totalCount, nil
|
||||
}
|
||||
|
||||
func (a *App) GetGroupsByIDs(groupIDs []string) ([]*model.Group, *model.AppError) {
|
||||
return a.Srv().Store.Group().GetByIDs(groupIDs)
|
||||
groups, err := a.Srv().Store.Group().GetByIDs(groupIDs)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("GetGroupsByIDs", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return groups, nil
|
||||
}
|
||||
|
||||
// ChannelMembersMinusGroupMembers returns the set of users in the given channel minus the set of users in the given
|
||||
@@ -351,7 +554,7 @@ func (a *App) GetGroupsByIDs(groupIDs []string) ([]*model.Group, *model.AppError
|
||||
func (a *App) ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, int64, *model.AppError) {
|
||||
users, err := a.Srv().Store.Group().ChannelMembersMinusGroupMembers(channelID, groupIDs, page, perPage)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
return nil, 0, model.NewAppError("ChannelMembersMinusGroupMembers", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
// parse all group ids of all users
|
||||
@@ -369,9 +572,9 @@ func (a *App) ChannelMembersMinusGroupMembers(channelID string, groupIDs []strin
|
||||
}
|
||||
|
||||
// retrieve groups from DB
|
||||
groups, err := a.GetGroupsByIDs(allUsersGroupIDSlice)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
groups, appErr := a.GetGroupsByIDs(allUsersGroupIDSlice)
|
||||
if appErr != nil {
|
||||
return nil, 0, appErr
|
||||
}
|
||||
|
||||
// map groups by id
|
||||
@@ -393,7 +596,7 @@ func (a *App) ChannelMembersMinusGroupMembers(channelID string, groupIDs []strin
|
||||
|
||||
totalCount, err := a.Srv().Store.Group().CountChannelMembersMinusGroupMembers(channelID, groupIDs)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
return nil, 0, model.NewAppError("ChannelMembersMinusGroupMembers", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
return users, totalCount, nil
|
||||
}
|
||||
@@ -403,7 +606,7 @@ func (a *App) ChannelMembersMinusGroupMembers(channelID string, groupIDs []strin
|
||||
func (a *App) UserIsInAdminRoleGroup(userID, syncableID string, syncableType model.GroupSyncableType) (bool, *model.AppError) {
|
||||
groupIDs, err := a.Srv().Store.Group().AdminRoleGroupsForSyncableMember(userID, syncableID, syncableType)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return false, model.NewAppError("UserIsInAdminRoleGroup", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
if len(groupIDs) == 0 {
|
||||
|
||||
@@ -789,7 +789,7 @@ func (a *App) allowGroupMentions(post *model.Post) bool {
|
||||
|
||||
// getGroupsAllowedForReferenceInChannel returns a map of groups allowed for reference in a given channel and team.
|
||||
func (a *App) getGroupsAllowedForReferenceInChannel(channel *model.Channel, team *model.Team) (map[string]*model.Group, *model.AppError) {
|
||||
var err *model.AppError
|
||||
var err error
|
||||
groupsMap := make(map[string]*model.Group)
|
||||
opts := model.GroupSearchOpts{FilterAllowReference: true}
|
||||
|
||||
@@ -801,7 +801,7 @@ func (a *App) getGroupsAllowedForReferenceInChannel(channel *model.Channel, team
|
||||
groups, err = a.Srv().Store.Group().GetGroupsByTeam(team.Id, opts)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, model.NewAppError("getGroupsAllowedForReferenceInChannel", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
for _, group := range groups {
|
||||
if group.Group.Name != nil {
|
||||
@@ -813,7 +813,7 @@ func (a *App) getGroupsAllowedForReferenceInChannel(channel *model.Channel, team
|
||||
|
||||
groups, err := a.Srv().Store.Group().GetGroups(0, 0, opts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, model.NewAppError("getGroupsAllowedForReferenceInChannel", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
for _, group := range groups {
|
||||
if group.Name != nil {
|
||||
@@ -845,7 +845,7 @@ func (a *App) getMentionKeywordsInChannel(profiles map[string]*model.User, allow
|
||||
// insertGroupMentions adds group members in the channel to Mentions, adds group members not in the channel to OtherPotentialMentions
|
||||
// returns false if no group members present in the team that the channel belongs to
|
||||
func (a *App) insertGroupMentions(group *model.Group, channel *model.Channel, profileMap map[string]*model.User, mentions *ExplicitMentions) (bool, *model.AppError) {
|
||||
var err *model.AppError
|
||||
var err error
|
||||
var groupMembers []*model.User
|
||||
outOfChannelGroupMembers := []*model.User{}
|
||||
isGroupOrDirect := channel.IsGroupOrDirect()
|
||||
@@ -857,7 +857,7 @@ func (a *App) insertGroupMentions(group *model.Group, channel *model.Channel, pr
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return false, err
|
||||
return false, model.NewAppError("insertGroupMentions", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
if mentions.Mentions == nil {
|
||||
|
||||
@@ -195,7 +195,7 @@ func (a *App) deleteGroupConstrainedChannelMemberships(channelID *string) error
|
||||
func (a *App) SyncSyncableRoles(syncableID string, syncableType model.GroupSyncableType) *model.AppError {
|
||||
permittedAdmins, err := a.Srv().Store.Group().PermittedSyncableAdmins(syncableID, syncableType)
|
||||
if err != nil {
|
||||
return err
|
||||
return model.NewAppError("SyncSyncableRoles", "app.select_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
a.Log().Info(
|
||||
@@ -208,14 +208,13 @@ func (a *App) SyncSyncableRoles(syncableID string, syncableType model.GroupSynca
|
||||
case model.GroupSyncableTypeTeam:
|
||||
nErr := a.Srv().Store.Team().UpdateMembersRole(syncableID, permittedAdmins)
|
||||
if nErr != nil {
|
||||
// TODO: Should we change the key "store.update_error" to "app.update_error"? It is very general and changing it now will modify lots of files
|
||||
return model.NewAppError("App.SyncSyncableRoles", "store.update_error", nil, nErr.Error(), http.StatusInternalServerError)
|
||||
return model.NewAppError("App.SyncSyncableRoles", "app.update_error", nil, nErr.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
return nil
|
||||
case model.GroupSyncableTypeChannel:
|
||||
nErr := a.Srv().Store.Channel().UpdateMembersRole(syncableID, permittedAdmins)
|
||||
if nErr != nil {
|
||||
return model.NewAppError("App.SyncSyncableRoles", "store.update_error", nil, nErr.Error(), http.StatusInternalServerError)
|
||||
return model.NewAppError("App.SyncSyncableRoles", "app.update_error", nil, nErr.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
return nil
|
||||
default:
|
||||
|
||||
@@ -1655,7 +1655,7 @@ func (a *App) PermanentDeleteUser(user *model.User) *model.AppError {
|
||||
}
|
||||
|
||||
if err := a.Srv().Store.Group().PermanentDeleteMembersByUser(user.Id); err != nil {
|
||||
return err
|
||||
return model.NewAppError("PermanentDeleteUser", "app.group.permanent_delete_members_by_user.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
if err := a.Srv().Store.Post().PermanentDeleteByUser(user.Id); err != nil {
|
||||
|
||||
88
i18n/en.json
88
i18n/en.json
@@ -4070,6 +4070,26 @@
|
||||
"id": "app.file_info.save.app_error",
|
||||
"translation": "Unable to save the file info."
|
||||
},
|
||||
{
|
||||
"id": "app.group.group_syncable_already_deleted",
|
||||
"translation": "group syncable was already deleted"
|
||||
},
|
||||
{
|
||||
"id": "app.group.id.app_error",
|
||||
"translation": "invalid id property for group."
|
||||
},
|
||||
{
|
||||
"id": "app.group.no_rows",
|
||||
"translation": "no matching group found"
|
||||
},
|
||||
{
|
||||
"id": "app.group.permanent_delete_members_by_user.app_error",
|
||||
"translation": "Unable to remove the group member with UserID \"{{.UserId}}\"."
|
||||
},
|
||||
{
|
||||
"id": "app.group.uniqueness_error",
|
||||
"translation": "group member already exists"
|
||||
},
|
||||
{
|
||||
"id": "app.import.attachment.bad_file.error",
|
||||
"translation": "Error reading the file at: \"{{.FilePath}}\""
|
||||
@@ -4630,6 +4650,10 @@
|
||||
"id": "app.import.validate_user_teams_import_data.team_name_missing.error",
|
||||
"translation": "Team name missing from User's Team Membership."
|
||||
},
|
||||
{
|
||||
"id": "app.insert_error",
|
||||
"translation": "insert error"
|
||||
},
|
||||
{
|
||||
"id": "app.job.download_export_results_not_enabled",
|
||||
"translation": "DownloadExportResults in config.json is false. Please set this to true to download the results of this job."
|
||||
@@ -5154,6 +5178,10 @@
|
||||
"id": "app.schemes.is_phase_2_migration_completed.not_completed.app_error",
|
||||
"translation": "This API endpoint is not accessible as required migrations have not yet completed."
|
||||
},
|
||||
{
|
||||
"id": "app.select_error",
|
||||
"translation": "select error"
|
||||
},
|
||||
{
|
||||
"id": "app.session.analytics_session_count.app_error",
|
||||
"translation": "Unable to count the sessions."
|
||||
@@ -5430,6 +5458,10 @@
|
||||
"id": "app.terms_of_service.get.no_rows.app_error",
|
||||
"translation": "No terms of service found."
|
||||
},
|
||||
{
|
||||
"id": "app.update_error",
|
||||
"translation": "update error"
|
||||
},
|
||||
{
|
||||
"id": "app.upload.create.cannot_upload_to_deleted_channel.app_error",
|
||||
"translation": "Cannot upload to a deleted channel."
|
||||
@@ -7378,10 +7410,6 @@
|
||||
"id": "model.group.create_at.app_error",
|
||||
"translation": "invalid create at property for group."
|
||||
},
|
||||
{
|
||||
"id": "model.group.delete_at.app_error",
|
||||
"translation": "invalid delete at property for group."
|
||||
},
|
||||
{
|
||||
"id": "model.group.description.app_error",
|
||||
"translation": "invalid description property for group."
|
||||
@@ -7390,10 +7418,6 @@
|
||||
"id": "model.group.display_name.app_error",
|
||||
"translation": "invalid display name property for group."
|
||||
},
|
||||
{
|
||||
"id": "model.group.id.app_error",
|
||||
"translation": "invalid id property for group."
|
||||
},
|
||||
{
|
||||
"id": "model.group.name.app_error",
|
||||
"translation": "invalid name property for group."
|
||||
@@ -7434,10 +7458,6 @@
|
||||
"id": "model.group_syncable.syncable_id.app_error",
|
||||
"translation": "invalid syncable id for group syncable."
|
||||
},
|
||||
{
|
||||
"id": "model.group_syncable.type.app_error",
|
||||
"translation": "invalid type property for group syncable."
|
||||
},
|
||||
{
|
||||
"id": "model.guest.is_valid.channel.app_error",
|
||||
"translation": "Invalid channel."
|
||||
@@ -8062,14 +8082,6 @@
|
||||
"id": "searchengine.bleve.disabled.error",
|
||||
"translation": "Error purging Bleve indexes: engine is disabled"
|
||||
},
|
||||
{
|
||||
"id": "store.insert_error",
|
||||
"translation": "insert error"
|
||||
},
|
||||
{
|
||||
"id": "store.select_error",
|
||||
"translation": "select error"
|
||||
},
|
||||
{
|
||||
"id": "store.sql.convert_string_array",
|
||||
"translation": "FromDb: Unable to convert StringArray to *string"
|
||||
@@ -8090,10 +8102,6 @@
|
||||
"id": "store.sql_channel.get.existing.app_error",
|
||||
"translation": "Unable to find the existing channel."
|
||||
},
|
||||
{
|
||||
"id": "store.sql_channel.get.find.app_error",
|
||||
"translation": "We encountered an error finding the channel."
|
||||
},
|
||||
{
|
||||
"id": "store.sql_channel.save.archived_channel.app_error",
|
||||
"translation": "You can not modify an archived channel."
|
||||
@@ -8130,34 +8138,6 @@
|
||||
"id": "store.sql_command.update.missing.app_error",
|
||||
"translation": "Command does not exist."
|
||||
},
|
||||
{
|
||||
"id": "store.sql_group.app_error",
|
||||
"translation": "failed to build query."
|
||||
},
|
||||
{
|
||||
"id": "store.sql_group.group_syncable_already_deleted",
|
||||
"translation": "group syncable was already deleted"
|
||||
},
|
||||
{
|
||||
"id": "store.sql_group.more_than_one_row_changed",
|
||||
"translation": "More than one row changed."
|
||||
},
|
||||
{
|
||||
"id": "store.sql_group.no_rows",
|
||||
"translation": "no matching group found"
|
||||
},
|
||||
{
|
||||
"id": "store.sql_group.permanent_delete_members_by_user.app_error",
|
||||
"translation": "Unable to remove the group member with UserID \"{{.UserId}}\"."
|
||||
},
|
||||
{
|
||||
"id": "store.sql_group.unique_constraint",
|
||||
"translation": "a group with that name already exists"
|
||||
},
|
||||
{
|
||||
"id": "store.sql_group.uniqueness_error",
|
||||
"translation": "group member already exists"
|
||||
},
|
||||
{
|
||||
"id": "store.sql_post.search.disabled",
|
||||
"translation": "Searching has been disabled on this server. Please contact your System Administrator."
|
||||
@@ -8174,10 +8154,6 @@
|
||||
"id": "store.sql_user.update.email_taken.app_error",
|
||||
"translation": "This email is already taken. Please choose another."
|
||||
},
|
||||
{
|
||||
"id": "store.update_error",
|
||||
"translation": "update error"
|
||||
},
|
||||
{
|
||||
"id": "system.message.name",
|
||||
"translation": "System"
|
||||
|
||||
@@ -157,7 +157,7 @@ func (group *Group) requiresRemoteId() bool {
|
||||
|
||||
func (group *Group) IsValidForUpdate() *AppError {
|
||||
if !IsValidId(group.Id) {
|
||||
return NewAppError("Group.IsValidForUpdate", "model.group.id.app_error", nil, "", http.StatusBadRequest)
|
||||
return NewAppError("Group.IsValidForUpdate", "app.group.id.app_error", nil, "", http.StatusBadRequest)
|
||||
}
|
||||
if group.CreateAt == 0 {
|
||||
return NewAppError("Group.IsValidForUpdate", "model.group.create_at.app_error", nil, "", http.StatusBadRequest)
|
||||
|
||||
@@ -3175,7 +3175,7 @@ func (s *OpenTracingLayerFileInfoStore) Upsert(info *model.FileInfo) (*model.Fil
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) AdminRoleGroupsForSyncableMember(userID string, syncableID string, syncableType model.GroupSyncableType) ([]string, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) AdminRoleGroupsForSyncableMember(userID string, syncableID string, syncableType model.GroupSyncableType) ([]string, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.AdminRoleGroupsForSyncableMember")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3193,7 +3193,7 @@ func (s *OpenTracingLayerGroupStore) AdminRoleGroupsForSyncableMember(userID str
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.ChannelMembersMinusGroupMembers")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3211,7 +3211,7 @@ func (s *OpenTracingLayerGroupStore) ChannelMembersMinusGroupMembers(channelID s
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) ChannelMembersToAdd(since int64, channelID *string) ([]*model.UserChannelIDPair, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) ChannelMembersToAdd(since int64, channelID *string) ([]*model.UserChannelIDPair, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.ChannelMembersToAdd")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3229,7 +3229,7 @@ func (s *OpenTracingLayerGroupStore) ChannelMembersToAdd(since int64, channelID
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) ChannelMembersToRemove(channelID *string) ([]*model.ChannelMember, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) ChannelMembersToRemove(channelID *string) ([]*model.ChannelMember, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.ChannelMembersToRemove")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3247,7 +3247,7 @@ func (s *OpenTracingLayerGroupStore) ChannelMembersToRemove(channelID *string) (
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) CountChannelMembersMinusGroupMembers(channelID string, groupIDs []string) (int64, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) CountChannelMembersMinusGroupMembers(channelID string, groupIDs []string) (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.CountChannelMembersMinusGroupMembers")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3265,7 +3265,7 @@ func (s *OpenTracingLayerGroupStore) CountChannelMembersMinusGroupMembers(channe
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) CountGroupsByChannel(channelId string, opts model.GroupSearchOpts) (int64, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) CountGroupsByChannel(channelId string, opts model.GroupSearchOpts) (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.CountGroupsByChannel")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3283,7 +3283,7 @@ func (s *OpenTracingLayerGroupStore) CountGroupsByChannel(channelId string, opts
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) CountGroupsByTeam(teamId string, opts model.GroupSearchOpts) (int64, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) CountGroupsByTeam(teamId string, opts model.GroupSearchOpts) (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.CountGroupsByTeam")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3301,7 +3301,7 @@ func (s *OpenTracingLayerGroupStore) CountGroupsByTeam(teamId string, opts model
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) CountTeamMembersMinusGroupMembers(teamID string, groupIDs []string) (int64, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) CountTeamMembersMinusGroupMembers(teamID string, groupIDs []string) (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.CountTeamMembersMinusGroupMembers")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3319,7 +3319,7 @@ func (s *OpenTracingLayerGroupStore) CountTeamMembersMinusGroupMembers(teamID st
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) Create(group *model.Group) (*model.Group, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) Create(group *model.Group) (*model.Group, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.Create")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3337,7 +3337,7 @@ func (s *OpenTracingLayerGroupStore) Create(group *model.Group) (*model.Group, *
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) CreateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) CreateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.CreateGroupSyncable")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3355,7 +3355,7 @@ func (s *OpenTracingLayerGroupStore) CreateGroupSyncable(groupSyncable *model.Gr
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) Delete(groupID string) (*model.Group, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) Delete(groupID string) (*model.Group, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.Delete")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3373,7 +3373,7 @@ func (s *OpenTracingLayerGroupStore) Delete(groupID string) (*model.Group, *mode
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.DeleteGroupSyncable")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3391,7 +3391,7 @@ func (s *OpenTracingLayerGroupStore) DeleteGroupSyncable(groupID string, syncabl
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) DeleteMember(groupID string, userID string) (*model.GroupMember, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) DeleteMember(groupID string, userID string) (*model.GroupMember, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.DeleteMember")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3409,7 +3409,7 @@ func (s *OpenTracingLayerGroupStore) DeleteMember(groupID string, userID string)
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) DistinctGroupMemberCount() (int64, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) DistinctGroupMemberCount() (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.DistinctGroupMemberCount")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3427,7 +3427,7 @@ func (s *OpenTracingLayerGroupStore) DistinctGroupMemberCount() (int64, *model.A
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) Get(groupID string) (*model.Group, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) Get(groupID string) (*model.Group, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.Get")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3445,7 +3445,7 @@ func (s *OpenTracingLayerGroupStore) Get(groupID string) (*model.Group, *model.A
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GetAllBySource(groupSource model.GroupSource) ([]*model.Group, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GetAllBySource(groupSource model.GroupSource) ([]*model.Group, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetAllBySource")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3463,7 +3463,7 @@ func (s *OpenTracingLayerGroupStore) GetAllBySource(groupSource model.GroupSourc
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GetAllGroupSyncablesByGroupId(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GetAllGroupSyncablesByGroupId(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetAllGroupSyncablesByGroupId")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3481,7 +3481,7 @@ func (s *OpenTracingLayerGroupStore) GetAllGroupSyncablesByGroupId(groupID strin
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GetByIDs(groupIDs []string) ([]*model.Group, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GetByIDs(groupIDs []string) ([]*model.Group, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetByIDs")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3499,7 +3499,7 @@ func (s *OpenTracingLayerGroupStore) GetByIDs(groupIDs []string) ([]*model.Group
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GetByName(name string, opts model.GroupSearchOpts) (*model.Group, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GetByName(name string, opts model.GroupSearchOpts) (*model.Group, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetByName")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3517,7 +3517,7 @@ func (s *OpenTracingLayerGroupStore) GetByName(name string, opts model.GroupSear
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GetByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GetByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetByRemoteID")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3535,7 +3535,7 @@ func (s *OpenTracingLayerGroupStore) GetByRemoteID(remoteID string, groupSource
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GetByUser(userId string) ([]*model.Group, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GetByUser(userId string) ([]*model.Group, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetByUser")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3553,7 +3553,7 @@ func (s *OpenTracingLayerGroupStore) GetByUser(userId string) ([]*model.Group, *
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetGroupSyncable")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3571,7 +3571,7 @@ func (s *OpenTracingLayerGroupStore) GetGroupSyncable(groupID string, syncableID
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GetGroups(page int, perPage int, opts model.GroupSearchOpts) ([]*model.Group, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GetGroups(page int, perPage int, opts model.GroupSearchOpts) ([]*model.Group, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetGroups")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3589,7 +3589,7 @@ func (s *OpenTracingLayerGroupStore) GetGroups(page int, perPage int, opts model
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GetGroupsAssociatedToChannelsByTeam(teamId string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GetGroupsAssociatedToChannelsByTeam(teamId string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetGroupsAssociatedToChannelsByTeam")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3607,7 +3607,7 @@ func (s *OpenTracingLayerGroupStore) GetGroupsAssociatedToChannelsByTeam(teamId
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetGroupsByChannel")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3625,7 +3625,7 @@ func (s *OpenTracingLayerGroupStore) GetGroupsByChannel(channelId string, opts m
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetGroupsByTeam")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3643,7 +3643,7 @@ func (s *OpenTracingLayerGroupStore) GetGroupsByTeam(teamId string, opts model.G
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GetMemberCount(groupID string) (int64, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GetMemberCount(groupID string) (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetMemberCount")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3661,7 +3661,7 @@ func (s *OpenTracingLayerGroupStore) GetMemberCount(groupID string) (int64, *mod
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GetMemberUsers(groupID string) ([]*model.User, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GetMemberUsers(groupID string) ([]*model.User, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetMemberUsers")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3679,7 +3679,7 @@ func (s *OpenTracingLayerGroupStore) GetMemberUsers(groupID string) ([]*model.Us
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GetMemberUsersInTeam(groupID string, teamID string) ([]*model.User, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GetMemberUsersInTeam(groupID string, teamID string) ([]*model.User, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetMemberUsersInTeam")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3697,7 +3697,7 @@ func (s *OpenTracingLayerGroupStore) GetMemberUsersInTeam(groupID string, teamID
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GetMemberUsersNotInChannel(groupID string, channelID string) ([]*model.User, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GetMemberUsersNotInChannel(groupID string, channelID string) ([]*model.User, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetMemberUsersNotInChannel")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3715,7 +3715,7 @@ func (s *OpenTracingLayerGroupStore) GetMemberUsersNotInChannel(groupID string,
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GetMemberUsersPage(groupID string, page int, perPage int) ([]*model.User, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GetMemberUsersPage(groupID string, page int, perPage int) ([]*model.User, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GetMemberUsersPage")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3733,7 +3733,7 @@ func (s *OpenTracingLayerGroupStore) GetMemberUsersPage(groupID string, page int
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GroupChannelCount() (int64, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GroupChannelCount() (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GroupChannelCount")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3751,7 +3751,7 @@ func (s *OpenTracingLayerGroupStore) GroupChannelCount() (int64, *model.AppError
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GroupCount() (int64, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GroupCount() (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GroupCount")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3769,7 +3769,7 @@ func (s *OpenTracingLayerGroupStore) GroupCount() (int64, *model.AppError) {
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GroupCountWithAllowReference() (int64, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GroupCountWithAllowReference() (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GroupCountWithAllowReference")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3787,7 +3787,7 @@ func (s *OpenTracingLayerGroupStore) GroupCountWithAllowReference() (int64, *mod
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GroupMemberCount() (int64, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GroupMemberCount() (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GroupMemberCount")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3805,7 +3805,7 @@ func (s *OpenTracingLayerGroupStore) GroupMemberCount() (int64, *model.AppError)
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) GroupTeamCount() (int64, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) GroupTeamCount() (int64, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.GroupTeamCount")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3823,7 +3823,7 @@ func (s *OpenTracingLayerGroupStore) GroupTeamCount() (int64, *model.AppError) {
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) PermanentDeleteMembersByUser(userId string) *model.AppError {
|
||||
func (s *OpenTracingLayerGroupStore) PermanentDeleteMembersByUser(userId string) error {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.PermanentDeleteMembersByUser")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3841,7 +3841,7 @@ func (s *OpenTracingLayerGroupStore) PermanentDeleteMembersByUser(userId string)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) PermittedSyncableAdmins(syncableID string, syncableType model.GroupSyncableType) ([]string, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) PermittedSyncableAdmins(syncableID string, syncableType model.GroupSyncableType) ([]string, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.PermittedSyncableAdmins")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3859,7 +3859,7 @@ func (s *OpenTracingLayerGroupStore) PermittedSyncableAdmins(syncableID string,
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.TeamMembersMinusGroupMembers")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3877,7 +3877,7 @@ func (s *OpenTracingLayerGroupStore) TeamMembersMinusGroupMembers(teamID string,
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) TeamMembersToAdd(since int64, teamID *string) ([]*model.UserTeamIDPair, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) TeamMembersToAdd(since int64, teamID *string) ([]*model.UserTeamIDPair, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.TeamMembersToAdd")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3895,7 +3895,7 @@ func (s *OpenTracingLayerGroupStore) TeamMembersToAdd(since int64, teamID *strin
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) TeamMembersToRemove(teamID *string) ([]*model.TeamMember, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) TeamMembersToRemove(teamID *string) ([]*model.TeamMember, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.TeamMembersToRemove")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3913,7 +3913,7 @@ func (s *OpenTracingLayerGroupStore) TeamMembersToRemove(teamID *string) ([]*mod
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) Update(group *model.Group) (*model.Group, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) Update(group *model.Group) (*model.Group, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.Update")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3931,7 +3931,7 @@ func (s *OpenTracingLayerGroupStore) Update(group *model.Group) (*model.Group, *
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.UpdateGroupSyncable")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
@@ -3949,7 +3949,7 @@ func (s *OpenTracingLayerGroupStore) UpdateGroupSyncable(groupSyncable *model.Gr
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *OpenTracingLayerGroupStore) UpsertMember(groupID string, userID string) (*model.GroupMember, *model.AppError) {
|
||||
func (s *OpenTracingLayerGroupStore) UpsertMember(groupID string, userID string) (*model.GroupMember, error) {
|
||||
origCtx := s.Root.Store.Context()
|
||||
span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "GroupStore.UpsertMember")
|
||||
s.Root.Store.SetContext(newCtx)
|
||||
|
||||
@@ -3396,267 +3396,883 @@ func (s *RetryLayerFileInfoStore) Upsert(info *model.FileInfo) (*model.FileInfo,
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) AdminRoleGroupsForSyncableMember(userID string, syncableID string, syncableType model.GroupSyncableType) ([]string, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) AdminRoleGroupsForSyncableMember(userID string, syncableID string, syncableType model.GroupSyncableType) ([]string, error) {
|
||||
|
||||
return s.GroupStore.AdminRoleGroupsForSyncableMember(userID, syncableID, syncableType)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.AdminRoleGroupsForSyncableMember(userID, syncableID, syncableType)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, error) {
|
||||
|
||||
return s.GroupStore.ChannelMembersMinusGroupMembers(channelID, groupIDs, page, perPage)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.ChannelMembersMinusGroupMembers(channelID, groupIDs, page, perPage)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) ChannelMembersToAdd(since int64, channelID *string) ([]*model.UserChannelIDPair, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) ChannelMembersToAdd(since int64, channelID *string) ([]*model.UserChannelIDPair, error) {
|
||||
|
||||
return s.GroupStore.ChannelMembersToAdd(since, channelID)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.ChannelMembersToAdd(since, channelID)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) ChannelMembersToRemove(channelID *string) ([]*model.ChannelMember, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) ChannelMembersToRemove(channelID *string) ([]*model.ChannelMember, error) {
|
||||
|
||||
return s.GroupStore.ChannelMembersToRemove(channelID)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.ChannelMembersToRemove(channelID)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) CountChannelMembersMinusGroupMembers(channelID string, groupIDs []string) (int64, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) CountChannelMembersMinusGroupMembers(channelID string, groupIDs []string) (int64, error) {
|
||||
|
||||
return s.GroupStore.CountChannelMembersMinusGroupMembers(channelID, groupIDs)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.CountChannelMembersMinusGroupMembers(channelID, groupIDs)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) CountGroupsByChannel(channelId string, opts model.GroupSearchOpts) (int64, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) CountGroupsByChannel(channelId string, opts model.GroupSearchOpts) (int64, error) {
|
||||
|
||||
return s.GroupStore.CountGroupsByChannel(channelId, opts)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.CountGroupsByChannel(channelId, opts)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) CountGroupsByTeam(teamId string, opts model.GroupSearchOpts) (int64, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) CountGroupsByTeam(teamId string, opts model.GroupSearchOpts) (int64, error) {
|
||||
|
||||
return s.GroupStore.CountGroupsByTeam(teamId, opts)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.CountGroupsByTeam(teamId, opts)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) CountTeamMembersMinusGroupMembers(teamID string, groupIDs []string) (int64, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) CountTeamMembersMinusGroupMembers(teamID string, groupIDs []string) (int64, error) {
|
||||
|
||||
return s.GroupStore.CountTeamMembersMinusGroupMembers(teamID, groupIDs)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.CountTeamMembersMinusGroupMembers(teamID, groupIDs)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) Create(group *model.Group) (*model.Group, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) Create(group *model.Group) (*model.Group, error) {
|
||||
|
||||
return s.GroupStore.Create(group)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.Create(group)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) CreateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) CreateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, error) {
|
||||
|
||||
return s.GroupStore.CreateGroupSyncable(groupSyncable)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.CreateGroupSyncable(groupSyncable)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) Delete(groupID string) (*model.Group, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) Delete(groupID string) (*model.Group, error) {
|
||||
|
||||
return s.GroupStore.Delete(groupID)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.Delete(groupID)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, error) {
|
||||
|
||||
return s.GroupStore.DeleteGroupSyncable(groupID, syncableID, syncableType)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.DeleteGroupSyncable(groupID, syncableID, syncableType)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) DeleteMember(groupID string, userID string) (*model.GroupMember, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) DeleteMember(groupID string, userID string) (*model.GroupMember, error) {
|
||||
|
||||
return s.GroupStore.DeleteMember(groupID, userID)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.DeleteMember(groupID, userID)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) DistinctGroupMemberCount() (int64, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) DistinctGroupMemberCount() (int64, error) {
|
||||
|
||||
return s.GroupStore.DistinctGroupMemberCount()
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.DistinctGroupMemberCount()
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) Get(groupID string) (*model.Group, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) Get(groupID string) (*model.Group, error) {
|
||||
|
||||
return s.GroupStore.Get(groupID)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.Get(groupID)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GetAllBySource(groupSource model.GroupSource) ([]*model.Group, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GetAllBySource(groupSource model.GroupSource) ([]*model.Group, error) {
|
||||
|
||||
return s.GroupStore.GetAllBySource(groupSource)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GetAllBySource(groupSource)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GetAllGroupSyncablesByGroupId(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GetAllGroupSyncablesByGroupId(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, error) {
|
||||
|
||||
return s.GroupStore.GetAllGroupSyncablesByGroupId(groupID, syncableType)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GetAllGroupSyncablesByGroupId(groupID, syncableType)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GetByIDs(groupIDs []string) ([]*model.Group, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GetByIDs(groupIDs []string) ([]*model.Group, error) {
|
||||
|
||||
return s.GroupStore.GetByIDs(groupIDs)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GetByIDs(groupIDs)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GetByName(name string, opts model.GroupSearchOpts) (*model.Group, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GetByName(name string, opts model.GroupSearchOpts) (*model.Group, error) {
|
||||
|
||||
return s.GroupStore.GetByName(name, opts)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GetByName(name, opts)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GetByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GetByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, error) {
|
||||
|
||||
return s.GroupStore.GetByRemoteID(remoteID, groupSource)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GetByRemoteID(remoteID, groupSource)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GetByUser(userId string) ([]*model.Group, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GetByUser(userId string) ([]*model.Group, error) {
|
||||
|
||||
return s.GroupStore.GetByUser(userId)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GetByUser(userId)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, error) {
|
||||
|
||||
return s.GroupStore.GetGroupSyncable(groupID, syncableID, syncableType)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GetGroupSyncable(groupID, syncableID, syncableType)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GetGroups(page int, perPage int, opts model.GroupSearchOpts) ([]*model.Group, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GetGroups(page int, perPage int, opts model.GroupSearchOpts) ([]*model.Group, error) {
|
||||
|
||||
return s.GroupStore.GetGroups(page, perPage, opts)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GetGroups(page, perPage, opts)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GetGroupsAssociatedToChannelsByTeam(teamId string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GetGroupsAssociatedToChannelsByTeam(teamId string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, error) {
|
||||
|
||||
return s.GroupStore.GetGroupsAssociatedToChannelsByTeam(teamId, opts)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GetGroupsAssociatedToChannelsByTeam(teamId, opts)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, error) {
|
||||
|
||||
return s.GroupStore.GetGroupsByChannel(channelId, opts)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GetGroupsByChannel(channelId, opts)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, error) {
|
||||
|
||||
return s.GroupStore.GetGroupsByTeam(teamId, opts)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GetGroupsByTeam(teamId, opts)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GetMemberCount(groupID string) (int64, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GetMemberCount(groupID string) (int64, error) {
|
||||
|
||||
return s.GroupStore.GetMemberCount(groupID)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GetMemberCount(groupID)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GetMemberUsers(groupID string) ([]*model.User, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GetMemberUsers(groupID string) ([]*model.User, error) {
|
||||
|
||||
return s.GroupStore.GetMemberUsers(groupID)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GetMemberUsers(groupID)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GetMemberUsersInTeam(groupID string, teamID string) ([]*model.User, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GetMemberUsersInTeam(groupID string, teamID string) ([]*model.User, error) {
|
||||
|
||||
return s.GroupStore.GetMemberUsersInTeam(groupID, teamID)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GetMemberUsersInTeam(groupID, teamID)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GetMemberUsersNotInChannel(groupID string, channelID string) ([]*model.User, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GetMemberUsersNotInChannel(groupID string, channelID string) ([]*model.User, error) {
|
||||
|
||||
return s.GroupStore.GetMemberUsersNotInChannel(groupID, channelID)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GetMemberUsersNotInChannel(groupID, channelID)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GetMemberUsersPage(groupID string, page int, perPage int) ([]*model.User, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GetMemberUsersPage(groupID string, page int, perPage int) ([]*model.User, error) {
|
||||
|
||||
return s.GroupStore.GetMemberUsersPage(groupID, page, perPage)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GetMemberUsersPage(groupID, page, perPage)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GroupChannelCount() (int64, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GroupChannelCount() (int64, error) {
|
||||
|
||||
return s.GroupStore.GroupChannelCount()
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GroupChannelCount()
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GroupCount() (int64, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GroupCount() (int64, error) {
|
||||
|
||||
return s.GroupStore.GroupCount()
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GroupCount()
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GroupCountWithAllowReference() (int64, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GroupCountWithAllowReference() (int64, error) {
|
||||
|
||||
return s.GroupStore.GroupCountWithAllowReference()
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GroupCountWithAllowReference()
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GroupMemberCount() (int64, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GroupMemberCount() (int64, error) {
|
||||
|
||||
return s.GroupStore.GroupMemberCount()
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GroupMemberCount()
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) GroupTeamCount() (int64, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) GroupTeamCount() (int64, error) {
|
||||
|
||||
return s.GroupStore.GroupTeamCount()
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.GroupTeamCount()
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) PermanentDeleteMembersByUser(userId string) *model.AppError {
|
||||
func (s *RetryLayerGroupStore) PermanentDeleteMembersByUser(userId string) error {
|
||||
|
||||
return s.GroupStore.PermanentDeleteMembersByUser(userId)
|
||||
tries := 0
|
||||
for {
|
||||
err := s.GroupStore.PermanentDeleteMembersByUser(userId)
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) PermittedSyncableAdmins(syncableID string, syncableType model.GroupSyncableType) ([]string, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) PermittedSyncableAdmins(syncableID string, syncableType model.GroupSyncableType) ([]string, error) {
|
||||
|
||||
return s.GroupStore.PermittedSyncableAdmins(syncableID, syncableType)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.PermittedSyncableAdmins(syncableID, syncableType)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, error) {
|
||||
|
||||
return s.GroupStore.TeamMembersMinusGroupMembers(teamID, groupIDs, page, perPage)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.TeamMembersMinusGroupMembers(teamID, groupIDs, page, perPage)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) TeamMembersToAdd(since int64, teamID *string) ([]*model.UserTeamIDPair, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) TeamMembersToAdd(since int64, teamID *string) ([]*model.UserTeamIDPair, error) {
|
||||
|
||||
return s.GroupStore.TeamMembersToAdd(since, teamID)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.TeamMembersToAdd(since, teamID)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) TeamMembersToRemove(teamID *string) ([]*model.TeamMember, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) TeamMembersToRemove(teamID *string) ([]*model.TeamMember, error) {
|
||||
|
||||
return s.GroupStore.TeamMembersToRemove(teamID)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.TeamMembersToRemove(teamID)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) Update(group *model.Group) (*model.Group, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) Update(group *model.Group) (*model.Group, error) {
|
||||
|
||||
return s.GroupStore.Update(group)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.Update(group)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, error) {
|
||||
|
||||
return s.GroupStore.UpdateGroupSyncable(groupSyncable)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.UpdateGroupSyncable(groupSyncable)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerGroupStore) UpsertMember(groupID string, userID string) (*model.GroupMember, *model.AppError) {
|
||||
func (s *RetryLayerGroupStore) UpsertMember(groupID string, userID string) (*model.GroupMember, error) {
|
||||
|
||||
return s.GroupStore.UpsertMember(groupID, userID)
|
||||
tries := 0
|
||||
for {
|
||||
result, err := s.GroupStore.UpsertMember(groupID, userID)
|
||||
if err == nil {
|
||||
return result, nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return result, err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return result, err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@@ -688,90 +688,90 @@ type UserTermsOfServiceStore interface {
|
||||
}
|
||||
|
||||
type GroupStore interface {
|
||||
Create(group *model.Group) (*model.Group, *model.AppError)
|
||||
Get(groupID string) (*model.Group, *model.AppError)
|
||||
GetByName(name string, opts model.GroupSearchOpts) (*model.Group, *model.AppError)
|
||||
GetByIDs(groupIDs []string) ([]*model.Group, *model.AppError)
|
||||
GetByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, *model.AppError)
|
||||
GetAllBySource(groupSource model.GroupSource) ([]*model.Group, *model.AppError)
|
||||
GetByUser(userId string) ([]*model.Group, *model.AppError)
|
||||
Update(group *model.Group) (*model.Group, *model.AppError)
|
||||
Delete(groupID string) (*model.Group, *model.AppError)
|
||||
Create(group *model.Group) (*model.Group, error)
|
||||
Get(groupID string) (*model.Group, error)
|
||||
GetByName(name string, opts model.GroupSearchOpts) (*model.Group, error)
|
||||
GetByIDs(groupIDs []string) ([]*model.Group, error)
|
||||
GetByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, error)
|
||||
GetAllBySource(groupSource model.GroupSource) ([]*model.Group, error)
|
||||
GetByUser(userId string) ([]*model.Group, error)
|
||||
Update(group *model.Group) (*model.Group, error)
|
||||
Delete(groupID string) (*model.Group, error)
|
||||
|
||||
GetMemberUsers(groupID string) ([]*model.User, *model.AppError)
|
||||
GetMemberUsersPage(groupID string, page int, perPage int) ([]*model.User, *model.AppError)
|
||||
GetMemberCount(groupID string) (int64, *model.AppError)
|
||||
GetMemberUsers(groupID string) ([]*model.User, error)
|
||||
GetMemberUsersPage(groupID string, page int, perPage int) ([]*model.User, error)
|
||||
GetMemberCount(groupID string) (int64, error)
|
||||
|
||||
GetMemberUsersInTeam(groupID string, teamID string) ([]*model.User, *model.AppError)
|
||||
GetMemberUsersNotInChannel(groupID string, channelID string) ([]*model.User, *model.AppError)
|
||||
GetMemberUsersInTeam(groupID string, teamID string) ([]*model.User, error)
|
||||
GetMemberUsersNotInChannel(groupID string, channelID string) ([]*model.User, error)
|
||||
|
||||
UpsertMember(groupID string, userID string) (*model.GroupMember, *model.AppError)
|
||||
DeleteMember(groupID string, userID string) (*model.GroupMember, *model.AppError)
|
||||
PermanentDeleteMembersByUser(userId string) *model.AppError
|
||||
UpsertMember(groupID string, userID string) (*model.GroupMember, error)
|
||||
DeleteMember(groupID string, userID string) (*model.GroupMember, error)
|
||||
PermanentDeleteMembersByUser(userId string) error
|
||||
|
||||
CreateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError)
|
||||
GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError)
|
||||
GetAllGroupSyncablesByGroupId(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, *model.AppError)
|
||||
UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError)
|
||||
DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError)
|
||||
CreateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, error)
|
||||
GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, error)
|
||||
GetAllGroupSyncablesByGroupId(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, error)
|
||||
UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, error)
|
||||
DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, error)
|
||||
|
||||
// TeamMembersToAdd returns a slice of UserTeamIDPair that need newly created memberships
|
||||
// based on the groups configurations. The returned list can be optionally scoped to a single given team.
|
||||
//
|
||||
// Typically since will be the last successful group sync time.
|
||||
TeamMembersToAdd(since int64, teamID *string) ([]*model.UserTeamIDPair, *model.AppError)
|
||||
TeamMembersToAdd(since int64, teamID *string) ([]*model.UserTeamIDPair, error)
|
||||
|
||||
// ChannelMembersToAdd returns a slice of UserChannelIDPair that need newly created memberships
|
||||
// based on the groups configurations. The returned list can be optionally scoped to a single given channel.
|
||||
//
|
||||
// Typically since will be the last successful group sync time.
|
||||
ChannelMembersToAdd(since int64, channelID *string) ([]*model.UserChannelIDPair, *model.AppError)
|
||||
ChannelMembersToAdd(since int64, channelID *string) ([]*model.UserChannelIDPair, error)
|
||||
|
||||
// TeamMembersToRemove returns all team members that should be removed based on group constraints.
|
||||
TeamMembersToRemove(teamID *string) ([]*model.TeamMember, *model.AppError)
|
||||
TeamMembersToRemove(teamID *string) ([]*model.TeamMember, error)
|
||||
|
||||
// ChannelMembersToRemove returns all channel members that should be removed based on group constraints.
|
||||
ChannelMembersToRemove(channelID *string) ([]*model.ChannelMember, *model.AppError)
|
||||
ChannelMembersToRemove(channelID *string) ([]*model.ChannelMember, error)
|
||||
|
||||
GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, *model.AppError)
|
||||
CountGroupsByChannel(channelId string, opts model.GroupSearchOpts) (int64, *model.AppError)
|
||||
GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, error)
|
||||
CountGroupsByChannel(channelId string, opts model.GroupSearchOpts) (int64, error)
|
||||
|
||||
GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, *model.AppError)
|
||||
GetGroupsAssociatedToChannelsByTeam(teamId string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, *model.AppError)
|
||||
CountGroupsByTeam(teamId string, opts model.GroupSearchOpts) (int64, *model.AppError)
|
||||
GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, error)
|
||||
GetGroupsAssociatedToChannelsByTeam(teamId string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, error)
|
||||
CountGroupsByTeam(teamId string, opts model.GroupSearchOpts) (int64, error)
|
||||
|
||||
GetGroups(page, perPage int, opts model.GroupSearchOpts) ([]*model.Group, *model.AppError)
|
||||
GetGroups(page, perPage int, opts model.GroupSearchOpts) ([]*model.Group, error)
|
||||
|
||||
TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, *model.AppError)
|
||||
CountTeamMembersMinusGroupMembers(teamID string, groupIDs []string) (int64, *model.AppError)
|
||||
ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, *model.AppError)
|
||||
CountChannelMembersMinusGroupMembers(channelID string, groupIDs []string) (int64, *model.AppError)
|
||||
TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, error)
|
||||
CountTeamMembersMinusGroupMembers(teamID string, groupIDs []string) (int64, error)
|
||||
ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, error)
|
||||
CountChannelMembersMinusGroupMembers(channelID string, groupIDs []string) (int64, error)
|
||||
|
||||
// AdminRoleGroupsForSyncableMember returns the IDs of all of the groups that the user is a member of that are
|
||||
// configured as SchemeAdmin: true for the given syncable.
|
||||
AdminRoleGroupsForSyncableMember(userID, syncableID string, syncableType model.GroupSyncableType) ([]string, *model.AppError)
|
||||
AdminRoleGroupsForSyncableMember(userID, syncableID string, syncableType model.GroupSyncableType) ([]string, error)
|
||||
|
||||
// PermittedSyncableAdmins returns the IDs of all of the user who are permitted by the group syncable to have
|
||||
// the admin role for the given syncable.
|
||||
PermittedSyncableAdmins(syncableID string, syncableType model.GroupSyncableType) ([]string, *model.AppError)
|
||||
PermittedSyncableAdmins(syncableID string, syncableType model.GroupSyncableType) ([]string, error)
|
||||
|
||||
// GroupCount returns the total count of records in the UserGroups table.
|
||||
GroupCount() (int64, *model.AppError)
|
||||
GroupCount() (int64, error)
|
||||
|
||||
// GroupTeamCount returns the total count of records in the GroupTeams table.
|
||||
GroupTeamCount() (int64, *model.AppError)
|
||||
GroupTeamCount() (int64, error)
|
||||
|
||||
// GroupChannelCount returns the total count of records in the GroupChannels table.
|
||||
GroupChannelCount() (int64, *model.AppError)
|
||||
GroupChannelCount() (int64, error)
|
||||
|
||||
// GroupMemberCount returns the total count of records in the GroupMembers table.
|
||||
GroupMemberCount() (int64, *model.AppError)
|
||||
GroupMemberCount() (int64, error)
|
||||
|
||||
// DistinctGroupMemberCount returns the count of records in the GroupMembers table with distinct UserId values.
|
||||
DistinctGroupMemberCount() (int64, *model.AppError)
|
||||
DistinctGroupMemberCount() (int64, error)
|
||||
|
||||
// GroupCountWithAllowReference returns the count of records in the Groups table with AllowReference set to true.
|
||||
GroupCountWithAllowReference() (int64, *model.AppError)
|
||||
GroupCountWithAllowReference() (int64, error)
|
||||
}
|
||||
|
||||
type LinkMetadataStore interface {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package storetest
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"sort"
|
||||
@@ -116,7 +117,9 @@ func testGroupStoreCreate(t *testing.T, ss store.Store) {
|
||||
data, err := ss.Group().Create(g2)
|
||||
require.Nil(t, data)
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, err.Id, "model.group.display_name.app_error")
|
||||
var appErr *model.AppError
|
||||
require.True(t, errors.As(err, &appErr))
|
||||
require.Equal(t, appErr.Id, "model.group.display_name.app_error")
|
||||
|
||||
// Won't accept a duplicate name
|
||||
g4 := &model.Group{
|
||||
@@ -135,7 +138,8 @@ func testGroupStoreCreate(t *testing.T, ss store.Store) {
|
||||
}
|
||||
data, err = ss.Group().Create(g4b)
|
||||
require.Nil(t, data)
|
||||
require.Equal(t, err.Id, "store.sql_group.unique_constraint")
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), fmt.Sprintf("Group with name %s already exists", *g4b.Name))
|
||||
|
||||
// Fields cannot be greater than max values
|
||||
g5 := &model.Group{
|
||||
@@ -211,7 +215,8 @@ func testGroupStoreGet(t *testing.T, ss store.Store) {
|
||||
// Get an invalid group
|
||||
_, err = ss.Group().Get(model.NewId())
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, err.Id, "store.sql_group.no_rows")
|
||||
var nfErr *store.ErrNotFound
|
||||
require.True(t, errors.As(err, &nfErr))
|
||||
}
|
||||
|
||||
func testGroupStoreGetByName(t *testing.T, ss store.Store) {
|
||||
@@ -246,7 +251,8 @@ func testGroupStoreGetByName(t *testing.T, ss store.Store) {
|
||||
// Get an invalid group
|
||||
_, err = ss.Group().GetByName(model.NewId(), g1Opts)
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, err.Id, "store.sql_group.no_rows")
|
||||
var nfErr *store.ErrNotFound
|
||||
require.True(t, errors.As(err, &nfErr))
|
||||
}
|
||||
|
||||
func testGroupStoreGetByIDs(t *testing.T, ss store.Store) {
|
||||
@@ -310,7 +316,8 @@ func testGroupStoreGetByRemoteID(t *testing.T, ss store.Store) {
|
||||
// Get an invalid group
|
||||
_, err = ss.Group().GetByRemoteID(model.NewId(), model.GroupSource("fake"))
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, err.Id, "store.sql_group.no_rows")
|
||||
var nfErr *store.ErrNotFound
|
||||
require.True(t, errors.As(err, &nfErr))
|
||||
}
|
||||
|
||||
func testGroupStoreGetAllByType(t *testing.T, ss store.Store) {
|
||||
@@ -464,7 +471,9 @@ func testGroupStoreUpdate(t *testing.T, ss store.Store) {
|
||||
})
|
||||
require.Nil(t, data)
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, err.Id, "model.group.display_name.app_error")
|
||||
var appErr *model.AppError
|
||||
require.True(t, errors.As(err, &appErr))
|
||||
require.Equal(t, appErr.Id, "model.group.display_name.app_error")
|
||||
|
||||
// Create another Group
|
||||
g2 := &model.Group{
|
||||
@@ -486,7 +495,8 @@ func testGroupStoreUpdate(t *testing.T, ss store.Store) {
|
||||
Description: model.NewId(),
|
||||
RemoteId: model.NewId(),
|
||||
})
|
||||
require.Equal(t, err.Id, "store.sql_group.unique_constraint")
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), fmt.Sprintf("Group with name %s already exists", *g1Update.Name))
|
||||
|
||||
// Cannot update CreateAt
|
||||
someVal := model.GetMillis()
|
||||
@@ -498,7 +508,8 @@ func testGroupStoreUpdate(t *testing.T, ss store.Store) {
|
||||
// Cannot update DeleteAt to non-zero
|
||||
d1.DeleteAt = 1
|
||||
_, err = ss.Group().Update(d1)
|
||||
require.Equal(t, "model.group.delete_at.app_error", err.Id)
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), "DeleteAt should be 0 when updating")
|
||||
|
||||
//...except for 0 for DeleteAt
|
||||
d1.DeleteAt = 0
|
||||
@@ -548,11 +559,12 @@ func testGroupStoreDelete(t *testing.T, ss store.Store) {
|
||||
// Try and delete a nonexistent group
|
||||
_, err = ss.Group().Delete(model.NewId())
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, err.Id, "store.sql_group.no_rows")
|
||||
var nfErr *store.ErrNotFound
|
||||
require.True(t, errors.As(err, &nfErr))
|
||||
|
||||
// Cannot delete again
|
||||
_, err = ss.Group().Delete(d1.Id)
|
||||
require.Equal(t, err.Id, "store.sql_group.no_rows")
|
||||
require.True(t, errors.As(err, &nfErr))
|
||||
}
|
||||
|
||||
func testGroupGetMemberUsers(t *testing.T, ss store.Store) {
|
||||
@@ -942,7 +954,8 @@ func testUpsertMember(t *testing.T, ss store.Store) {
|
||||
|
||||
// Invalid GroupId
|
||||
_, err = ss.Group().UpsertMember(model.NewId(), user.Id)
|
||||
require.Equal(t, err.Id, "store.insert_error")
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), "failed to get UserGroup with")
|
||||
|
||||
// Restores a deleted member
|
||||
// Ensure new CreateAt > previous CreateAt for the same (groupId, userId)
|
||||
@@ -998,15 +1011,16 @@ func testGroupDeleteMember(t *testing.T, ss store.Store) {
|
||||
|
||||
// Delete an already deleted member
|
||||
_, err = ss.Group().DeleteMember(group.Id, user.Id)
|
||||
require.Equal(t, err.Id, "store.sql_group.no_rows")
|
||||
var nfErr *store.ErrNotFound
|
||||
require.True(t, errors.As(err, &nfErr))
|
||||
|
||||
// Delete with non-existent User
|
||||
_, err = ss.Group().DeleteMember(group.Id, model.NewId())
|
||||
require.Equal(t, err.Id, "store.sql_group.no_rows")
|
||||
require.True(t, errors.As(err, &nfErr))
|
||||
|
||||
// Delete non-existent Group
|
||||
_, err = ss.Group().DeleteMember(model.NewId(), group.Id)
|
||||
require.Equal(t, err.Id, "store.sql_group.no_rows")
|
||||
require.True(t, errors.As(err, &nfErr))
|
||||
}
|
||||
|
||||
func testGroupPermanentDeleteMembersByUser(t *testing.T, ss store.Store) {
|
||||
@@ -1048,7 +1062,9 @@ func testGroupPermanentDeleteMembersByUser(t *testing.T, ss store.Store) {
|
||||
func testCreateGroupSyncable(t *testing.T, ss store.Store) {
|
||||
// Invalid GroupID
|
||||
_, err := ss.Group().CreateGroupSyncable(model.NewGroupTeam("x", model.NewId(), false))
|
||||
require.Equal(t, err.Id, "model.group_syncable.group_id.app_error")
|
||||
var appErr *model.AppError
|
||||
require.True(t, errors.As(err, &appErr))
|
||||
require.Equal(t, appErr.Id, "model.group_syncable.group_id.app_error")
|
||||
|
||||
// Create Group
|
||||
g1 := &model.Group{
|
||||
@@ -1225,12 +1241,13 @@ func testUpdateGroupSyncable(t *testing.T, ss store.Store) {
|
||||
// Non-existent Group
|
||||
gt2 := model.NewGroupTeam(model.NewId(), team.Id, false)
|
||||
_, err = ss.Group().UpdateGroupSyncable(gt2)
|
||||
require.Equal(t, err.Id, "store.sql_group.no_rows")
|
||||
var nfErr *store.ErrNotFound
|
||||
require.True(t, errors.As(err, &nfErr))
|
||||
|
||||
// Non-existent Team
|
||||
gt3 := model.NewGroupTeam(group.Id, model.NewId(), false)
|
||||
_, err = ss.Group().UpdateGroupSyncable(gt3)
|
||||
require.Equal(t, err.Id, "store.sql_group.no_rows")
|
||||
require.True(t, errors.As(err, &nfErr))
|
||||
|
||||
// Cannot update CreateAt or DeleteAt
|
||||
origCreateAt := d1.CreateAt
|
||||
@@ -1243,7 +1260,8 @@ func testUpdateGroupSyncable(t *testing.T, ss store.Store) {
|
||||
// Cannot update DeleteAt to arbitrary value
|
||||
d1.DeleteAt = 1
|
||||
_, err = ss.Group().UpdateGroupSyncable(d1)
|
||||
require.Equal(t, "model.group.delete_at.app_error", err.Id)
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), "DeleteAt should be 0 when updating")
|
||||
|
||||
// Can update DeleteAt to 0
|
||||
d1.DeleteAt = 0
|
||||
@@ -1284,11 +1302,12 @@ func testDeleteGroupSyncable(t *testing.T, ss store.Store) {
|
||||
|
||||
// Non-existent Group
|
||||
_, err = ss.Group().DeleteGroupSyncable(model.NewId(), groupTeam.SyncableId, model.GroupSyncableTypeTeam)
|
||||
require.Equal(t, err.Id, "store.sql_group.no_rows")
|
||||
var nfErr *store.ErrNotFound
|
||||
require.True(t, errors.As(err, &nfErr))
|
||||
|
||||
// Non-existent Team
|
||||
_, err = ss.Group().DeleteGroupSyncable(groupTeam.GroupId, model.NewId(), model.GroupSyncableTypeTeam)
|
||||
require.Equal(t, err.Id, "store.sql_group.no_rows")
|
||||
require.True(t, errors.As(err, &nfErr))
|
||||
|
||||
// Happy path...
|
||||
d1, err := ss.Group().DeleteGroupSyncable(groupTeam.GroupId, groupTeam.SyncableId, model.GroupSyncableTypeTeam)
|
||||
@@ -1303,7 +1322,8 @@ func testDeleteGroupSyncable(t *testing.T, ss store.Store) {
|
||||
// Record already deleted
|
||||
_, err = ss.Group().DeleteGroupSyncable(d1.GroupId, d1.SyncableId, d1.Type)
|
||||
require.NotNil(t, err)
|
||||
require.Equal(t, err.Id, "store.sql_group.group_syncable_already_deleted")
|
||||
var invErr *store.ErrInvalidInput
|
||||
require.True(t, errors.As(err, &invErr))
|
||||
}
|
||||
|
||||
func testTeamMembersToAdd(t *testing.T, ss store.Store) {
|
||||
|
||||
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@@ -2909,7 +2909,7 @@ func (s *TimerLayerFileInfoStore) Upsert(info *model.FileInfo) (*model.FileInfo,
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) AdminRoleGroupsForSyncableMember(userID string, syncableID string, syncableType model.GroupSyncableType) ([]string, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) AdminRoleGroupsForSyncableMember(userID string, syncableID string, syncableType model.GroupSyncableType) ([]string, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.AdminRoleGroupsForSyncableMember(userID, syncableID, syncableType)
|
||||
@@ -2925,7 +2925,7 @@ func (s *TimerLayerGroupStore) AdminRoleGroupsForSyncableMember(userID string, s
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.ChannelMembersMinusGroupMembers(channelID, groupIDs, page, perPage)
|
||||
@@ -2941,7 +2941,7 @@ func (s *TimerLayerGroupStore) ChannelMembersMinusGroupMembers(channelID string,
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) ChannelMembersToAdd(since int64, channelID *string) ([]*model.UserChannelIDPair, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) ChannelMembersToAdd(since int64, channelID *string) ([]*model.UserChannelIDPair, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.ChannelMembersToAdd(since, channelID)
|
||||
@@ -2957,7 +2957,7 @@ func (s *TimerLayerGroupStore) ChannelMembersToAdd(since int64, channelID *strin
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) ChannelMembersToRemove(channelID *string) ([]*model.ChannelMember, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) ChannelMembersToRemove(channelID *string) ([]*model.ChannelMember, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.ChannelMembersToRemove(channelID)
|
||||
@@ -2973,7 +2973,7 @@ func (s *TimerLayerGroupStore) ChannelMembersToRemove(channelID *string) ([]*mod
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) CountChannelMembersMinusGroupMembers(channelID string, groupIDs []string) (int64, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) CountChannelMembersMinusGroupMembers(channelID string, groupIDs []string) (int64, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.CountChannelMembersMinusGroupMembers(channelID, groupIDs)
|
||||
@@ -2989,7 +2989,7 @@ func (s *TimerLayerGroupStore) CountChannelMembersMinusGroupMembers(channelID st
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) CountGroupsByChannel(channelId string, opts model.GroupSearchOpts) (int64, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) CountGroupsByChannel(channelId string, opts model.GroupSearchOpts) (int64, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.CountGroupsByChannel(channelId, opts)
|
||||
@@ -3005,7 +3005,7 @@ func (s *TimerLayerGroupStore) CountGroupsByChannel(channelId string, opts model
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) CountGroupsByTeam(teamId string, opts model.GroupSearchOpts) (int64, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) CountGroupsByTeam(teamId string, opts model.GroupSearchOpts) (int64, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.CountGroupsByTeam(teamId, opts)
|
||||
@@ -3021,7 +3021,7 @@ func (s *TimerLayerGroupStore) CountGroupsByTeam(teamId string, opts model.Group
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) CountTeamMembersMinusGroupMembers(teamID string, groupIDs []string) (int64, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) CountTeamMembersMinusGroupMembers(teamID string, groupIDs []string) (int64, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.CountTeamMembersMinusGroupMembers(teamID, groupIDs)
|
||||
@@ -3037,7 +3037,7 @@ func (s *TimerLayerGroupStore) CountTeamMembersMinusGroupMembers(teamID string,
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) Create(group *model.Group) (*model.Group, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) Create(group *model.Group) (*model.Group, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.Create(group)
|
||||
@@ -3053,7 +3053,7 @@ func (s *TimerLayerGroupStore) Create(group *model.Group) (*model.Group, *model.
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) CreateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) CreateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.CreateGroupSyncable(groupSyncable)
|
||||
@@ -3069,7 +3069,7 @@ func (s *TimerLayerGroupStore) CreateGroupSyncable(groupSyncable *model.GroupSyn
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) Delete(groupID string) (*model.Group, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) Delete(groupID string) (*model.Group, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.Delete(groupID)
|
||||
@@ -3085,7 +3085,7 @@ func (s *TimerLayerGroupStore) Delete(groupID string) (*model.Group, *model.AppE
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.DeleteGroupSyncable(groupID, syncableID, syncableType)
|
||||
@@ -3101,7 +3101,7 @@ func (s *TimerLayerGroupStore) DeleteGroupSyncable(groupID string, syncableID st
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) DeleteMember(groupID string, userID string) (*model.GroupMember, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) DeleteMember(groupID string, userID string) (*model.GroupMember, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.DeleteMember(groupID, userID)
|
||||
@@ -3117,7 +3117,7 @@ func (s *TimerLayerGroupStore) DeleteMember(groupID string, userID string) (*mod
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) DistinctGroupMemberCount() (int64, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) DistinctGroupMemberCount() (int64, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.DistinctGroupMemberCount()
|
||||
@@ -3133,7 +3133,7 @@ func (s *TimerLayerGroupStore) DistinctGroupMemberCount() (int64, *model.AppErro
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) Get(groupID string) (*model.Group, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) Get(groupID string) (*model.Group, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.Get(groupID)
|
||||
@@ -3149,7 +3149,7 @@ func (s *TimerLayerGroupStore) Get(groupID string) (*model.Group, *model.AppErro
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GetAllBySource(groupSource model.GroupSource) ([]*model.Group, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GetAllBySource(groupSource model.GroupSource) ([]*model.Group, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GetAllBySource(groupSource)
|
||||
@@ -3165,7 +3165,7 @@ func (s *TimerLayerGroupStore) GetAllBySource(groupSource model.GroupSource) ([]
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GetAllGroupSyncablesByGroupId(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GetAllGroupSyncablesByGroupId(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GetAllGroupSyncablesByGroupId(groupID, syncableType)
|
||||
@@ -3181,7 +3181,7 @@ func (s *TimerLayerGroupStore) GetAllGroupSyncablesByGroupId(groupID string, syn
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GetByIDs(groupIDs []string) ([]*model.Group, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GetByIDs(groupIDs []string) ([]*model.Group, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GetByIDs(groupIDs)
|
||||
@@ -3197,7 +3197,7 @@ func (s *TimerLayerGroupStore) GetByIDs(groupIDs []string) ([]*model.Group, *mod
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GetByName(name string, opts model.GroupSearchOpts) (*model.Group, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GetByName(name string, opts model.GroupSearchOpts) (*model.Group, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GetByName(name, opts)
|
||||
@@ -3213,7 +3213,7 @@ func (s *TimerLayerGroupStore) GetByName(name string, opts model.GroupSearchOpts
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GetByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GetByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GetByRemoteID(remoteID, groupSource)
|
||||
@@ -3229,7 +3229,7 @@ func (s *TimerLayerGroupStore) GetByRemoteID(remoteID string, groupSource model.
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GetByUser(userId string) ([]*model.Group, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GetByUser(userId string) ([]*model.Group, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GetByUser(userId)
|
||||
@@ -3245,7 +3245,7 @@ func (s *TimerLayerGroupStore) GetByUser(userId string) ([]*model.Group, *model.
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GetGroupSyncable(groupID, syncableID, syncableType)
|
||||
@@ -3261,7 +3261,7 @@ func (s *TimerLayerGroupStore) GetGroupSyncable(groupID string, syncableID strin
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GetGroups(page int, perPage int, opts model.GroupSearchOpts) ([]*model.Group, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GetGroups(page int, perPage int, opts model.GroupSearchOpts) ([]*model.Group, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GetGroups(page, perPage, opts)
|
||||
@@ -3277,7 +3277,7 @@ func (s *TimerLayerGroupStore) GetGroups(page int, perPage int, opts model.Group
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GetGroupsAssociatedToChannelsByTeam(teamId string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GetGroupsAssociatedToChannelsByTeam(teamId string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GetGroupsAssociatedToChannelsByTeam(teamId, opts)
|
||||
@@ -3293,7 +3293,7 @@ func (s *TimerLayerGroupStore) GetGroupsAssociatedToChannelsByTeam(teamId string
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GetGroupsByChannel(channelId, opts)
|
||||
@@ -3309,7 +3309,7 @@ func (s *TimerLayerGroupStore) GetGroupsByChannel(channelId string, opts model.G
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GetGroupsByTeam(teamId, opts)
|
||||
@@ -3325,7 +3325,7 @@ func (s *TimerLayerGroupStore) GetGroupsByTeam(teamId string, opts model.GroupSe
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GetMemberCount(groupID string) (int64, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GetMemberCount(groupID string) (int64, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GetMemberCount(groupID)
|
||||
@@ -3341,7 +3341,7 @@ func (s *TimerLayerGroupStore) GetMemberCount(groupID string) (int64, *model.App
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GetMemberUsers(groupID string) ([]*model.User, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GetMemberUsers(groupID string) ([]*model.User, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GetMemberUsers(groupID)
|
||||
@@ -3357,7 +3357,7 @@ func (s *TimerLayerGroupStore) GetMemberUsers(groupID string) ([]*model.User, *m
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GetMemberUsersInTeam(groupID string, teamID string) ([]*model.User, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GetMemberUsersInTeam(groupID string, teamID string) ([]*model.User, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GetMemberUsersInTeam(groupID, teamID)
|
||||
@@ -3373,7 +3373,7 @@ func (s *TimerLayerGroupStore) GetMemberUsersInTeam(groupID string, teamID strin
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GetMemberUsersNotInChannel(groupID string, channelID string) ([]*model.User, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GetMemberUsersNotInChannel(groupID string, channelID string) ([]*model.User, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GetMemberUsersNotInChannel(groupID, channelID)
|
||||
@@ -3389,7 +3389,7 @@ func (s *TimerLayerGroupStore) GetMemberUsersNotInChannel(groupID string, channe
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GetMemberUsersPage(groupID string, page int, perPage int) ([]*model.User, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GetMemberUsersPage(groupID string, page int, perPage int) ([]*model.User, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GetMemberUsersPage(groupID, page, perPage)
|
||||
@@ -3405,7 +3405,7 @@ func (s *TimerLayerGroupStore) GetMemberUsersPage(groupID string, page int, perP
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GroupChannelCount() (int64, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GroupChannelCount() (int64, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GroupChannelCount()
|
||||
@@ -3421,7 +3421,7 @@ func (s *TimerLayerGroupStore) GroupChannelCount() (int64, *model.AppError) {
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GroupCount() (int64, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GroupCount() (int64, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GroupCount()
|
||||
@@ -3437,7 +3437,7 @@ func (s *TimerLayerGroupStore) GroupCount() (int64, *model.AppError) {
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GroupCountWithAllowReference() (int64, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GroupCountWithAllowReference() (int64, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GroupCountWithAllowReference()
|
||||
@@ -3453,7 +3453,7 @@ func (s *TimerLayerGroupStore) GroupCountWithAllowReference() (int64, *model.App
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GroupMemberCount() (int64, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GroupMemberCount() (int64, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GroupMemberCount()
|
||||
@@ -3469,7 +3469,7 @@ func (s *TimerLayerGroupStore) GroupMemberCount() (int64, *model.AppError) {
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) GroupTeamCount() (int64, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) GroupTeamCount() (int64, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.GroupTeamCount()
|
||||
@@ -3485,7 +3485,7 @@ func (s *TimerLayerGroupStore) GroupTeamCount() (int64, *model.AppError) {
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) PermanentDeleteMembersByUser(userId string) *model.AppError {
|
||||
func (s *TimerLayerGroupStore) PermanentDeleteMembersByUser(userId string) error {
|
||||
start := timemodule.Now()
|
||||
|
||||
err := s.GroupStore.PermanentDeleteMembersByUser(userId)
|
||||
@@ -3501,7 +3501,7 @@ func (s *TimerLayerGroupStore) PermanentDeleteMembersByUser(userId string) *mode
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) PermittedSyncableAdmins(syncableID string, syncableType model.GroupSyncableType) ([]string, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) PermittedSyncableAdmins(syncableID string, syncableType model.GroupSyncableType) ([]string, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.PermittedSyncableAdmins(syncableID, syncableType)
|
||||
@@ -3517,7 +3517,7 @@ func (s *TimerLayerGroupStore) PermittedSyncableAdmins(syncableID string, syncab
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.TeamMembersMinusGroupMembers(teamID, groupIDs, page, perPage)
|
||||
@@ -3533,7 +3533,7 @@ func (s *TimerLayerGroupStore) TeamMembersMinusGroupMembers(teamID string, group
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) TeamMembersToAdd(since int64, teamID *string) ([]*model.UserTeamIDPair, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) TeamMembersToAdd(since int64, teamID *string) ([]*model.UserTeamIDPair, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.TeamMembersToAdd(since, teamID)
|
||||
@@ -3549,7 +3549,7 @@ func (s *TimerLayerGroupStore) TeamMembersToAdd(since int64, teamID *string) ([]
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) TeamMembersToRemove(teamID *string) ([]*model.TeamMember, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) TeamMembersToRemove(teamID *string) ([]*model.TeamMember, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.TeamMembersToRemove(teamID)
|
||||
@@ -3565,7 +3565,7 @@ func (s *TimerLayerGroupStore) TeamMembersToRemove(teamID *string) ([]*model.Tea
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) Update(group *model.Group) (*model.Group, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) Update(group *model.Group) (*model.Group, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.Update(group)
|
||||
@@ -3581,7 +3581,7 @@ func (s *TimerLayerGroupStore) Update(group *model.Group) (*model.Group, *model.
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.UpdateGroupSyncable(groupSyncable)
|
||||
@@ -3597,7 +3597,7 @@ func (s *TimerLayerGroupStore) UpdateGroupSyncable(groupSyncable *model.GroupSyn
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerGroupStore) UpsertMember(groupID string, userID string) (*model.GroupMember, *model.AppError) {
|
||||
func (s *TimerLayerGroupStore) UpsertMember(groupID string, userID string) (*model.GroupMember, error) {
|
||||
start := timemodule.Now()
|
||||
|
||||
result, err := s.GroupStore.UpsertMember(groupID, userID)
|
||||
|
||||
Ссылка в новой задаче
Block a user