차단 목록 관리 완료

This commit is contained in:
2023-09-21 16:52:41 +09:00
parent f9cec4cef3
commit a4c8b849fa
4 changed files with 94 additions and 108 deletions

View File

@ -299,6 +299,7 @@ func (fs *friends) DeleteFriend(ctx wshandler.ApiCallContext) {
"ts": now,
},
}, &yourdoc, options.FindOneAndUpdate().SetReturnDocument(options.After).SetUpsert(false)); err == nil {
logger.Println("delete friend your doc :", yourdoc)
fs.wsh.SendUpstreamMessage(&wshandler.UpstreamMessage{
Target: fdoc.To.Hex(),
Body: []friendDoc{yourdoc},
@ -369,23 +370,14 @@ func (fs *friends) QueryFriends(ctx wshandler.ApiCallContext) {
if len(myfriends) > 0 {
fs.conns.writeMessage(ctx.CallBy.Accid, &wshandler.DownstreamMessage{
Alias: ctx.CallBy.Alias,
Body: myfriends,
Tag: friends_tag,
Body: myfriends,
Tag: friends_tag,
})
}
}
func (fs *friends) Trim(ctx wshandler.ApiCallContext) {
stringsTobjs := func(in []any) (out []primitive.ObjectID) {
for _, i := range in {
p, _ := primitive.ObjectIDFromHex(i.(string))
out = append(out, p)
}
return
}
ids := stringsTobjs(ctx.Arguments[2].([]any))
ids := stringsToObjs(ctx.Arguments[1].([]any))
if len(ids) > 0 {
if len(ids) == 1 {
fs.mongoClient.Delete(friends_collection_name, bson.M{"_id": ids[0]})