From ad185b8d018e727ec0c068a73f184d397e68e4f5 Mon Sep 17 00:00:00 2001 From: mountain Date: Mon, 11 Sep 2023 19:54:19 +0900 Subject: [PATCH] =?UTF-8?q?UpdatePartyDocumentDirect=EB=A5=BC=20PartyOwner?= =?UTF-8?q?=EB=A7=8C=20=EB=8F=99=EC=9E=91=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/group_chat.go | 2 -- core/group_party.go | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/core/group_chat.go b/core/group_chat.go index 8d62568..5d84954 100644 --- a/core/group_chat.go +++ b/core/group_chat.go @@ -164,8 +164,6 @@ func (gc *groupChat) EnterPrivateChannel(ctx wshandler.ApiCallContext) { return } gc.enterRoom(channel, ctx.CallBy.Accid) - } else { - // 내가 이미 private channel에 있다는 것을 다른 사람들에게 알려주기 위함 } gc.sendUpstreamMessage(&wshandler.UpstreamMessage{ diff --git a/core/group_party.go b/core/group_party.go index 83fed47..631df34 100644 --- a/core/group_party.go +++ b/core/group_party.go @@ -710,7 +710,6 @@ func (gp *groupParty) ClientDisconnected(ctx wshandler.ApiCallContext) { Tag: []string{"MemberDocFull"}, }) - } } @@ -722,9 +721,27 @@ func (gp *groupParty) UpdatePartyMemberDocumentDirect(ctx wshandler.ApiCallConte } func (gp *groupParty) UpdatePartyDocumentDirect(ctx wshandler.ApiCallContext) { + // 파티 오너만 가능 gidobj, _ := primitive.ObjectIDFromHex(ctx.Arguments[0].(string)) doc := ctx.Arguments[1].(map[string]any) + gd := groupDoc{ + id: gidobj, + rh: gp.rh, + } + + incharge, err := gp.rh.JSONGet(gd.strid(), "$._incharge") + if err != nil { + logger.Println("UpdatePartyDocumentDirect failed. gp.rh.JSONGet returns err :", err) + return + } + + if !strings.Contains(incharge.(string), gd.tid(ctx.CallBy.Accid)) { + // incharge가 아니네? + logger.Println("UpdatePartyDocumentDirect failed. caller is not incharge") + return + } + gp.updatePartyDocument(gidobj, doc) }