mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-24 02:16:16 +08:00
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>
This commit is contained in:
parent
31ae8271e7
commit
781b13c604
@ -41,11 +41,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type friendServer struct {
|
type friendServer struct {
|
||||||
friendDatabase controller.FriendDatabase
|
friendDatabase controller.FriendDatabase
|
||||||
blackDatabase controller.BlackDatabase
|
blackDatabase controller.BlackDatabase
|
||||||
userRpcClient *rpcclient.UserRpcClient
|
userRpcClient *rpcclient.UserRpcClient
|
||||||
notificationSender *notification.FriendNotificationSender
|
notificationSender *notification.FriendNotificationSender
|
||||||
RegisterCenter registry.SvcDiscoveryRegistry
|
conversationRpcClient rpcclient.ConversationRpcClient
|
||||||
|
RegisterCenter registry.SvcDiscoveryRegistry
|
||||||
}
|
}
|
||||||
|
|
||||||
func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
||||||
@ -79,9 +80,10 @@ func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
|||||||
blackDB,
|
blackDB,
|
||||||
cache.NewBlackCacheRedis(rdb, blackDB, cache.GetDefaultOpt()),
|
cache.NewBlackCacheRedis(rdb, blackDB, cache.GetDefaultOpt()),
|
||||||
),
|
),
|
||||||
userRpcClient: &userRpcClient,
|
userRpcClient: &userRpcClient,
|
||||||
notificationSender: notificationSender,
|
notificationSender: notificationSender,
|
||||||
RegisterCenter: client,
|
RegisterCenter: client,
|
||||||
|
conversationRpcClient: rpcclient.NewConversationRpcClient(client),
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -131,17 +133,22 @@ func (s *friendServer) ImportFriends(
|
|||||||
if _, err := s.userRpcClient.GetUsersInfo(ctx, append([]string{req.OwnerUserID}, req.FriendUserIDs...)); err != nil {
|
if _, err := s.userRpcClient.GetUsersInfo(ctx, append([]string{req.OwnerUserID}, req.FriendUserIDs...)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if utils.Contain(req.OwnerUserID, req.FriendUserIDs...) {
|
if utils.Contain(req.OwnerUserID, req.FriendUserIDs...) {
|
||||||
return nil, errs.ErrCanNotAddYourself.Wrap()
|
return nil, errs.ErrCanNotAddYourself.Wrap()
|
||||||
}
|
}
|
||||||
if utils.Duplicate(req.FriendUserIDs) {
|
if utils.Duplicate(req.FriendUserIDs) {
|
||||||
return nil, errs.ErrArgs.Wrap("friend userID repeated")
|
return nil, errs.ErrArgs.Wrap("friend userID repeated")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.friendDatabase.BecomeFriends(ctx, req.OwnerUserID, req.FriendUserIDs, constant.BecomeFriendByImport); err != nil {
|
if err := s.friendDatabase.BecomeFriends(ctx, req.OwnerUserID, req.FriendUserIDs, constant.BecomeFriendByImport); err != nil {
|
||||||
return nil, err
|
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
|
return &pbfriend.ImportFriendResp{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,9 +17,10 @@ package kafka
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
|
||||||
"github.com/OpenIMSDK/tools/log"
|
"github.com/OpenIMSDK/tools/log"
|
||||||
|
|
||||||
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||||
|
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
package kafka
|
package kafka
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/Shopify/sarama"
|
||||||
|
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/tls"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/tls"
|
||||||
"github.com/Shopify/sarama"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetupTLSConfig set up the TLS config from config file.
|
// SetupTLSConfig set up the TLS config from config file.
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func decryptPEM(data []byte, passphrase []byte) ([]byte, error) {
|
func decryptPEM(data []byte, passphrase []byte) ([]byte, error) {
|
||||||
if len(passphrase) == 0 {
|
if len(passphrase) == 0 {
|
||||||
return data, nil
|
return data, nil
|
||||||
|
@ -18,6 +18,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/authverify"
|
||||||
|
|
||||||
"github.com/OpenIMSDK/protocol/constant"
|
"github.com/OpenIMSDK/protocol/constant"
|
||||||
pbgroup "github.com/OpenIMSDK/protocol/group"
|
pbgroup "github.com/OpenIMSDK/protocol/group"
|
||||||
"github.com/OpenIMSDK/protocol/sdkws"
|
"github.com/OpenIMSDK/protocol/sdkws"
|
||||||
@ -235,11 +237,20 @@ func (g *GroupNotificationSender) fillOpUser(ctx context.Context, opUser **sdkws
|
|||||||
}
|
}
|
||||||
userID := mcontext.GetOpUserID(ctx)
|
userID := mcontext.GetOpUserID(ctx)
|
||||||
if groupID != "" {
|
if groupID != "" {
|
||||||
member, err := g.db.TakeGroupMember(ctx, groupID, userID)
|
if authverify.IsManagerUserID(userID) {
|
||||||
if err == nil {
|
*opUser = &sdkws.GroupMemberFullInfo{
|
||||||
*opUser = g.groupMemberDB2PB(member, 0)
|
GroupID: groupID,
|
||||||
} else if !errs.ErrRecordNotFound.Is(err) {
|
UserID: userID,
|
||||||
return err
|
RoleLevel: constant.GroupAdmin,
|
||||||
|
AppMangerLevel: constant.AppAdmin,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
member, err := g.db.TakeGroupMember(ctx, groupID, userID)
|
||||||
|
if err == nil {
|
||||||
|
*opUser = g.groupMemberDB2PB(member, 0)
|
||||||
|
} else if !errs.ErrRecordNotFound.Is(err) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
user, err := g.getUser(ctx, userID)
|
user, err := g.getUser(ctx, userID)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user