@plusscommunities/pluss-core-aws 1.2.5 → 1.2.6
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.
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const _ = require("lodash");
|
|
2
|
+
const getSessionUser = require("../auth/getSessionUser");
|
|
3
|
+
const getMatchingAudienceTypes = require("./getMatchingAudienceTypes");
|
|
4
|
+
const getMatchingTags = require("./getMatchingTags");
|
|
5
|
+
const isValidAudience = require("./isValidAudience");
|
|
6
|
+
|
|
7
|
+
module.exports = async (items, authkey, site) => {
|
|
8
|
+
const validTypes = await getMatchingAudienceTypes(authkey);
|
|
9
|
+
let validTags = [];
|
|
10
|
+
if (site) {
|
|
11
|
+
const userId = await getSessionUser(authkey);
|
|
12
|
+
validTags = await getMatchingTags(userId, site);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return _.filter(items, (item) => {
|
|
16
|
+
if (!item.AudienceType) return true;
|
|
17
|
+
|
|
18
|
+
if (item.AudienceType === "Custom") {
|
|
19
|
+
return _.some(item.AudienceTypeSelection, (at) =>
|
|
20
|
+
isValidAudience(
|
|
21
|
+
site,
|
|
22
|
+
at.AudienceType,
|
|
23
|
+
at.AudienceTypeSelection,
|
|
24
|
+
validTypes,
|
|
25
|
+
validTags
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return isValidAudience(
|
|
31
|
+
site,
|
|
32
|
+
item.AudienceType,
|
|
33
|
+
item.AudienceTypeSelection,
|
|
34
|
+
validTypes,
|
|
35
|
+
validTags
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
};
|
|
@@ -132,6 +132,9 @@ module.exports = async (site, audienceType, audienceTypeSelection) => {
|
|
|
132
132
|
site
|
|
133
133
|
);
|
|
134
134
|
|
|
135
|
+
// console.log("categoryMatches", categoryMatches);
|
|
136
|
+
// console.log("typeMatches", typeMatches);
|
|
137
|
+
// console.log("tagMatches", tagMatches);
|
|
135
138
|
return _.unionBy(categoryMatches, typeMatches, tagMatches, "id");
|
|
136
139
|
case "Category":
|
|
137
140
|
return await getCategoryMatches(users, audienceTypeSelection, site);
|
|
@@ -14,6 +14,11 @@ module.exports = (noti) => {
|
|
|
14
14
|
thisNoti.Subtext = noti.Data.title || noti.Data.description;
|
|
15
15
|
thisNoti.Icon = "wrench";
|
|
16
16
|
break;
|
|
17
|
+
case "EntityCommented":
|
|
18
|
+
thisNoti.Text = noti.Data.comment;
|
|
19
|
+
thisNoti.Subtext = noti.Data.title || noti.Data.description;
|
|
20
|
+
thisNoti.Icon = "commenting";
|
|
21
|
+
break;
|
|
17
22
|
case "EventRepChange":
|
|
18
23
|
let eventChangeText = "";
|
|
19
24
|
if (noti.Data.LocationChanged && noti.Data.TimeChanged) {
|