Skip to content

Commit f298580

Browse files
committed
Merge pull request #177 from wangxiao/master
Release 2.3.3
2 parents c7b3601 + a95a299 commit f298580

File tree

7 files changed

+55
-14
lines changed

7 files changed

+55
-14
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "leancloud-realtime",
3-
"version": "2.3.2",
3+
"version": "2.3.3",
44
"homepage": "http://github.com/leancloud/js-realtime-sdk/",
55
"authors": [
66
"WangXiao <[email protected]>"

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 2.3.3
2+
### Bug Fixes
3+
* query 方法支持搜索多个 members 同时所在的房间
4+
* query 方法支持搜索多个 roomId 所在的 room 信息
5+
* 支持地位位置信息的传递
6+
17
## 2.3.2
28
### Features
39
* 支持 React Native

dist/AV.realtime.js

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var ajax = tool.ajax;
2323
var extend = tool.extend;
2424

2525
// 当前版本
26-
var VERSION = '2.3.2';
26+
var VERSION = '2.3.3';
2727

2828
// 配置项
2929
var config = {
@@ -579,7 +579,7 @@ var realtime = function realtime(options, callback) {
579579
};
580580

581581
var realtimeObj = newRealtimeObject();
582-
realtimeObj.clientId = options.clientId;
582+
realtimeObj.clientId = options.peerId;
583583
realtimeObj.cache.options = options;
584584
realtimeObj.cache.ec = tool.eventCenter();
585585
realtimeObj.cache.authFun = options.auth;
@@ -912,15 +912,32 @@ engine.send = function (cache, options) {
912912

913913
engine.convQuery = function (cache, options) {
914914
options = options || {};
915+
var where = options.where || {};
916+
917+
// 默认为包含自己的查询 {"m": peerId}
918+
where.m = where.m || cache.options.peerId;
919+
// 同时查找含有数组中 id 的用户所在的 conversation
920+
if (typeof where.m !== 'string') {
921+
where.m = {
922+
$all: where.m
923+
};
924+
}
925+
926+
// 批量查找 room 信息
927+
if (where.roomIds || where.convIds) {
928+
where.objectId = {
929+
$in: where.roomIds || where.convIds
930+
};
931+
// 避免对查询项产生干扰
932+
delete where.roomIds;
933+
delete where.convIds;
934+
}
935+
915936
engine.wsSend(cache, {
916937
cmd: 'conv',
917938
op: 'query',
918939
// where 可选,对象,默认为包含自己的查询 {"m": peerId}
919-
where: options.where || {
920-
m: cache.options.peerId
921-
// conversation 的 id
922-
// objectId: options.cid
923-
},
940+
where: where,
924941
// sort 可选,字符串,默认为 -lm,最近对话反序
925942
sort: options.sort || '-lm',
926943
// limit 可选,数字,默认10
@@ -1038,6 +1055,9 @@ engine.getMediaMsg = function (cache, msg) {
10381055
break;
10391056
case -5:
10401057
obj.type = 'location';
1058+
if (msg._lcloc) {
1059+
obj.location = msg._lcloc;
1060+
}
10411061
break;
10421062
case -6:
10431063
obj.type = 'file';

dist/AV.realtime.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/realtime.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var ajax = tool.ajax;
1313
var extend = tool.extend;
1414

1515
// 当前版本
16-
var VERSION = '2.3.2';
16+
var VERSION = '2.3.3';
1717

1818
// 配置项
1919
var config = {
@@ -903,6 +903,7 @@ engine.send = function (cache, options) {
903903
engine.convQuery = function (cache, options) {
904904
options = options || {};
905905
var where = options.where || {};
906+
906907
// 默认为包含自己的查询 {"m": peerId}
907908
where.m = where.m || cache.options.peerId;
908909
// 同时查找含有数组中 id 的用户所在的 conversation
@@ -911,10 +912,21 @@ engine.convQuery = function (cache, options) {
911912
$all: where.m
912913
};
913914
}
915+
916+
// 批量查找 room 信息
917+
if (where.roomIds || where.convIds) {
918+
where.objectId = {
919+
$in: where.roomIds || where.convIds
920+
};
921+
// 避免对查询项产生干扰
922+
delete where.roomIds;
923+
delete where.convIds;
924+
}
925+
914926
engine.wsSend(cache, {
915927
cmd: 'conv',
916928
op: 'query',
917-
// where 可选,查询条件
929+
// where 可选,对象,默认为包含自己的查询 {"m": peerId}
918930
where: where,
919931
// sort 可选,字符串,默认为 -lm,最近对话反序
920932
sort: options.sort || '-lm',
@@ -1033,6 +1045,9 @@ engine.getMediaMsg = function (cache, msg) {
10331045
break;
10341046
case -5:
10351047
obj.type = 'location';
1048+
if (msg._lcloc) {
1049+
obj.location = msg._lcloc;
1050+
}
10361051
break;
10371052
case -6:
10381053
obj.type = 'file';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "leancloud-realtime",
3-
"version": "2.3.2",
3+
"version": "2.3.3",
44
"description": "LeanCloud Realtime Message JavaScript SDK",
55
"main": "lib/realtime.js",
66
"directories": {

src/realtime.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var ajax = tool.ajax;
1313
var extend = tool.extend;
1414

1515
// 当前版本
16-
var VERSION = '2.3.2';
16+
var VERSION = '2.3.3';
1717

1818
// 配置项
1919
var config = {
@@ -569,7 +569,7 @@ var realtime = function(options, callback) {
569569
};
570570

571571
var realtimeObj = newRealtimeObject();
572-
realtimeObj.clientId = options.clientId;
572+
realtimeObj.clientId = options.peerId;
573573
realtimeObj.cache.options = options;
574574
realtimeObj.cache.ec = tool.eventCenter();
575575
realtimeObj.cache.authFun = options.auth;

0 commit comments

Comments
 (0)