Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit 37b36f8

Browse files
authored
Merge pull request #3136 from withspectrum/2.3.1
2.3.1
2 parents b0fd526 + 588d7e8 commit 37b36f8

File tree

5 files changed

+42
-34
lines changed

5 files changed

+42
-34
lines changed

api/queries/search/searchCommunities.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ export default (args: Args, { loaders, user }: GraphQLContext) => {
1212
return communitySearchIndex
1313
.search({ query: queryString })
1414
.then(content => {
15-
trackQueue.add({
16-
userId: user.id,
17-
event: events.SEARCHED_COMMUNITIES,
18-
properties: {
19-
queryString,
20-
hitsCount: content.hits ? content.hits.length : 0,
21-
},
22-
});
15+
if (user && user.id) {
16+
trackQueue.add({
17+
userId: user.id,
18+
event: events.SEARCHED_COMMUNITIES,
19+
properties: {
20+
queryString,
21+
hitsCount: content.hits ? content.hits.length : 0,
22+
},
23+
});
24+
}
2325

2426
if (!content.hits || content.hits.length === 0) return [];
2527
const communityIds = content.hits.map(o => o.objectID);

api/queries/search/searchCommunityMembers.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@ export default (args: Args, { loaders, user }: GraphQLContext) => {
1616
return usersSearchIndex
1717
.search({ query: queryString, hitsPerPage })
1818
.then(content => {
19-
trackQueue.add({
20-
userId: user.id,
21-
event: events.SEARCHED_COMMUNITY_MEMBERS,
22-
properties: {
23-
queryString,
24-
hitsCount: content.hits ? content.hits.length : 0,
25-
},
26-
});
19+
if (user && user.id) {
20+
trackQueue.add({
21+
userId: user.id,
22+
event: events.SEARCHED_COMMUNITY_MEMBERS,
23+
properties: {
24+
queryString,
25+
hitsCount: content.hits ? content.hits.length : 0,
26+
},
27+
});
28+
}
2729

2830
if (!content.hits || content.hits.length === 0) return [];
2931
// if no search filter was passed, there's no way to be searching for

api/queries/search/searchThreads.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,17 @@ export default async (args: Args, { loaders, user }: GraphQLContext) => {
3838
threadsSearchIndex
3939
.search({ query: queryString, filters })
4040
.then(content => {
41-
trackQueue.add({
42-
userId: user.id,
43-
event: events.SEARCHED_CONVERSATIONS,
44-
properties: {
45-
queryString,
46-
filters,
47-
hitsCount: content.hits ? content.hits.length : 0,
48-
},
49-
});
41+
if (user && user.id) {
42+
trackQueue.add({
43+
userId: user.id,
44+
event: events.SEARCHED_CONVERSATIONS,
45+
properties: {
46+
queryString,
47+
filters,
48+
hitsCount: content.hits ? content.hits.length : 0,
49+
},
50+
});
51+
}
5052

5153
if (!content.hits || content.hits.length === 0) return null;
5254
return content.hits.map(o => ({

api/queries/search/searchUsers.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@ export default (args: Args, { loaders, user }: GraphQLContext) => {
2121
? events.SEARCHED_COMMUNITY_MEMBERS
2222
: events.SEARCHED_USERS;
2323

24-
trackQueue.add({
25-
userId: user.id,
26-
event,
27-
properties: {
28-
queryString,
29-
hitsCount: content.hits ? content.hits.length : 0,
30-
},
31-
});
24+
if (user && user.id) {
25+
trackQueue.add({
26+
userId: user.id,
27+
event,
28+
properties: {
29+
queryString,
30+
hitsCount: content.hits ? content.hits.length : 0,
31+
},
32+
});
33+
}
3234

3335
if (!content.hits || content.hits.length === 0) return [];
3436

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Spectrum",
3-
"version": "2.3.0",
3+
"version": "2.3.1",
44
"license": "BSD-3-Clause",
55
"devDependencies": {
66
"babel-cli": "^6.24.1",

0 commit comments

Comments
 (0)