@openpeepshq/core 0.1.33 → 0.1.35
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/accessTokens/finders.js +5 -6
- package/dist/accessTokens/mutations.js +1 -1
- package/dist/accessTokens/tokens.js +8 -11
- package/dist/accounts/helpers.js +6 -2
- package/dist/accounts/mutations.js +36 -33
- package/dist/analytics/cache.js +3 -3
- package/dist/analytics/clicks.js +14 -22
- package/dist/analytics/compile.js +17 -12
- package/dist/analytics/dateRange.js +3 -5
- package/dist/analytics/jobs.js +3 -4
- package/dist/analytics/pdfReport.js +45 -61
- package/dist/analytics/privacy.js +1 -1
- package/dist/analytics/read.js +164 -140
- package/dist/analytics/report.d.ts +22 -1
- package/dist/analytics/report.js +2 -3
- package/dist/analytics/settings.js +3 -4
- package/dist/backups/index.js +82 -25
- package/dist/backups/metadata.d.ts +2 -3
- package/dist/backups/metadata.js +6 -2
- package/dist/config/db.js +2 -4
- package/dist/config/defaults/capabilities.js +13 -2
- package/dist/config/defaults/community.js +8 -3
- package/dist/config/defaults/core.d.ts +1 -1
- package/dist/config/defaults/core.js +16 -8
- package/dist/config/index.d.ts +22 -0
- package/dist/config/index.js +15 -11
- package/dist/db/explorer/query.js +9 -8
- package/dist/db/explorer/sql.js +8 -8
- package/dist/db/helpers.d.ts +1 -0
- package/dist/db/helpers.js +25 -7
- package/dist/db/index.d.ts +1 -1
- package/dist/db/index.js +1 -0
- package/dist/db/init.js +2 -3
- package/dist/db/migration/importCollections.d.ts +14 -9
- package/dist/db/migration/importCollections.js +121 -174
- package/dist/db/migration/shared.d.ts +2 -33
- package/dist/db/migration/shared.js +17 -87
- package/dist/db/pg/client.js +4 -7
- package/dist/db/pg/collections.d.ts +2 -2
- package/dist/db/pg/collections.js +2 -2
- package/dist/db/pg/filters/index.js +1 -1
- package/dist/db/pg/filters/posts.d.ts +12 -0
- package/dist/db/pg/filters/posts.js +30 -4
- package/dist/db/pg/filters/profiles.d.ts +1 -0
- package/dist/db/pg/filters/profiles.js +2 -1
- package/dist/db/pg/helpers.js +2 -14
- package/dist/db/pg/map/filters.js +40 -10
- package/dist/db/pg/map/helpers.js +5 -1
- package/dist/db/pg/map/index.js +46 -51
- package/dist/db/pg/map/mutations.js +65 -25
- package/dist/db/pg/map/registry.d.ts +5 -0
- package/dist/db/pg/map/registry.js +133 -56
- package/dist/db/pg/map/relations.js +76 -68
- package/dist/db/pg/map/search.js +15 -37
- package/dist/db/pg/mappers.js +13 -7
- package/dist/db/pg/migrate.d.ts +1 -2
- package/dist/db/pg/migrate.js +8 -9
- package/dist/db/pg/queries/activity.js +5 -5
- package/dist/db/pg/queries/derived.js +8 -12
- package/dist/db/pg/queries/sorts.d.ts +1 -0
- package/dist/db/pg/queries/sorts.js +4 -0
- package/dist/db/pg/schema/documents.d.ts +279 -41
- package/dist/db/pg/schema/documents.js +136 -22
- package/dist/db/pg/schema/edges.d.ts +116 -7
- package/dist/db/pg/schema/edges.js +9 -2
- package/dist/db/pg/schema/index.d.ts +362 -15
- package/dist/db/pg/schema/index.js +5 -1
- package/dist/db/pg/sql/0010_user_group_membership_roles.sql +16 -0
- package/dist/db/pg/sql/0011_drop_data_migrations.sql +1 -0
- package/dist/db/pg/sql/0012_posts_last_activity_at.sql +5 -0
- package/dist/db/pg/sql/0013_add_blocks_edge.sql +12 -0
- package/dist/db/pg/sql/0014_federation_datamodel.sql +59 -0
- package/dist/db/pg/sql/0015_profile_hashtags.sql +12 -0
- package/dist/db/pg/sql/0016_posts_search_vector_title_tags_path.sql +54 -0
- package/dist/db/pg/sql/meta/{0009_snapshot.json → 0015_snapshot.json} +291 -36
- package/dist/db/pg/sql/meta/_journal.json +49 -0
- package/dist/db/replaceOrigin.js +1 -1
- package/dist/email/queueStats.js +8 -11
- package/dist/email/render.js +14 -3
- package/dist/email/send.js +19 -17
- package/dist/email/smtpTest.js +10 -6
- package/dist/errors/index.js +1 -1
- package/dist/events/index.d.ts +4 -0
- package/dist/events/index.js +1 -0
- package/dist/events/once.js +2 -4
- package/dist/federation/activities.d.ts +17 -0
- package/dist/federation/activities.js +25 -0
- package/dist/federation/identity.d.ts +16 -0
- package/dist/federation/identity.js +52 -0
- package/dist/federation/index.d.ts +4 -0
- package/dist/federation/index.js +3 -0
- package/dist/federation/profiles.d.ts +3 -0
- package/dist/federation/profiles.js +14 -0
- package/dist/groups/finders.d.ts +2 -1
- package/dist/groups/helpers.d.ts +18 -0
- package/dist/groups/helpers.js +1 -2
- package/dist/groups/mapping.d.ts +4 -2
- package/dist/groups/mutations.js +1 -1
- package/dist/hashtags/finders.d.ts +6 -3
- package/dist/hashtags/finders.js +2 -0
- package/dist/hashtags/helpers.d.ts +8 -0
- package/dist/hashtags/helpers.js +4 -0
- package/dist/hashtags/index.d.ts +2 -0
- package/dist/hashtags/index.js +2 -0
- package/dist/hashtags/mutations.d.ts +3 -0
- package/dist/hashtags/mutations.js +13 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js +3 -1
- package/dist/i18n/pluginLocales.d.ts +6 -0
- package/dist/i18n/pluginLocales.js +15 -0
- package/dist/inviteLinks/mutations.js +2 -3
- package/dist/jams/export.d.ts +19 -0
- package/dist/jams/export.js +58 -0
- package/dist/jams/finders.js +4 -1
- package/dist/jams/health.d.ts +10 -0
- package/dist/jams/health.js +50 -0
- package/dist/jams/helpers.d.ts +2 -2
- package/dist/jams/helpers.js +6 -2
- package/dist/jams/index.d.ts +2 -0
- package/dist/jams/index.js +25 -18
- package/dist/jams/jobs.js +2 -3
- package/dist/jams/livekit.d.ts +49 -4
- package/dist/jams/livekit.js +62 -45
- package/dist/jams/mapping.d.ts +3 -3
- package/dist/jams/mutations.d.ts +1 -1
- package/dist/jams/recording.d.ts +10 -0
- package/dist/jams/recording.js +33 -1
- package/dist/jams/token.d.ts +13 -1
- package/dist/jams/token.js +25 -18
- package/dist/jams/waitingRoom.js +1 -1
- package/dist/jobs/index.d.ts +1 -0
- package/dist/jobs/index.js +9 -3
- package/dist/jobs/jobDetail.js +6 -12
- package/dist/jobs/jobLog.js +2 -3
- package/dist/lib/streams.js +4 -39
- package/dist/lib/zodDeepPartial.d.ts +1 -1
- package/dist/lib/zodDeepPartial.js +1 -1
- package/dist/log/index.js +13 -29
- package/dist/media/index.d.ts +1 -1
- package/dist/media/index.js +73 -12
- package/dist/media/jobs.js +1 -2
- package/dist/media/openpeeps/index.js +11 -46
- package/dist/media/processing.js +25 -11
- package/dist/media/streaming.js +5 -5
- package/dist/media/streamingCleanupJobs.js +1 -2
- package/dist/media/streamingJobs.js +3 -4
- package/dist/media/streamingPrewarm.js +7 -11
- package/dist/mediaAttachments/index.js +6 -2
- package/dist/notifications/defaultNotifications/announcement/index.js +15 -18
- package/dist/notifications/defaultNotifications/directMessage/index.js +9 -8
- package/dist/notifications/defaultNotifications/follow/index.js +15 -18
- package/dist/notifications/defaultNotifications/groupAdded/index.js +14 -17
- package/dist/notifications/defaultNotifications/groupMemberJoined/index.js +15 -18
- package/dist/notifications/defaultNotifications/groupMemberLeft/index.js +15 -18
- package/dist/notifications/defaultNotifications/index.js +4 -0
- package/dist/notifications/defaultNotifications/jamModerator/index.js +3 -5
- package/dist/notifications/defaultNotifications/jamSpeaker/index.js +14 -18
- package/dist/notifications/defaultNotifications/jamStarted/index.js +18 -22
- package/dist/notifications/defaultNotifications/mention/index.js +20 -24
- package/dist/notifications/defaultNotifications/newGroupPost/index.js +11 -6
- package/dist/notifications/defaultNotifications/newProfile/index.js +14 -17
- package/dist/notifications/defaultNotifications/pollEnded/index.d.ts +19 -0
- package/dist/notifications/defaultNotifications/pollEnded/index.js +39 -0
- package/dist/notifications/defaultNotifications/pollEnded/recipients.d.ts +3 -0
- package/dist/notifications/defaultNotifications/pollEnded/recipients.js +17 -0
- package/dist/notifications/defaultNotifications/pollVote/index.js +14 -17
- package/dist/notifications/defaultNotifications/reaction/index.js +18 -21
- package/dist/notifications/defaultNotifications/reply/index.js +21 -22
- package/dist/notifications/defaultNotifications/repost/index.js +16 -20
- package/dist/notifications/defaultNotifications/rsvp/index.d.ts +6 -1
- package/dist/notifications/defaultNotifications/rsvp/index.js +31 -18
- package/dist/notifications/defaultNotifications/rsvpCanceled/index.d.ts +24 -0
- package/dist/notifications/defaultNotifications/rsvpCanceled/index.js +82 -0
- package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.d.ts +4 -0
- package/dist/notifications/defaultNotifications/rsvpCanceled/recipients.js +11 -0
- package/dist/notifications/fcmCredential.js +1 -1
- package/dist/notifications/finders.js +1 -1
- package/dist/notifications/helpers.js +13 -10
- package/dist/notifications/jobs.js +10 -5
- package/dist/notifications/mutations.js +8 -1
- package/dist/notifications/push.js +11 -16
- package/dist/performance/index.js +3 -3
- package/dist/plugins/helpers.js +3 -6
- package/dist/plugins/index.js +39 -4
- package/dist/plugins/install.d.ts +28 -9
- package/dist/plugins/install.js +302 -56
- package/dist/plugins/pluginAuth.d.ts +1 -1
- package/dist/plugins/pluginAuth.js +13 -10
- package/dist/plugins/state.js +2 -3
- package/dist/posts/activity.d.ts +9 -0
- package/dist/posts/activity.js +34 -0
- package/dist/posts/contextClosure.d.ts +1 -9
- package/dist/posts/contextClosure.js +14 -44
- package/dist/posts/conversationQueries.d.ts +7 -0
- package/dist/posts/conversationQueries.js +76 -4
- package/dist/posts/eventAgenda.d.ts +1 -0
- package/dist/posts/eventAgenda.js +17 -8
- package/dist/posts/eventOccurrenceJobs.js +7 -2
- package/dist/posts/eventOccurrences.d.ts +6 -0
- package/dist/posts/eventOccurrences.js +22 -1
- package/dist/posts/finders.d.ts +56 -9
- package/dist/posts/finders.js +84 -23
- package/dist/posts/helpers/filters.js +13 -9
- package/dist/posts/helpers/index.d.ts +179 -14
- package/dist/posts/helpers/index.js +70 -34
- package/dist/posts/index.d.ts +5 -2
- package/dist/posts/index.js +5 -2
- package/dist/posts/mapping.d.ts +765 -30
- package/dist/posts/mapping.js +74 -31
- package/dist/posts/mutations.d.ts +516 -3
- package/dist/posts/mutations.js +179 -41
- package/dist/posts/pollEnd.d.ts +3 -0
- package/dist/posts/pollEnd.js +4 -0
- package/dist/posts/pollEndJobs.d.ts +8 -0
- package/dist/posts/pollEndJobs.js +49 -0
- package/dist/posts/replyClosure.d.ts +10 -0
- package/dist/posts/replyClosure.js +43 -0
- package/dist/posts/rsvpConfirmationEmail.js +23 -15
- package/dist/posts/threadPreview.d.ts +8 -0
- package/dist/posts/threadPreview.js +44 -0
- package/dist/posts/unseenCounts.js +4 -1
- package/dist/processingStats/queries.js +6 -7
- package/dist/profileSettings/cache.js +21 -5
- package/dist/profileSettings/mapping.d.ts +2 -0
- package/dist/profiles/activityQueries.d.ts +5 -0
- package/dist/profiles/activityQueries.js +85 -0
- package/dist/profiles/activitySummary.d.ts +3 -0
- package/dist/profiles/activitySummary.js +82 -0
- package/dist/profiles/blocks.d.ts +12 -0
- package/dist/profiles/blocks.js +73 -0
- package/dist/profiles/cache.d.ts +1 -0
- package/dist/profiles/cache.js +30 -10
- package/dist/profiles/export.js +30 -39
- package/dist/profiles/finders.d.ts +2 -1
- package/dist/profiles/finders.js +15 -8
- package/dist/profiles/helpers.d.ts +2 -0
- package/dist/profiles/index.d.ts +2 -0
- package/dist/profiles/index.js +2 -0
- package/dist/profiles/mapping.d.ts +10 -5
- package/dist/profiles/mapping.js +13 -1
- package/dist/profiles/mutations.d.ts +8 -4
- package/dist/profiles/mutations.js +31 -4
- package/dist/redis/connection.d.ts +2 -0
- package/dist/redis/connection.js +25 -6
- package/dist/reports/helpers.js +7 -3
- package/dist/roles/index.d.ts +1 -1
- package/dist/roles/index.js +1 -1
- package/dist/roles/mapping.d.ts +1 -0
- package/dist/roles/mutations.js +85 -3
- package/dist/search/finders.js +15 -3
- package/dist/search/helpers.js +1 -1
- package/dist/search/mapping.d.ts +1 -1
- package/dist/search/mapping.js +6 -2
- package/dist/sentry/index.js +9 -11
- package/dist/seo/index.d.ts +50 -0
- package/dist/seo/index.js +145 -0
- package/dist/seo/route.d.ts +18 -0
- package/dist/seo/route.js +19 -0
- package/dist/server/index.d.ts +19 -0
- package/dist/server/index.js +31 -14
- package/dist/server/stablePublicServerInfo.d.ts +17 -0
- package/dist/server/stablePublicServerInfo.js +37 -0
- package/dist/server/status.d.ts +25 -0
- package/dist/server/status.js +97 -0
- package/dist/session/index.js +2 -2
- package/dist/stats/finders.d.ts +1 -17681
- package/dist/stats/finders.js +22 -9
- package/dist/stats/helpers.js +4 -1
- package/dist/stats/mapping.d.ts +39 -2
- package/dist/stats/mapping.js +8 -4
- package/dist/stripe/cache.js +5 -6
- package/dist/stripe/connection.js +3 -4
- package/dist/stripe/helpers.js +15 -20
- package/package.json +5 -7
- package/dist/db/migration/detect.d.ts +0 -3
- package/dist/db/migration/detect.js +0 -33
- package/dist/db/migration/importPostgres.d.ts +0 -3
- package/dist/db/migration/importPostgres.js +0 -18
- package/dist/db/migration/transform.d.ts +0 -20
- package/dist/db/migration/transform.js +0 -232
- package/dist/db/migration/validate.d.ts +0 -18
- package/dist/db/migration/validate.js +0 -69
- package/dist/db/pg/sql/meta/0000_snapshot.json +0 -3380
- package/dist/db/pg/sql/meta/0004_snapshot.json +0 -4114
- package/dist/db/pg/sql/meta/0005_snapshot.json +0 -4179
- package/dist/db/pg/sql/meta/0006_snapshot.json +0 -4200
- package/dist/db/pg/sql/meta/0007_snapshot.json +0 -4179
- package/dist/mastodon/index.d.ts +0 -4
- package/dist/mastodon/index.js +0 -51
- package/dist/mastodon/types.d.ts +0 -7579
- package/dist/mastodon/types.js +0 -523
- package/dist/mastodon/typescript.d.ts +0 -1578
- package/dist/mastodon/typescript.js +0 -1
- package/dist/migration/index.d.ts +0 -4
- package/dist/migration/index.js +0 -4
- package/dist/roles/defaults.d.ts +0 -2
- package/dist/roles/defaults.js +0 -95
|
@@ -4,9 +4,8 @@ import { maybeCreateNotification } from '@openpeepshq/core/notifications';
|
|
|
4
4
|
import { profileName } from '@openpeepshq/common/lib';
|
|
5
5
|
import { PUSH_INVALIDATE } from '../../pushInvalidation.js';
|
|
6
6
|
const eventHandler = async (eventData) => {
|
|
7
|
-
var _a, _b;
|
|
8
7
|
const post = eventData;
|
|
9
|
-
const jam =
|
|
8
|
+
const jam = post.data?.type === 'event' && post.data?.jam;
|
|
10
9
|
if (!jam) {
|
|
11
10
|
return;
|
|
12
11
|
}
|
|
@@ -22,22 +21,19 @@ const eventHandler = async (eventData) => {
|
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
};
|
|
25
|
-
const pushRenderer = async (notification) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
39
|
-
});
|
|
40
|
-
};
|
|
24
|
+
const pushRenderer = async (notification) => ({
|
|
25
|
+
title: `${profileName(notification.senderProfile)} invited you to speak at a jam`,
|
|
26
|
+
options: {
|
|
27
|
+
body: (notification.post?.data).name,
|
|
28
|
+
actions: [
|
|
29
|
+
{
|
|
30
|
+
action: `goto:/events/${notification.post?.id}/jam`,
|
|
31
|
+
title: 'Join Jam',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
36
|
+
});
|
|
41
37
|
export default {
|
|
42
38
|
event: 'postCreated',
|
|
43
39
|
type: 'jamSpeaker',
|
|
@@ -3,15 +3,14 @@ import { maybeCreateNotification } from '@openpeepshq/core/notifications';
|
|
|
3
3
|
import { profileName } from '@openpeepshq/common/lib';
|
|
4
4
|
import { PUSH_INVALIDATE } from '../../pushInvalidation.js';
|
|
5
5
|
const eventHandler = async (...args) => {
|
|
6
|
-
var _a, _b;
|
|
7
6
|
const [profile, post] = args;
|
|
8
|
-
const jam =
|
|
7
|
+
const jam = post.data?.type === 'event' && post.data?.jam;
|
|
9
8
|
if (!jam) {
|
|
10
9
|
return;
|
|
11
10
|
}
|
|
12
11
|
if (['local', 'public'].includes(post.visibility)) {
|
|
13
12
|
for (const recipientProfile of await listProfiles()) {
|
|
14
|
-
if (profile.id !==
|
|
13
|
+
if (profile.id !== recipientProfile?.id) {
|
|
15
14
|
await maybeCreateNotification(recipientProfile, {
|
|
16
15
|
type: 'jamStarted',
|
|
17
16
|
fromProfileId: profile.id,
|
|
@@ -24,7 +23,7 @@ const eventHandler = async (...args) => {
|
|
|
24
23
|
const recipients = new Set();
|
|
25
24
|
const skipRecipient = (recipient) => !profile ||
|
|
26
25
|
!recipient ||
|
|
27
|
-
profile.id ===
|
|
26
|
+
profile.id === recipient?.id ||
|
|
28
27
|
recipients.has(recipient);
|
|
29
28
|
if (jam.moderators) {
|
|
30
29
|
for (const id of [...jam.moderators, ...(jam.speakers || [])]) {
|
|
@@ -36,7 +35,7 @@ const eventHandler = async (...args) => {
|
|
|
36
35
|
}
|
|
37
36
|
if (post.audience) {
|
|
38
37
|
for (const audience of post.audience) {
|
|
39
|
-
const audienceProfile = await findProfile(audience
|
|
38
|
+
const audienceProfile = await findProfile(audience?.id);
|
|
40
39
|
if (skipRecipient(audienceProfile))
|
|
41
40
|
continue;
|
|
42
41
|
recipients.add(audienceProfile);
|
|
@@ -44,7 +43,7 @@ const eventHandler = async (...args) => {
|
|
|
44
43
|
}
|
|
45
44
|
if (post.visibility === 'group' && post.group) {
|
|
46
45
|
for (const { profile: recipient } of await listGroupMembers(post.group)) {
|
|
47
|
-
const recipientProfile = await findProfile(recipient
|
|
46
|
+
const recipientProfile = await findProfile(recipient?.id);
|
|
48
47
|
if (skipRecipient(recipientProfile))
|
|
49
48
|
continue;
|
|
50
49
|
recipients.add(recipientProfile);
|
|
@@ -58,22 +57,19 @@ const eventHandler = async (...args) => {
|
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
59
|
};
|
|
61
|
-
const pushRenderer = async (notification) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
75
|
-
});
|
|
76
|
-
};
|
|
60
|
+
const pushRenderer = async (notification) => ({
|
|
61
|
+
title: `${profileName(notification.senderProfile)} started a jam`,
|
|
62
|
+
options: {
|
|
63
|
+
body: notification.post?.data?.name,
|
|
64
|
+
actions: [
|
|
65
|
+
{
|
|
66
|
+
action: `goto:/events/${notification.post?.id}/jam`,
|
|
67
|
+
title: 'Join Jam',
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
72
|
+
});
|
|
77
73
|
export default {
|
|
78
74
|
event: 'jamStarted',
|
|
79
75
|
type: 'jamStarted',
|
|
@@ -7,16 +7,15 @@ import { getProfileAvatar, profileName } from '@openpeepshq/common/lib';
|
|
|
7
7
|
import { communityConfig } from '../../../config/index.js';
|
|
8
8
|
import { PUSH_INVALIDATE } from '../../pushInvalidation.js';
|
|
9
9
|
const getMentionedProfiles = async (post) => {
|
|
10
|
-
var _a, _b;
|
|
11
10
|
const byId = new Map();
|
|
12
|
-
for (const mention of
|
|
11
|
+
for (const mention of post.mentions ?? []) {
|
|
13
12
|
const profile = mention.profile;
|
|
14
|
-
if (profile
|
|
13
|
+
if (profile?.id) {
|
|
15
14
|
byId.set(profile.id, profile);
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
if (byId.size === 0) {
|
|
19
|
-
for (const handle of extractMentionHandles(
|
|
18
|
+
for (const handle of extractMentionHandles(post.data?.content)) {
|
|
20
19
|
const profile = await findProfileByHandle(handle);
|
|
21
20
|
if (profile) {
|
|
22
21
|
byId.set(profile.id, profile);
|
|
@@ -30,9 +29,8 @@ export default {
|
|
|
30
29
|
event: 'postCreated',
|
|
31
30
|
defaultSettings: notificationAll,
|
|
32
31
|
eventHandler: async (data) => {
|
|
33
|
-
var _a, _b;
|
|
34
32
|
const post = data;
|
|
35
|
-
if (
|
|
33
|
+
if (post.data?.type === 'event') {
|
|
36
34
|
return;
|
|
37
35
|
}
|
|
38
36
|
if (post.visibility === 'direct') {
|
|
@@ -45,7 +43,8 @@ export default {
|
|
|
45
43
|
let replyTargetProfileId;
|
|
46
44
|
if (post.inReplyToId) {
|
|
47
45
|
const repliedPost = await findPost(post.inReplyToId);
|
|
48
|
-
replyTargetProfileId =
|
|
46
|
+
replyTargetProfileId = repliedPost?.profile
|
|
47
|
+
?.id;
|
|
49
48
|
}
|
|
50
49
|
const notified = new Set();
|
|
51
50
|
for (const mentionedProfile of mentionedProfiles) {
|
|
@@ -69,21 +68,18 @@ export default {
|
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
70
|
},
|
|
72
|
-
pushRenderer: async (notification) => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
87
|
-
});
|
|
88
|
-
},
|
|
71
|
+
pushRenderer: async (notification) => ({
|
|
72
|
+
title: `${profileName(notification.senderProfile)} mentioned you`,
|
|
73
|
+
options: {
|
|
74
|
+
body: notification.post?.data?.content,
|
|
75
|
+
icon: getProfileAvatar(notification.senderProfile, await communityConfig()),
|
|
76
|
+
actions: [
|
|
77
|
+
{
|
|
78
|
+
action: `goto:/posts/${notification.post?.id}`,
|
|
79
|
+
title: 'Go to post',
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
84
|
+
}),
|
|
89
85
|
};
|
|
@@ -22,21 +22,26 @@ const eventHandler = async (data) => {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
const pushRenderer = async (notification) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const isRepost = !!notification.post?.repost;
|
|
26
|
+
const preview = notification.post?.repost ?? notification.post;
|
|
27
|
+
const name = profileName(notification.post?.profile);
|
|
28
|
+
const group = notification.group?.displayName;
|
|
29
|
+
return {
|
|
30
|
+
title: isRepost
|
|
31
|
+
? `${name} reposted a post in ${group}`
|
|
32
|
+
: `${name} made a post in ${group}`,
|
|
28
33
|
options: {
|
|
29
|
-
body:
|
|
34
|
+
body: preview?.data?.content,
|
|
30
35
|
icon: getGroupAvatar(notification.group, await communityConfig()),
|
|
31
36
|
actions: [
|
|
32
37
|
{
|
|
33
|
-
action: `goto:/groups/@${
|
|
38
|
+
action: `goto:/groups/@${notification.group?.handle}`,
|
|
34
39
|
title: 'Go to post',
|
|
35
40
|
},
|
|
36
41
|
],
|
|
37
42
|
},
|
|
38
43
|
invalidateQueries: [PUSH_INVALIDATE.posts, PUSH_INVALIDATE.unseenCounts],
|
|
39
|
-
}
|
|
44
|
+
};
|
|
40
45
|
};
|
|
41
46
|
export default {
|
|
42
47
|
type: 'newGroupPost',
|
|
@@ -20,21 +20,18 @@ export default {
|
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
|
-
pushRenderer: async (notification) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
invalidateQueries: [PUSH_INVALIDATE.profiles],
|
|
38
|
-
});
|
|
39
|
-
},
|
|
23
|
+
pushRenderer: async (notification) => ({
|
|
24
|
+
title: `New user ${profileName(notification.senderProfile)} joined`,
|
|
25
|
+
options: {
|
|
26
|
+
body: "Let's welcome them!",
|
|
27
|
+
icon: getProfileAvatar(notification.senderProfile, await communityConfig()),
|
|
28
|
+
actions: [
|
|
29
|
+
{
|
|
30
|
+
action: `goto:/@${notification.senderProfile?.handle}`,
|
|
31
|
+
title: 'View Profile',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
invalidateQueries: [PUSH_INVALIDATE.profiles],
|
|
36
|
+
}),
|
|
40
37
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ExpandedNotification } from '@openpeepshq/common/types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
type: string;
|
|
4
|
+
event: string;
|
|
5
|
+
eventHandler: (data: unknown) => Promise<void>;
|
|
6
|
+
pushRenderer: (notification: ExpandedNotification) => Promise<{
|
|
7
|
+
title: string;
|
|
8
|
+
options: {
|
|
9
|
+
body: string | undefined;
|
|
10
|
+
icon: string;
|
|
11
|
+
actions: {
|
|
12
|
+
action: string;
|
|
13
|
+
title: string;
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
16
|
+
invalidateQueries: string[][];
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { maybeCreateNotification } from '@openpeepshq/core/notifications';
|
|
2
|
+
import { getProfileAvatar } from '@openpeepshq/common/lib';
|
|
3
|
+
import { communityConfig } from '../../../config/index.js';
|
|
4
|
+
import { PUSH_INVALIDATE } from '../../pushInvalidation.js';
|
|
5
|
+
import { pollEndedRecipientProfiles } from './recipients.js';
|
|
6
|
+
const eventHandler = async (data) => {
|
|
7
|
+
const post = data;
|
|
8
|
+
if (post.data?.type !== 'question') {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const fromProfileId = post.profile?.id;
|
|
12
|
+
for (const recipient of pollEndedRecipientProfiles(post)) {
|
|
13
|
+
await maybeCreateNotification(recipient, {
|
|
14
|
+
type: 'pollEnded',
|
|
15
|
+
postId: post.id,
|
|
16
|
+
...(fromProfileId ? { fromProfileId } : {}),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const pushRenderer = async (notification) => ({
|
|
21
|
+
title: 'A poll has ended',
|
|
22
|
+
options: {
|
|
23
|
+
body: notification.post?.data?.content,
|
|
24
|
+
icon: getProfileAvatar(notification.senderProfile ?? notification.post?.profile, await communityConfig()),
|
|
25
|
+
actions: [
|
|
26
|
+
{
|
|
27
|
+
action: `goto:/posts/${notification.post?.id}`,
|
|
28
|
+
title: 'See Results',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
33
|
+
});
|
|
34
|
+
export default {
|
|
35
|
+
type: 'pollEnded',
|
|
36
|
+
event: 'pollEnded',
|
|
37
|
+
eventHandler,
|
|
38
|
+
pushRenderer,
|
|
39
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { collectVotes } from '@openpeepshq/common/lib';
|
|
2
|
+
const addProfile = (byId, profile) => {
|
|
3
|
+
if (profile?.id) {
|
|
4
|
+
byId.set(profile.id, profile);
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
/** Poll author, voters, and parent post author when the poll is a reply. */
|
|
8
|
+
export const pollEndedRecipientProfiles = (post) => {
|
|
9
|
+
const byId = new Map();
|
|
10
|
+
addProfile(byId, post.profile);
|
|
11
|
+
addProfile(byId, post.replyTo?.profile);
|
|
12
|
+
const { votes } = collectVotes(post);
|
|
13
|
+
for (const vote of votes) {
|
|
14
|
+
addProfile(byId, vote.profile);
|
|
15
|
+
}
|
|
16
|
+
return [...byId.values()];
|
|
17
|
+
};
|
|
@@ -15,23 +15,20 @@ const eventHandler = async (senderProfile, post, data) => {
|
|
|
15
15
|
fromProfileId: fromProfile.id,
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
|
-
const pushRenderer = async (notification) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
33
|
-
});
|
|
34
|
-
};
|
|
18
|
+
const pushRenderer = async (notification) => ({
|
|
19
|
+
title: `New vote on your poll by ${profileName(notification.senderProfile)}`,
|
|
20
|
+
options: {
|
|
21
|
+
body: notification.post?.data?.content,
|
|
22
|
+
icon: getProfileAvatar(notification.senderProfile, await communityConfig()),
|
|
23
|
+
actions: [
|
|
24
|
+
{
|
|
25
|
+
action: `goto:/posts/${notification.post?.id}`,
|
|
26
|
+
title: 'View Poll',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
31
|
+
});
|
|
35
32
|
export default {
|
|
36
33
|
type: 'pollVote',
|
|
37
34
|
event: 'entryCreated',
|
|
@@ -6,30 +6,27 @@ import { PUSH_INVALIDATE } from '../../pushInvalidation.js';
|
|
|
6
6
|
export default {
|
|
7
7
|
type: 'reaction',
|
|
8
8
|
event: 'reactionCreated',
|
|
9
|
-
pushRenderer: async (notification) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
27
|
-
});
|
|
28
|
-
},
|
|
9
|
+
pushRenderer: async (notification) => ({
|
|
10
|
+
title: profileName(notification.senderProfile) +
|
|
11
|
+
' reacted with ' +
|
|
12
|
+
notification.data.reaction +
|
|
13
|
+
' to your post',
|
|
14
|
+
options: {
|
|
15
|
+
body: notification.post?.data?.content,
|
|
16
|
+
icon: getProfileAvatar(notification.senderProfile, await communityConfig()),
|
|
17
|
+
actions: [
|
|
18
|
+
{
|
|
19
|
+
action: `goto:/posts/${notification.post?.id}`,
|
|
20
|
+
title: 'Go to post',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
25
|
+
}),
|
|
29
26
|
eventHandler: async (...eventData) => {
|
|
30
27
|
const [profile, post, data] = eventData;
|
|
31
28
|
const recipientProfile = await findProfile(post.profile.id);
|
|
32
|
-
if (recipientProfile &&
|
|
29
|
+
if (recipientProfile && recipientProfile?.id !== profile.id) {
|
|
33
30
|
await maybeCreateNotification(recipientProfile, {
|
|
34
31
|
type: 'reaction',
|
|
35
32
|
fromProfileId: profile.id,
|
|
@@ -10,9 +10,8 @@ export default {
|
|
|
10
10
|
event: 'postCreated',
|
|
11
11
|
defaultSettings: notificationAll,
|
|
12
12
|
eventHandler: async (data) => {
|
|
13
|
-
var _a, _b, _c;
|
|
14
13
|
const post = data;
|
|
15
|
-
if (
|
|
14
|
+
if (post.data?.type === 'event') {
|
|
16
15
|
return;
|
|
17
16
|
}
|
|
18
17
|
if (post.visibility === 'direct') {
|
|
@@ -22,7 +21,7 @@ export default {
|
|
|
22
21
|
return;
|
|
23
22
|
}
|
|
24
23
|
const repliedPost = await findPost(post.inReplyToId);
|
|
25
|
-
const targetProfile = await findProfile(
|
|
24
|
+
const targetProfile = await findProfile(repliedPost?.profile?.id ?? '');
|
|
26
25
|
if (targetProfile && targetProfile.id !== post.profile.id) {
|
|
27
26
|
await maybeCreateNotification(targetProfile, {
|
|
28
27
|
type: 'reply',
|
|
@@ -34,24 +33,24 @@ export default {
|
|
|
34
33
|
});
|
|
35
34
|
}
|
|
36
35
|
},
|
|
37
|
-
expander: async (notification) => (
|
|
36
|
+
expander: async (notification) => ({
|
|
37
|
+
...notification,
|
|
38
|
+
data: {
|
|
38
39
|
replyPost: await findPost(notification.data.replyPostId),
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
56
|
-
},
|
|
40
|
+
},
|
|
41
|
+
}),
|
|
42
|
+
pushRenderer: async (notification) => ({
|
|
43
|
+
title: `${profileName(notification.senderProfile)} replied your post`,
|
|
44
|
+
options: {
|
|
45
|
+
body: notification.post?.data?.content,
|
|
46
|
+
icon: getProfileAvatar(notification.senderProfile, await communityConfig()),
|
|
47
|
+
actions: [
|
|
48
|
+
{
|
|
49
|
+
action: `goto:/posts/${notification.post?.id}`,
|
|
50
|
+
title: 'Go to post',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
55
|
+
}),
|
|
57
56
|
};
|
|
@@ -7,13 +7,12 @@ export default {
|
|
|
7
7
|
type: 'repost',
|
|
8
8
|
event: 'postCreated',
|
|
9
9
|
eventHandler: async (data) => {
|
|
10
|
-
var _a;
|
|
11
10
|
const post = data;
|
|
12
|
-
if (
|
|
11
|
+
if (post.data?.type === 'event')
|
|
13
12
|
return;
|
|
14
13
|
if (post.repost) {
|
|
15
14
|
const recipientProfile = await findProfile(post.repost.profile.id);
|
|
16
|
-
if (recipientProfile &&
|
|
15
|
+
if (recipientProfile && recipientProfile?.id !== post.profile.id) {
|
|
17
16
|
await maybeCreateNotification(recipientProfile, {
|
|
18
17
|
type: 'repost',
|
|
19
18
|
postId: post.repost.id,
|
|
@@ -22,21 +21,18 @@ export default {
|
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
},
|
|
25
|
-
pushRenderer: async (notification) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
40
|
-
});
|
|
41
|
-
},
|
|
24
|
+
pushRenderer: async (notification) => ({
|
|
25
|
+
title: `${profileName(notification.senderProfile)} reposted your post`,
|
|
26
|
+
options: {
|
|
27
|
+
body: notification.post?.data?.content,
|
|
28
|
+
icon: getProfileAvatar(notification.senderProfile, await communityConfig()),
|
|
29
|
+
actions: [
|
|
30
|
+
{
|
|
31
|
+
action: `goto:/posts/${notification.post?.id}`,
|
|
32
|
+
title: 'Go to post',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
37
|
+
}),
|
|
42
38
|
};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ExpandedNotification } from '@openpeepshq/common/types';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
type: string;
|
|
4
4
|
event: string;
|
|
5
|
+
defaultSettings: {
|
|
6
|
+
readonly create: true;
|
|
7
|
+
readonly push: true;
|
|
8
|
+
readonly email: true;
|
|
9
|
+
};
|
|
5
10
|
eventHandler: (senderProfile: unknown, post: unknown, data: unknown) => Promise<void>;
|
|
6
11
|
pushRenderer: (notification: ExpandedNotification) => Promise<{
|
|
7
12
|
title: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { notificationAll, } from '@openpeepshq/common/types';
|
|
1
2
|
import { maybeCreateNotification } from '@openpeepshq/core/notifications';
|
|
2
|
-
import { getProfileAvatar, profileName } from '@openpeepshq/common/lib';
|
|
3
|
+
import { getProfileAvatar, profileName, rsvpTargetsPastEvent, } from '@openpeepshq/common/lib';
|
|
3
4
|
import { communityConfig } from '../../../config/index.js';
|
|
4
5
|
import { PUSH_INVALIDATE } from '../../pushInvalidation.js';
|
|
5
6
|
const eventHandler = async (senderProfile, post, data) => {
|
|
@@ -9,32 +10,44 @@ const eventHandler = async (senderProfile, post, data) => {
|
|
|
9
10
|
if (entryData.type !== 'rsvp') {
|
|
10
11
|
return;
|
|
11
12
|
}
|
|
13
|
+
// Cancellations use rsvpCanceled. A plain "no" or organizer removal is not an RSVP.
|
|
14
|
+
const response = entryData.data.response;
|
|
15
|
+
if (response !== 'yes' && response !== 'tentative') {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
// RSVPs to a finished event are still stored; they just should not notify.
|
|
19
|
+
const payload = data;
|
|
20
|
+
if (mergedPost.data?.type === 'event' &&
|
|
21
|
+
rsvpTargetsPastEvent(mergedPost.data, {
|
|
22
|
+
occurrenceIds: payload.occurrenceIds,
|
|
23
|
+
recurrenceId: entryData.data.recurrenceId,
|
|
24
|
+
})) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
12
27
|
await maybeCreateNotification(mergedPost.profile, {
|
|
13
28
|
type: 'rsvp',
|
|
14
29
|
postId: mergedPost.id,
|
|
15
30
|
fromProfileId: fromProfile.id,
|
|
16
31
|
});
|
|
17
32
|
};
|
|
18
|
-
const pushRenderer = async (notification) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
33
|
-
});
|
|
34
|
-
};
|
|
33
|
+
const pushRenderer = async (notification) => ({
|
|
34
|
+
title: `${profileName(notification.senderProfile)} RSVP'd to your event`,
|
|
35
|
+
options: {
|
|
36
|
+
body: notification.post?.data?.content,
|
|
37
|
+
icon: getProfileAvatar(notification.senderProfile, await communityConfig()),
|
|
38
|
+
actions: [
|
|
39
|
+
{
|
|
40
|
+
action: `goto:/posts/${notification.post?.id}`,
|
|
41
|
+
title: 'View RSVP',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
invalidateQueries: [PUSH_INVALIDATE.posts],
|
|
46
|
+
});
|
|
35
47
|
export default {
|
|
36
48
|
type: 'rsvp',
|
|
37
49
|
event: 'rsvpCreated',
|
|
50
|
+
defaultSettings: notificationAll,
|
|
38
51
|
eventHandler,
|
|
39
52
|
pushRenderer,
|
|
40
53
|
};
|