@amityco/ts-sdk-react-native 6.26.3-3e5fb0d.0 → 6.26.4-2eb3673.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commentRepository/observers/getComments/CommentLiveCollectionController.d.ts.map +1 -1
- package/dist/commentRepository/observers/getComments/CommentQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers.d.ts.map +1 -1
- package/dist/index.cjs.js +36 -10
- package/dist/index.esm.js +36 -10
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
- package/src/commentRepository/observers/getComments/CommentLiveCollectionController.ts +32 -2
- package/src/commentRepository/observers/getComments/CommentQueryStreamController.ts +8 -2
- package/src/communityRepository/communityMembership/observers/getMembers.ts +0 -1
- package/src/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.ts +1 -1
- package/src/communityRepository/observers/searchCommunities/SearchCommunitiesLiveCollectionController.ts +1 -1
package/package.json
CHANGED
|
@@ -90,7 +90,7 @@ export class CommentLiveCollectionController extends LiveCollectionController<
|
|
|
90
90
|
|
|
91
91
|
const data = this.applyFilter(
|
|
92
92
|
collection.data
|
|
93
|
-
.map(id => pullFromCache<Amity.InternalComment>(['
|
|
93
|
+
.map(id => pullFromCache<Amity.InternalComment>(['comment', 'get', id])!)
|
|
94
94
|
.filter(isNonNullable)
|
|
95
95
|
.map(({ data }) => data) ?? [],
|
|
96
96
|
).map(LinkedObject.comment);
|
|
@@ -109,7 +109,7 @@ export class CommentLiveCollectionController extends LiveCollectionController<
|
|
|
109
109
|
applyFilter(data: Amity.InternalComment[]) {
|
|
110
110
|
let comments = data;
|
|
111
111
|
|
|
112
|
-
if (this.query.includeDeleted) {
|
|
112
|
+
if (!this.query.includeDeleted) {
|
|
113
113
|
comments = filterByPropEquality(comments, 'isDeleted', false);
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -117,6 +117,36 @@ export class CommentLiveCollectionController extends LiveCollectionController<
|
|
|
117
117
|
comments = comments.filter(comment => comment.parentId === this.query.parentId);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
+
if (typeof this.query.hasFlag === 'boolean') {
|
|
121
|
+
if (this.query.hasFlag) {
|
|
122
|
+
comments = comments.filter(comment => comment.hashFlag != null);
|
|
123
|
+
} else {
|
|
124
|
+
comments = comments.filter(comment => comment.hashFlag == null);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (this.query.dataTypes) {
|
|
129
|
+
if (this.query.dataTypes.matchType === 'exact') {
|
|
130
|
+
comments = comments.filter(comment => {
|
|
131
|
+
const sortedDataTypesQueryValue = this.query.dataTypes?.values.sort() || [];
|
|
132
|
+
const sortedDataTypesCommentValue = comment.dataTypes?.sort() || [];
|
|
133
|
+
|
|
134
|
+
if (sortedDataTypesCommentValue.length !== sortedDataTypesQueryValue.length) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return sortedDataTypesQueryValue.every(
|
|
139
|
+
(value, index) => value === sortedDataTypesCommentValue[index],
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
if (this.query.dataTypes.matchType === 'any') {
|
|
144
|
+
comments = comments.filter(comment =>
|
|
145
|
+
this.query.dataTypes?.values.some(value => comment.dataTypes?.includes(value)),
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
120
150
|
switch (this.query.sortBy) {
|
|
121
151
|
case 'firstCreated':
|
|
122
152
|
comments = comments.sort(sortByFirstCreated);
|
|
@@ -68,10 +68,16 @@ export class CommentQueryStreamController extends QueryStreamController<
|
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
if (this.query.parentId && this.query.parentId !== comment.parentId) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!this.query.parentId && comment.parentId) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
71
79
|
if (action === EnumCommentActions.OnCommentCreated) {
|
|
72
80
|
collection.data = [...new Set([comment.commentId, ...collection.data])];
|
|
73
|
-
} else if (action === EnumCommentActions.OnCommentDeleted) {
|
|
74
|
-
collection.data = collection.data.filter(p => p !== comment.commentId);
|
|
75
81
|
}
|
|
76
82
|
|
|
77
83
|
pushToCache(this.cacheKey, collection);
|
package/src/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.ts
CHANGED
|
@@ -117,7 +117,7 @@ export class CommunityLiveCollectionController extends LiveCollectionController<
|
|
|
117
117
|
|
|
118
118
|
let communities = data;
|
|
119
119
|
|
|
120
|
-
if (this.query.includeDeleted) {
|
|
120
|
+
if (!this.query.includeDeleted) {
|
|
121
121
|
communities = filterByPropEquality(communities, 'isDeleted', false);
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -106,7 +106,7 @@ export class SearchCommunityLiveCollectionController extends LiveCollectionContr
|
|
|
106
106
|
|
|
107
107
|
let communities = data;
|
|
108
108
|
|
|
109
|
-
if (this.query.includeDeleted) {
|
|
109
|
+
if (!this.query.includeDeleted) {
|
|
110
110
|
communities = filterByPropEquality(communities, 'isDeleted', false);
|
|
111
111
|
}
|
|
112
112
|
|