Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/notifications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ To find `targetARN`: query identity DB table `NotificationDeviceTokens`, e.g. `s
- `NOTIFICATIONS_LOG_REMOTE_CONFIG_SNAPSHOT` – set to **`1`** to log a one-shot **`Remote config snapshot (Optimizely)`** at startup (all push flags + raw vs effective)
- `GIT_COMMIT`, `IMAGE_TAG`, `BUILD_TIME` – (optional) deploy metadata for logs and `/health_check`; see Dockerfile build-args
- `SENDGRID_API_KEY` – email
- `NOTIFICATIONS_CONTENT_NODE_ENDPOINT` – (optional) stable public `/content` gateway for email images; default **`https://api.audius.co`**
- `ANNOUNCEMENT_SEND_SECRET` – (optional) if set, `POST /internal/send-notification` requires `Authorization: Bearer <this value>` (used by notifications-dashboard). Optional body field **`notification_campaign_id`** is stored on the notification row and included on mobile push payloads.

### Push pipeline logs
Expand Down
40 changes: 40 additions & 0 deletions apps/notifications/src/__tests__/contentNodeEnv.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { getContentNode } from '../utils/env'
import { formatImageUrl } from '../utils/format'

describe('content node env', () => {
const oldNotificationsEndpoint =
process.env.NOTIFICATIONS_CONTENT_NODE_ENDPOINT
const oldContentEndpoint = process.env.CONTENT_NODE_ENDPOINT

afterEach(() => {
if (oldNotificationsEndpoint === undefined) {
delete process.env.NOTIFICATIONS_CONTENT_NODE_ENDPOINT
} else {
process.env.NOTIFICATIONS_CONTENT_NODE_ENDPOINT = oldNotificationsEndpoint
}

if (oldContentEndpoint === undefined) {
delete process.env.CONTENT_NODE_ENDPOINT
} else {
process.env.CONTENT_NODE_ENDPOINT = oldContentEndpoint
}
})

it('uses the API content gateway by default', () => {
delete process.env.NOTIFICATIONS_CONTENT_NODE_ENDPOINT
delete process.env.CONTENT_NODE_ENDPOINT

expect(getContentNode()).toBe('https://api.audius.co')
expect(formatImageUrl('image-cid', 150)).toBe(
'https://api.audius.co/content/image-cid/150x150.jpg'
)
})

it('allows notification-specific gateway overrides', () => {
process.env.NOTIFICATIONS_CONTENT_NODE_ENDPOINT =
'https://images.example.com/'
process.env.CONTENT_NODE_ENDPOINT = 'https://generic.example.com'

expect(getContentNode()).toBe('https://images.example.com')
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('Add track to playlist notification', () => {
playlistId: 55,
type: 'AddTrackToPlaylist'
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('Artist Remix Contest Ended Notification', () => {
type: 'ArtistRemixContestEnded',
entityId: 12345
}),
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
})
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('Artist Remix Contest Ending Soon Notification', () => {
entityId: 12345,
entityUserId: 99
}),
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
})
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('Artist Remix Contest Submissions Notification', () => {
eventId: 999,
milestone: 1
}),
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
})
)
})
Expand Down Expand Up @@ -119,7 +119,7 @@ describe('Artist Remix Contest Submissions Notification', () => {
eventId: 999,
milestone: 10
}),
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
})
)
})
Expand Down
2 changes: 1 addition & 1 deletion apps/notifications/src/__tests__/mappings/comment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('Comment Notification', () => {
entityId: 10,
commentId: 1
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('Comment Mention Notification', () => {
entityId: 1,
commentId: 1
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('Comment Reaction Notification', () => {
userIds: [2],
commentId: 1
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down Expand Up @@ -246,7 +246,7 @@ describe('Comment Reaction Notification', () => {
commentId: 1
},
imageUrl:
'https://creatornode2.audius.co/content/contest-hash/150x150.jpg'
'https://api.audius.co/content/contest-hash/150x150.jpg'
}
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('Comment Thread Notification', () => {
userIds: [2],
commentId: 2
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down
2 changes: 1 addition & 1 deletion apps/notifications/src/__tests__/mappings/cosign.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('Cosign Notification', () => {
id: 'timestamp:1589373217:group_id:cosign:parent_track10:original_track:20',
type: 'RemixCosign'
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down
10 changes: 5 additions & 5 deletions apps/notifications/src/__tests__/mappings/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('Create Notification', () => {
userId: 1,
entityType: 'Track'
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down Expand Up @@ -138,7 +138,7 @@ describe('Create Notification', () => {
userId: 1,
entityType: 'Track'
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)

Expand All @@ -162,7 +162,7 @@ describe('Create Notification', () => {
userId: 1,
entityType: 'Track'
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down Expand Up @@ -260,7 +260,7 @@ describe('Create Notification', () => {
userId: 1,
entityType: 'Playlist'
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down Expand Up @@ -350,7 +350,7 @@ describe('Create Notification', () => {
userId: 1,
entityType: 'Album'
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('Fan Club Text Post Notification', () => {
commentId: 100
}),
imageUrl:
'https://creatornode2.audius.co/content/artist-pfp-hash/150x150.jpg'
'https://api.audius.co/content/artist-pfp-hash/150x150.jpg'
})
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('Fan Remix Contest Ended Notification', () => {
entityId: 12345,
entityUserId: 99
}),
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
})
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('Fan Remix Contest Ending Soon Notification', () => {
entityId: 12345,
entityUserId: 99
}),
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
})
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('Fan Remix Contest Started Notification', () => {
entityId: 12345,
entityUserId: 99
}),
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
})
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('Fan Remix Contest Winners Selected Notification', () => {
entityId: 12345,
entityUserId: 99
}),
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
})
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ describe('Milestone Notification', () => {
id: 'timestamp:1589373217:group_id:milestone:TRACK_REPOST_COUNT:id:2:threshold:10',
type: 'MilestoneRepost'
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down
2 changes: 1 addition & 1 deletion apps/notifications/src/__tests__/mappings/remix.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('Remix Notification', () => {
id: 'timestamp:1589373217:group_id:remix:track:20:parent_track:10',
type: 'RemixCreate'
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('Repost Of Repost Notification', () => {
entityId: 10,
userIds: [3]
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
])
})
Expand Down Expand Up @@ -148,7 +148,7 @@ describe('Repost Of Repost Notification', () => {
entityType: 'Playlist',
entityId: 10
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
])
})
Expand Down Expand Up @@ -178,7 +178,7 @@ describe('Repost Of Repost Notification', () => {
entityType: 'Album',
entityId: 10
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
])
})
Expand Down
4 changes: 2 additions & 2 deletions apps/notifications/src/__tests__/mappings/save.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('Save Notification', () => {
type: 'Favorite',
userIds: [2]
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down Expand Up @@ -112,7 +112,7 @@ describe('Save Notification', () => {
type: 'Favorite',
userIds: [2]
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe('Save Of Repost Notification', () => {
entityType: 'Track',
entityId: 10
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
])
})
Expand Down Expand Up @@ -149,7 +149,7 @@ describe('Save Of Repost Notification', () => {
entityType: 'Playlist',
entityId: 10
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
])
})
Expand Down Expand Up @@ -179,7 +179,7 @@ describe('Save Of Repost Notification', () => {
entityType: 'Album',
entityId: 10
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
])
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe('Tastemaker Notification', () => {
entityType: 'Track',
entityId: 3
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('Trending Track Notification', () => {
id: 'timestamp:1589373217:group_id:trending:time_range:week:genre:all:rank:3:track_id:10:timestamp:1677261600',
type: 'TrendingTrack'
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('Trending Underground Notification', () => {
title: "📈 You're Trending",
body: `track_title_10 is #3 on Underground Trending right now!`,
data: {},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('USDC Purchase Seller', () => {
type: 'USDCPurchaseSeller',
entityId: 10
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)

Expand Down Expand Up @@ -250,7 +250,7 @@ describe('USDC Purchase Seller', () => {
type: 'USDCPurchaseSeller',
entityId: 15
},
imageUrl: 'https://creatornode2.audius.co/content/test-hash/150x150.jpg'
imageUrl: 'https://api.audius.co/content/test-hash/150x150.jpg'
}
)

Expand Down
Loading
Loading