From cf21b57dececac81526746cc2b93fd519d6600ac Mon Sep 17 00:00:00 2001 From: Tuan Anh Date: Tue, 10 Sep 2024 21:34:26 +0700 Subject: [PATCH] Add get peer from join link --- core/util/tutil/tutil.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/util/tutil/tutil.go b/core/util/tutil/tutil.go index 76f92851ab..9146f3b121 100644 --- a/core/util/tutil/tutil.go +++ b/core/util/tutil/tutil.go @@ -91,8 +91,14 @@ func ParseMessageLink(ctx context.Context, manager *peers.Manager, s string) (pe func GetInputPeer(ctx context.Context, manager *peers.Manager, from string) (peers.Peer, error) { id, err := strconv.ParseInt(from, 10, 64) if err != nil { + // from is join link + p, err := manager.JoinLink(ctx, from) + if err == nil { + return p, nil + } + // from is username - p, err := manager.Resolve(ctx, from) + p, err = manager.Resolve(ctx, from) if err != nil { return nil, err }