fix: default friends and groups, no new sessions triggered (#960)

* fix: create group type limit

* fix: group notification

* fix: group notification

* fix: group notification

* chore: group member hash

* chore: group member hash

* chore: group member hash

* chore: group member hash

* test: log

* test: log

* test: log

* test: log

* test: log

* sync: hash code

* sync: hash code

* sync: hash code

* test: log

* test: log

* test: log

* test: log

* test: log

* fix: time stamp

* fix: minio sign endpoint opts

* cicd: robot automated Change

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix: minio bucket url

* fix: op user info

* cicd: robot automated Change

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix: importFriends Conversation

* fix: importFriends Notification

* cicd: robot automated Change

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix: importFriends Notification

---------

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: withchao <withchao@users.noreply.github.com>
pull/963/head
withchao 1 year ago committed by GitHub
parent 31ae8271e7
commit 781b13c604
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -45,6 +45,7 @@ type friendServer struct {
blackDatabase controller.BlackDatabase
userRpcClient *rpcclient.UserRpcClient
notificationSender *notification.FriendNotificationSender
conversationRpcClient rpcclient.ConversationRpcClient
RegisterCenter registry.SvcDiscoveryRegistry
}
@ -82,6 +83,7 @@ func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
userRpcClient: &userRpcClient,
notificationSender: notificationSender,
RegisterCenter: client,
conversationRpcClient: rpcclient.NewConversationRpcClient(client),
})
return nil
}
@ -131,17 +133,22 @@ func (s *friendServer) ImportFriends(
if _, err := s.userRpcClient.GetUsersInfo(ctx, append([]string{req.OwnerUserID}, req.FriendUserIDs...)); err != nil {
return nil, err
}
if utils.Contain(req.OwnerUserID, req.FriendUserIDs...) {
return nil, errs.ErrCanNotAddYourself.Wrap()
}
if utils.Duplicate(req.FriendUserIDs) {
return nil, errs.ErrArgs.Wrap("friend userID repeated")
}
if err := s.friendDatabase.BecomeFriends(ctx, req.OwnerUserID, req.FriendUserIDs, constant.BecomeFriendByImport); err != nil {
return nil, err
}
for _, userID := range req.FriendUserIDs {
s.notificationSender.FriendApplicationAgreedNotification(ctx, &pbfriend.RespondFriendApplyReq{
FromUserID: req.OwnerUserID,
ToUserID: userID,
HandleResult: constant.FriendResponseAgree,
})
}
return &pbfriend.ImportFriendResp{}, nil
}

@ -17,9 +17,10 @@ package kafka
import (
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/tools/log"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/Shopify/sarama"
)

@ -1,9 +1,10 @@
package kafka
import (
"github.com/Shopify/sarama"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/tls"
"github.com/Shopify/sarama"
)
// SetupTLSConfig set up the TLS config from config file.

@ -10,7 +10,6 @@ import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
)
func decryptPEM(data []byte, passphrase []byte) ([]byte, error) {
if len(passphrase) == 0 {
return data, nil

@ -18,6 +18,8 @@ import (
"context"
"fmt"
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
"github.com/OpenIMSDK/protocol/constant"
pbgroup "github.com/OpenIMSDK/protocol/group"
"github.com/OpenIMSDK/protocol/sdkws"
@ -235,6 +237,14 @@ func (g *GroupNotificationSender) fillOpUser(ctx context.Context, opUser **sdkws
}
userID := mcontext.GetOpUserID(ctx)
if groupID != "" {
if authverify.IsManagerUserID(userID) {
*opUser = &sdkws.GroupMemberFullInfo{
GroupID: groupID,
UserID: userID,
RoleLevel: constant.GroupAdmin,
AppMangerLevel: constant.AppAdmin,
}
} else {
member, err := g.db.TakeGroupMember(ctx, groupID, userID)
if err == nil {
*opUser = g.groupMemberDB2PB(member, 0)
@ -242,6 +252,7 @@ func (g *GroupNotificationSender) fillOpUser(ctx context.Context, opUser **sdkws
return err
}
}
}
user, err := g.getUser(ctx, userID)
if err != nil {
return err

Loading…
Cancel
Save