mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Changes method name, removes error case. (#11427)
* Changes method name, removes previous error case. * Fixes test now that the method is idempotent.
This commit is contained in:
@@ -335,7 +335,7 @@ func (s *SqlGroupStore) GetMemberCount(groupID string) store.StoreChannel {
|
||||
})
|
||||
}
|
||||
|
||||
func (s *SqlGroupStore) CreateOrRestoreMember(groupID string, userID string) store.StoreChannel {
|
||||
func (s *SqlGroupStore) UpsertMember(groupID string, userID string) store.StoreChannel {
|
||||
return store.Do(func(result *store.StoreResult) {
|
||||
|
||||
member := &model.GroupMember{
|
||||
@@ -362,11 +362,6 @@ func (s *SqlGroupStore) CreateOrRestoreMember(groupID string, userID string) sto
|
||||
}
|
||||
}
|
||||
|
||||
if retrievedMember != nil && retrievedMember.DeleteAt == 0 {
|
||||
result.Err = model.NewAppError("SqlGroupStore.GroupCreateOrRestoreMember", "store.sql_group.uniqueness_error", nil, "group_id="+member.GroupId+", user_id="+member.UserId, http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if retrievedMember == nil {
|
||||
if err := s.GetMaster().Insert(member); err != nil {
|
||||
if IsUniqueConstraintError(err, []string{"GroupId", "UserId", "groupmembers_pkey", "PRIMARY"}) {
|
||||
|
||||
Reference in New Issue
Block a user