fix(activity): cadence-aware suffixes on contribution log entries
This commit is contained in:
parent
10f8cab6e3
commit
e5f1e9f95e
3 changed files with 17 additions and 11 deletions
|
|
@ -27,10 +27,13 @@ const formatters = {
|
||||||
text: `Changed circle from ${circleLabel(m.from)} to ${circleLabel(m.to)}`,
|
text: `Changed circle from ${circleLabel(m.from)} to ${circleLabel(m.to)}`,
|
||||||
icon: 'i-lucide-refresh-cw'
|
icon: 'i-lucide-refresh-cw'
|
||||||
}),
|
}),
|
||||||
contribution_changed: (m) => ({
|
contribution_changed: (m) => {
|
||||||
text: `Changed contribution from $${m.from}/mo to $${m.to}/mo`,
|
const suffix = m.cadence === 'annual' ? '/yr' : '/mo'
|
||||||
icon: 'i-lucide-coins'
|
return {
|
||||||
}),
|
text: `Changed contribution from $${m.from}${suffix} to $${m.to}${suffix}`,
|
||||||
|
icon: 'i-lucide-coins'
|
||||||
|
}
|
||||||
|
},
|
||||||
email_changed: (m) => ({
|
email_changed: (m) => ({
|
||||||
text: `Changed email address`,
|
text: `Changed email address`,
|
||||||
icon: 'i-lucide-mail'
|
icon: 'i-lucide-mail'
|
||||||
|
|
@ -41,10 +44,13 @@ const formatters = {
|
||||||
: 'Updated profile',
|
: 'Updated profile',
|
||||||
icon: 'i-lucide-user-pen'
|
icon: 'i-lucide-user-pen'
|
||||||
}),
|
}),
|
||||||
subscription_created: (m) => ({
|
subscription_created: (m) => {
|
||||||
text: m.amount != null ? `Started $${m.amount}/mo subscription` : 'Started subscription',
|
const suffix = m.cadence === 'annual' ? '/yr' : '/mo'
|
||||||
icon: 'i-lucide-credit-card'
|
return {
|
||||||
}),
|
text: m.amount != null ? `Started $${m.amount}${suffix} subscription` : 'Started subscription',
|
||||||
|
icon: 'i-lucide-credit-card'
|
||||||
|
}
|
||||||
|
},
|
||||||
subscription_cancelled: () => ({
|
subscription_cancelled: () => ({
|
||||||
text: 'Cancelled subscription',
|
text: 'Cancelled subscription',
|
||||||
icon: 'i-lucide-credit-card'
|
icon: 'i-lucide-credit-card'
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ export default defineEventHandler(async (event) => {
|
||||||
const isFirstActivation = preMember?.status === 'pending_payment'
|
const isFirstActivation = preMember?.status === 'pending_payment'
|
||||||
const member = await Member.findById(preMember._id)
|
const member = await Member.findById(preMember._id)
|
||||||
|
|
||||||
logActivity(member._id, 'subscription_created', { amount: body.contributionAmount })
|
logActivity(member._id, 'subscription_created', { amount: body.contributionAmount, cadence: body.cadence })
|
||||||
|
|
||||||
await autoFlagPreExistingSlackAccess(member)
|
await autoFlagPreExistingSlackAccess(member)
|
||||||
try {
|
try {
|
||||||
|
|
@ -134,7 +134,7 @@ export default defineEventHandler(async (event) => {
|
||||||
const isFirstActivation = preMember?.status === 'pending_payment'
|
const isFirstActivation = preMember?.status === 'pending_payment'
|
||||||
const member = await Member.findById(preMember._id)
|
const member = await Member.findById(preMember._id)
|
||||||
|
|
||||||
logActivity(member._id, 'subscription_created', { amount: body.contributionAmount })
|
logActivity(member._id, 'subscription_created', { amount: body.contributionAmount, cadence: body.cadence })
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const txs = await listHelcimCustomerTransactions(body.customerCode)
|
const txs = await listHelcimCustomerTransactions(body.customerCode)
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ export default defineEventHandler(async (event) => {
|
||||||
|
|
||||||
// Log contribution change (fire-and-forget, at the top so it logs regardless of which case path executes)
|
// Log contribution change (fire-and-forget, at the top so it logs regardless of which case path executes)
|
||||||
const logContributionChange = () => {
|
const logContributionChange = () => {
|
||||||
logActivity(member._id, 'contribution_changed', { from: oldAmount, to: newAmount })
|
logActivity(member._id, 'contribution_changed', { from: oldAmount, to: newAmount, cadence: body.cadence })
|
||||||
}
|
}
|
||||||
|
|
||||||
const oldRequiresPayment = requiresPayment(oldAmount);
|
const oldRequiresPayment = requiresPayment(oldAmount);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue