mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
Merge pull request #3127 from openimsdk/cherry-pick-ed416f8
fix: crash caused by withdrawing messages from users who have left the group [Created by @withchao from #3100]
This commit is contained in:
commit
63df09cc5d
@ -17,9 +17,10 @@ package msg
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
|
||||||
|
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/authverify"
|
"github.com/openimsdk/open-im-server/v3/pkg/authverify"
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/servererrs"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/servererrs"
|
||||||
"github.com/openimsdk/protocol/constant"
|
"github.com/openimsdk/protocol/constant"
|
||||||
@ -79,8 +80,10 @@ func (m *msgServer) RevokeMsg(ctx context.Context, req *msg.RevokeMsgReq) (*msg.
|
|||||||
switch members[req.UserID].RoleLevel {
|
switch members[req.UserID].RoleLevel {
|
||||||
case constant.GroupOwner:
|
case constant.GroupOwner:
|
||||||
case constant.GroupAdmin:
|
case constant.GroupAdmin:
|
||||||
if members[msgs[0].SendID].RoleLevel != constant.GroupOrdinaryUsers {
|
if sendMember, ok := members[msgs[0].SendID]; ok {
|
||||||
return nil, errs.ErrNoPermission.WrapMsg("no permission")
|
if sendMember.RoleLevel != constant.GroupOrdinaryUsers {
|
||||||
|
return nil, errs.ErrNoPermission.WrapMsg("no permission")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return nil, errs.ErrNoPermission.WrapMsg("no permission")
|
return nil, errs.ErrNoPermission.WrapMsg("no permission")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user