-
Notifications
You must be signed in to change notification settings - Fork 119
feat: friendship #626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: friendship #626
Conversation
Codecov Report
@@ Coverage Diff @@
## master #626 +/- ##
==========================================
- Coverage 64.24% 63.80% -0.44%
==========================================
Files 38 39 +1
Lines 3286 3318 +32
==========================================
+ Hits 2111 2117 +6
- Misses 1175 1201 +26
Continue to review full report at Codecov.
|
静态方法接受或拒绝好奇怪啊,你们真的决定要这么做了吗? |
你是倾向于直接通过请求对象接受、拒绝吗?比如: const query = new AV.Query('_FriendshipRequest');
query.equalTo('friend', AV.User.current());
query.equalTo('status', 'pending');
query.find().then((requests) => {
assert(requests.length > 2);
// 接受
requests[0].accept();
// 拒绝
requests[1].decline();
});这样也可以,5.0 就这样。但 5.0 有 Class 这个概念,可以很方便的返回特化的 Object 。没有在 4.x 这样实现是我想把实现这个功能所做的改动降到最低,但这种实现方式我没有意见。 |
是的。按你们计划的来叭。 |
903cb28 to
243b6d5
Compare
原本未计划在 4.x 版本实现「好友」,想了想还是实现一下吧,毕竟 4.x 在 5.0 发布后的很长一段时间内,仍会是主要使用版本。
之前未完成的实现,放在一起作参考。与其相比:
FriendShipQueryFriendshipRequestObjectJS SDK 双向好友功能内部文档
申请成为好友
当前登录用户申请成为 Tom 的好友:
申请的同时添加属性:
查询好友申请
如果 Tom 不在线,上线后要查询谁正在添加自己为好友:
订阅好友申请
当 Tom 上线时,执行以下代码可以订阅好友申请:
订阅当前用户的申请状态变更(被通过、被拒绝):
通过、拒绝好友申请
查询好友
删除好友
使用 unfollow 单向删除与 Tom 的好友关系:
设置自定义属性