forked from StateVoicesNational/Spoke
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from MoveOnOrg/main
Merge dynamic replies feature into staging branch
- Loading branch information
Showing
14 changed files
with
418 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
const { onUpdateTrigger } = require('./helpers/index') | ||
const ON_UPDATE_TIMESTAMP_FUNCTION = ` | ||
CREATE OR REPLACE FUNCTION on_update_timestamp() | ||
RETURNS trigger AS $$ | ||
BEGIN | ||
NEW.updated_at = now(); | ||
RETURN NEW; | ||
END; | ||
$$ language 'plpgsql'; | ||
` | ||
|
||
const DROP_ON_UPDATE_TIMESTAMP_FUNCTION = `DROP FUNCTION on_update_timestamp` | ||
|
||
/** | ||
* @param { import("knex").Knex } knex | ||
*/ | ||
exports.up = async function(knex) { | ||
const isSqlite = /sqlite/.test(knex.client.config.client); | ||
if (!isSqlite) { | ||
await knex.raw(ON_UPDATE_TIMESTAMP_FUNCTION); | ||
await knex.raw(onUpdateTrigger('campaign_contact')); | ||
} | ||
}; | ||
|
||
/** | ||
* @param { import("knex").Knex } knex | ||
*/ | ||
exports.down = async function(knex) { | ||
const isSqlite = /sqlite/.test(knex.client.config.client); | ||
if (!isSqlite) { | ||
await knex.raw("DROP TRIGGER campaign_contact_updated_at on campaign_contact"); | ||
await knex.raw(DROP_ON_UPDATE_TIMESTAMP_FUNCTION); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import PropTypes from "prop-types"; | ||
import React from "react"; | ||
import DisplayLink from "./DisplayLink"; | ||
|
||
const OrganizationReassignLink = ({ joinToken, campaignId }) => { | ||
let baseUrl = "https://base"; | ||
if (typeof window !== "undefined") { | ||
baseUrl = window.location.origin; | ||
} | ||
|
||
const replyUrl = `${baseUrl}/${joinToken}/replies/${campaignId}`; | ||
const textContent = `Send your texting volunteers this link! Once they sign up, they\'ll be automatically assigned replies for this campaign.`; | ||
|
||
return <DisplayLink url={replyUrl} textContent={textContent} />; | ||
}; | ||
|
||
OrganizationReassignLink.propTypes = { | ||
joinToken: PropTypes.string, | ||
campaignId: PropTypes.string | ||
}; | ||
|
||
export default OrganizationReassignLink; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.