Allow people to back out of pledges
While backing out, they can also choose whether they want to keep receiving updates or not.
This commit is contained in:
parent
8226f67f3d
commit
df2973722d
2 changed files with 43 additions and 2 deletions
|
@ -114,6 +114,9 @@ let pledgeSchema = function(t) {
|
|||
|
||||
t.string('referral_code', 256)
|
||||
t.string('referrer', 128)
|
||||
|
||||
t.boolean('backed_out').defaultTo(false)
|
||||
t.boolean('unsubscribed').defaultTo(false)
|
||||
}
|
||||
|
||||
// function to make sure referral columns exist
|
||||
|
@ -140,13 +143,40 @@ function ensureReferralColumns(table) {
|
|||
})
|
||||
}
|
||||
|
||||
// likewise for backed_out and unsubscribed columns
|
||||
function ensureBackoutColumns(table) {
|
||||
knex.schema.hasColumn(table, 'backed_out').then(function(exists) {
|
||||
if (!exists) {
|
||||
console.debug(`No backed_out column in ${table}! Adding now...`)
|
||||
knex.schema.alterTable(table, t => {
|
||||
t.boolean('backed_out').defaultTo(false)
|
||||
}).then(r => console.debug(`backed_out column added to ${table}`, r))
|
||||
}
|
||||
})
|
||||
|
||||
knex.schema.hasColumn(table, 'unsubscribed').then(function(exists) {
|
||||
if (!exists) {
|
||||
console.debug(`No unsubscribed column in ${table}! Adding now...`)
|
||||
knex.schema.alterTable(table, t => {
|
||||
t.boolean('unsubscribed').defaultTo(false)
|
||||
}).then(r => console.debug(`unsubscribed column added to ${table}`, r))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// meta-function to ensure all the columns are there!
|
||||
function ensureColumns(table) {
|
||||
ensureReferralColumns(table)
|
||||
ensureBackoutColumns(table)
|
||||
}
|
||||
|
||||
// make sure pledges table exists
|
||||
knex.schema.hasTable('pledges').then(function(exists) {
|
||||
if (!exists) {
|
||||
if (DEBUG) console.debug('No pledge table exists! Creating one now...')
|
||||
return knex.schema.createTable('pledges', pledgeSchema)
|
||||
} else {
|
||||
ensureReferralColumns('pledges')
|
||||
ensureColumns('pledges')
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -156,7 +186,7 @@ knex.schema.hasTable('unverified_pledges').then(function(exists) {
|
|||
if (DEBUG) console.debug('No unverified pledge table exists! Creating one now...')
|
||||
return knex.schema.createTable('unverified_pledges', pledgeSchema)
|
||||
} else {
|
||||
ensureReferralColumns('unverified_pledges')
|
||||
ensureColumns('unverified_pledges')
|
||||
}
|
||||
})
|
||||
|
||||
|
|
11
src/bye.htm.twig
Normal file
11
src/bye.htm.twig
Normal file
|
@ -0,0 +1,11 @@
|
|||
{% extends "base.htm.twig" %}
|
||||
|
||||
{% block title %}Snipette Crowdfunding: Unsubscribed{% endblock %}
|
||||
{% block heading %}Adios!{% endblock %}
|
||||
{% block message %}
|
||||
<p class="text-lg mb-2">We're sorry to see you back out, but we respect your decision. We have removed you from our crowdfunders list, and will stop contacting you about payments. Please check your inbox for a receipt.</p>
|
||||
<p class="text-md mb-8">
|
||||
We know our crowdfunding campaign didn't go as well as we expected. However, all is not lost and we have made some progress since last year. We hope you'll continue to be part of the Snipette journey, even if it's an stroll rather than a marathon. But either way, before signing off, we'd like to say thanks for being with us thus far!
|
||||
</p>
|
||||
<p><a href="https://www.snipettemag.com/" target="_blank" class="p-4 bg-orange-700 text-white no-underline rounded-xl hover:bg-orange-500 hover:cursor-pointer inline-block w-full sm:w-auto">Continue to Snipette</a></p>
|
||||
{% endblock %}
|
Loading…
Reference in a new issue