Skip to content

Commit

Permalink
Merge pull request #84 from Giveth/hotfix_modify_superfluid_notificat…
Browse files Browse the repository at this point in the history
…ion_details_and_template

Modify migration template
  • Loading branch information
CarlosQ96 authored Apr 10, 2024
2 parents a6fd3c4 + 2559a3e commit a502872
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 32 deletions.
48 changes: 18 additions & 30 deletions migrations/1711607882826-addSuperfluidNotifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const superFluidNotificationTypes = [
name: 'One month left in stream balance',
description: 'Stream balance of underlying token will run out in 1 month',
microService: MICRO_SERVICES.givethio,
category: NOTIFICATION_CATEGORY.GIV_ECONOMY,
category: NOTIFICATION_CATEGORY.GENERAL,
icon: '',
schemaValidator: SCHEMA_VALIDATORS_NAMES.SUPERFLUID,
emailNotifierService: null,
Expand All @@ -26,18 +26,16 @@ export const superFluidNotificationTypes = [
content: 'Your Stream Balance of ',
},
{
type: 'a',
content: '{underlyingTokenSymbol}',
href: '#', // Placeholder for dynamic token symbol link
type: 'p',
content: '$tokenSymbol',
},
{
type: 'p',
content: ' on ',
},
{
type: 'a',
content: '{network}',
href: '#', // Placeholder for dynamic network link
type: 'p',
content: '$networkName',
},
{
type: 'p',
Expand All @@ -46,17 +44,15 @@ export const superFluidNotificationTypes = [
{
type: 'a',
content: 'top-up here.',
href: 'Link to my recurring donations tab', // Actual link goes here
href: '$recurringDonationTab', // Actual link goes here
},
],
content:
'Your Stream Balance of {underlyingTokenSymbol} on {network} will run out in 1 month, top-up here.',
},
{
name: 'One week left in stream balance',
description: 'Stream balance of underlying token will run out in 1 week',
microService: MICRO_SERVICES.givethio,
category: NOTIFICATION_CATEGORY.GIV_ECONOMY,
category: NOTIFICATION_CATEGORY.GENERAL,
icon: '',
schemaValidator: SCHEMA_VALIDATORS_NAMES.SUPERFLUID,
emailNotifierService: null,
Expand All @@ -70,18 +66,16 @@ export const superFluidNotificationTypes = [
content: 'Your Stream Balance of ',
},
{
type: 'a',
content: '{underlyingTokenSymbol}',
href: '#', // Placeholder for dynamic token symbol link
type: 'p',
content: '$tokenSymbol',
},
{
type: 'p',
content: ' on ',
},
{
type: 'a',
content: '{network}',
href: '#', // Placeholder for dynamic network link
type: 'p',
content: '$networkName',
},
{
type: 'p',
Expand All @@ -90,17 +84,15 @@ export const superFluidNotificationTypes = [
{
type: 'a',
content: 'top-up here.',
href: 'Link to my recurring donations tab', // Actual link goes here
href: '$recurringDonationTab', // Actual link goes here
},
],
content:
'Your Stream Balance of {underlyingTokenSymbol} on {network} will run out in 1 week, top-up here.',
},
{
name: 'Stream balance depleted',
description: 'Stream balance in token has run out of funds',
microService: MICRO_SERVICES.givethio,
category: NOTIFICATION_CATEGORY.GIV_ECONOMY,
category: NOTIFICATION_CATEGORY.GENERAL,
icon: '',
schemaValidator: SCHEMA_VALIDATORS_NAMES.SUPERFLUID,
emailNotifierService: null,
Expand All @@ -114,18 +106,16 @@ export const superFluidNotificationTypes = [
content: 'Your Stream Balance in ',
},
{
type: 'a',
content: '{tokenSymbol}',
href: '#', // Placeholder for dynamic token symbol link
type: 'p',
content: '$tokenSymbol',
},
{
type: 'p',
content: ' on ',
},
{
type: 'a',
content: '{network}',
href: '#', // Placeholder for dynamic network link
type: 'p',
content: '$networkName',
},
{
type: 'p',
Expand All @@ -135,11 +125,9 @@ export const superFluidNotificationTypes = [
{
type: 'a',
content: 'Manage your Recurring Donations',
href: 'Link to manage recurring donations', // Actual link goes here
href: '$recurringDonationTab', // Actual link goes here
},
],
content:
'Your Stream Balance in {tokenSymbol} on {network} has run out of funds, subsequently some of your recurring donations have ended. Manage your Recurring Donations',
},
];

Expand Down
3 changes: 1 addition & 2 deletions src/services/notificationService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ export const sendNotification = async (
success: boolean;
message?: string;
}> => {
logger.debug('notificationController.sendNotification() init', body);
const { userWalletAddress, projectId } = body;
if (body.trackId && (await findNotificationByTrackId(body.trackId))) {
// We dont throw error in this case but dont create new notification neither
Expand Down Expand Up @@ -229,7 +228,7 @@ export const sendNotification = async (
payload: body.segment?.payload,
sendEmail: body.sendEmail,
sendSegment: body.sendSegment,
segmentValidator,
segmentValidator: !!segmentValidator,
eventName: body.eventName,
});

Expand Down
2 changes: 2 additions & 0 deletions src/utils/validators/segmentAndMetadataValidators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ const superFluidTokenMetadataSchema = Joi.object({
isEnded: Joi.boolean(),
projectTitle: Joi.string(),
projectLink: Joi.string(),
networkName: Joi.string().required(),
recurringDonationTab: Joi.string().required(),
});

const superFluidTokenSegmentSchema = Joi.object({
Expand Down

0 comments on commit a502872

Please sign in to comment.