CCRs (#86)
* CCRs API / Models boilerplate
* start on frontend
* backendy things
* Create CCR redux module, integrate API endpoints, create types
* Fix/Cleanup API
* Wire up CreateRequestDraftList
* bounty->target
* Add 'Create Request Flow' MVP
* cleanup
* Tweak filenames
* Simplify migrations
* fix migrations
* CCR Staking MVP
* tslint
* Get Pending Requests into Profile
* Remove staking requirement
* more staking related removals
* MVP Admin integration
* Make RFP when CCR is accepted
* Add pagination to CCRs in Admin
Improve styles for Proposals
* Hookup notifications
Adjust copy
* Simplify ccr->rfp relationship
Add admin approval email
Fixup copy
* Show Message on RFP Detail
Make Header CTAs change based on draft status
Adjust proposal card style
* Bugfix: Show header for non signed in users
* Add 'create a request' to intro
* Profile Created CCRs
RFP CCR attribution
* ignore
* CCR Price in USD (#85)
* init profile tipjar backend
* init profile tipjar frontend
* fix lint
* implement tip jar block
* fix wrapping, hide tip block on self
* init backend proposal tipjar
* init frontend proposal tipjar
* add hide title, fix bug
* uncomment rate limit
* rename vars, use null check
* allow address and view key to be unset
* add api tests
* fix tsc errors
* fix lint
* fix CopyInput styling
* fix migrations
* hide tipping in proposal if address not set
* add tip address to create flow
* redesign campaign block
* fix typo
* init backend changes
* init admin changes
* init frontend changes
* fix backend tests
* update campaign block
* be - init rfp usd changes
* admin - init rfp usd changes
* fe - fully adapt api util functions to usd
* fe - init rfp usd changes
* adapt profile created to usd
* misc usd changes
* add tip jar to dedicated card
* fix tipjar bug
* use zf light logo
* switch to zf grants logo
* hide profile tip jar if address not set
* add comment, run prettier
* conditionally add info icon and tooltip to funding line
* admin - disallow decimals in RFPs
* fe - cover usd string edge case
* add Usd as rfp bounty type
* fix migration order
* fix email bug
* adapt CCRs to USD
* implement CCR preview
* fix tsc
* Copy Updates and UX Tweaks (#87)
* Add default structure to proposal content
* Landing page copy
* Hide contributors tab for v2 proposals
* Minor UX tweaks for Liking/Following/Tipping
* Copy for Tipping Tooltip, proposal explainer for review, and milestone day estimate notice.
* Fix header styles bug and remove commented out styles.
* Revert "like" / "unfollow" hyphenication
* Comment out unused tests related to staking
Increase PROPOSAL_TARGET_MAX in .env.example
* Comment out ccr approval email send until ready
* Adjust styles, copy.
* fix proposal prune test (#88)
* fix USD display in preview, fix non-unique key (#90)
* Pre-stepper explainer for CCRs.
* Tweak styles
* Default content for CCRs
* fix tsc
* CCR approval and rejection emails
* add back admin_approval_ccr email templates
* Link ccr author name to profile in RFPs
* copy tweaks
* copy tweak
* hookup mangle user command
* Fix/add endif in jinja
* fix tests
* review
* fix review
2019-12-05 17:01:02 -08:00
|
|
|
|
import {
|
|
|
|
|
ProposalDraft,
|
|
|
|
|
STATUS,
|
|
|
|
|
MILESTONE_STAGE,
|
|
|
|
|
PROPOSAL_ARBITER_STATUS,
|
|
|
|
|
CCRDraft,
|
|
|
|
|
RFP,
|
ZF Grants 2.1 (#496)
* fix ccr pagination defaults
* add ccr admin tests
* add ccr user tests
* checkpoint
* fix tslint
* request changes discussion flow mvp
* admin - add discussion status
* backend - add live drafts
* admin - add live drafts
* frontend - add live drafts
* frontend - add edit discussion proposal
* fix tsc
* include DISCUSSION status in propsal listview
* do not make live draft on admin request changes
* hide live drafts from user proposal draft list
* fix backend tests
* add admin tests
* add user tests
* fix: liking, viewing discussion proposals, admin menu
* admin - update hints for live drafts
* fe - add better messaging when updating a proposal
* be - fix like test
* remove TODO comments
* add new email types
* fix storybook
* add revision tab story
* backend - implement proposal revisions
* frontend - implement proposal revisions
* update revision tab story
* fix lint
* remove set detection
* email proposal followers on revision
* restrict banner to team members only
* misc bug fixes
* update, add backend tests
* add milestone title change to revision history story
* fix milestones display in preview
* allow archived proposals to be queried
* implement archived proposal page
* fix tsc
* implement archived proposal get route
* move styling into less
* remove proposal archive parent id
* handle archived proposal status
* cleanup
* remove contributions, switch to USD, implement quarters
* use Qs to preserve formatting
* handle edit only kyc
* prevent ARCHIVED proposals from being sent to admin
* display latest revision first
* admin - proposal & ccr reject permanently
* backend - proposal & ccr reject permanently
* frontend - proposal & ccr reject permanently
* fix tsc
* use $ in milestone payout email
* introduce custom filters to proposal listview
* hide archive link on first revision
* upgrade packages
* add bech32 implementation
* add z address validation with tests
* fix tslint
* use local address validation
* fix tests, remove blockchain mock gets
* add additional bad addresses
* update briefs to include page break message
* remove contributions routes, menu entry
* disable countribution count admin stats
* remove matching and pretty print in finance
* fix tslint
* separate out rejected permanently proposals
* make removing proposals generic
* allow linked tabs to be ignored
* remove rejected permanently, bugfix
* update preview link to point to rejected tab
* implement rejected permanently tab, add tab message
* refactor variable
* fix tslint
* fix tslint
* send ccr reject permanently email on rejection
* fix preview message
* wire up proposal arbiter and rejected emails
* disable tip jar in proposal and profile
* sync ccr/proposal drafts on create form init
* check invites on submit modal open
* update team invite language
* update team text when edit
* fix ccr rejected permanently tag
* text changes, email preview fix
* display changes requested tag when in discussion with changes requested
* enable social share on open for discussion proposals, update language
* place sort below filter
* derive filter from query string
* use better filter names in query params
* fix tslint
* create snapshot of original proposal on first revision
* clear invites between edits, account for additional changes not tracked in revisions
* update tests
* fix test
* remove print
* SameSite Fixes (#150)
* QA Fixes 2 (#151)
* set filters as query strings on change
* remove rejected permanently tags
* add dollar sign in financials legend
* fix tsc
* Copy Touchups (#152)
* Email Fixes (#155)
* fix ZEC in milestone payout emails
* fix links in rejected permanently CCR/proposal emails
* Poll for Team and Invite Changes in Create Flow (#153)
* poll for team and invite changes in create flow
* fix tslint
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* pretty print payouts by quarter (#156)
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* Remove Blockchain Module (#154)
* remove blockchain route from backend, remove calls to node
* revert blockchain_get removal
* Add Tags to Proposal Cards (#157)
* add tag to proposals and dynamically set v1 card height
* listen on window resize
* make card height props optional
* set tag in bottom right, remove dynamic card resize, add dynamic tag resize
* cleanup
* cleanup
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* Improve Frontend Address Validation (#158)
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* Remove blockchain module (#162)
* remove blockchain route from backend, remove calls to node
* revert blockchain_get removal
* Remove Blockchain App (#160)
* remove blockchain app
* remove blockchain app from travis
Co-authored-by: Danny Skubak <skubakdj@gmail.com>
* Proposal Edit Fixes (#161)
* fe - display error if edit creation fails
* be - restrict live draft publish
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* Restrict Arbiter Assignment (#159)
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* Email Copy updates
* Remove Admin Financials Card
* Hookup 'proposal_approved_without_funding' to admin email example
* bump various package versions
* Update yarn.lock files
* Attach 'proposal_approved_without_funding' to backend example email
* bump package versions
Co-authored-by: Danny Skubak <skubakdj@gmail.com>
2020-04-07 19:56:32 -07:00
|
|
|
|
Proposal,
|
CCRs (#86)
* CCRs API / Models boilerplate
* start on frontend
* backendy things
* Create CCR redux module, integrate API endpoints, create types
* Fix/Cleanup API
* Wire up CreateRequestDraftList
* bounty->target
* Add 'Create Request Flow' MVP
* cleanup
* Tweak filenames
* Simplify migrations
* fix migrations
* CCR Staking MVP
* tslint
* Get Pending Requests into Profile
* Remove staking requirement
* more staking related removals
* MVP Admin integration
* Make RFP when CCR is accepted
* Add pagination to CCRs in Admin
Improve styles for Proposals
* Hookup notifications
Adjust copy
* Simplify ccr->rfp relationship
Add admin approval email
Fixup copy
* Show Message on RFP Detail
Make Header CTAs change based on draft status
Adjust proposal card style
* Bugfix: Show header for non signed in users
* Add 'create a request' to intro
* Profile Created CCRs
RFP CCR attribution
* ignore
* CCR Price in USD (#85)
* init profile tipjar backend
* init profile tipjar frontend
* fix lint
* implement tip jar block
* fix wrapping, hide tip block on self
* init backend proposal tipjar
* init frontend proposal tipjar
* add hide title, fix bug
* uncomment rate limit
* rename vars, use null check
* allow address and view key to be unset
* add api tests
* fix tsc errors
* fix lint
* fix CopyInput styling
* fix migrations
* hide tipping in proposal if address not set
* add tip address to create flow
* redesign campaign block
* fix typo
* init backend changes
* init admin changes
* init frontend changes
* fix backend tests
* update campaign block
* be - init rfp usd changes
* admin - init rfp usd changes
* fe - fully adapt api util functions to usd
* fe - init rfp usd changes
* adapt profile created to usd
* misc usd changes
* add tip jar to dedicated card
* fix tipjar bug
* use zf light logo
* switch to zf grants logo
* hide profile tip jar if address not set
* add comment, run prettier
* conditionally add info icon and tooltip to funding line
* admin - disallow decimals in RFPs
* fe - cover usd string edge case
* add Usd as rfp bounty type
* fix migration order
* fix email bug
* adapt CCRs to USD
* implement CCR preview
* fix tsc
* Copy Updates and UX Tweaks (#87)
* Add default structure to proposal content
* Landing page copy
* Hide contributors tab for v2 proposals
* Minor UX tweaks for Liking/Following/Tipping
* Copy for Tipping Tooltip, proposal explainer for review, and milestone day estimate notice.
* Fix header styles bug and remove commented out styles.
* Revert "like" / "unfollow" hyphenication
* Comment out unused tests related to staking
Increase PROPOSAL_TARGET_MAX in .env.example
* Comment out ccr approval email send until ready
* Adjust styles, copy.
* fix proposal prune test (#88)
* fix USD display in preview, fix non-unique key (#90)
* Pre-stepper explainer for CCRs.
* Tweak styles
* Default content for CCRs
* fix tsc
* CCR approval and rejection emails
* add back admin_approval_ccr email templates
* Link ccr author name to profile in RFPs
* copy tweaks
* copy tweak
* hookup mangle user command
* Fix/add endif in jinja
* fix tests
* review
* fix review
2019-12-05 17:01:02 -08:00
|
|
|
|
} from 'types';
|
|
|
|
|
import { User, CCR } from 'types';
|
2019-03-06 12:25:58 -08:00
|
|
|
|
import {
|
2019-12-03 16:02:39 -08:00
|
|
|
|
getAmountErrorUsd,
|
|
|
|
|
getAmountErrorUsdFromString,
|
2019-03-06 12:25:58 -08:00
|
|
|
|
isValidSaplingAddress,
|
|
|
|
|
isValidTAddress,
|
|
|
|
|
isValidSproutAddress,
|
|
|
|
|
} from 'utils/validators';
|
CCRs (#86)
* CCRs API / Models boilerplate
* start on frontend
* backendy things
* Create CCR redux module, integrate API endpoints, create types
* Fix/Cleanup API
* Wire up CreateRequestDraftList
* bounty->target
* Add 'Create Request Flow' MVP
* cleanup
* Tweak filenames
* Simplify migrations
* fix migrations
* CCR Staking MVP
* tslint
* Get Pending Requests into Profile
* Remove staking requirement
* more staking related removals
* MVP Admin integration
* Make RFP when CCR is accepted
* Add pagination to CCRs in Admin
Improve styles for Proposals
* Hookup notifications
Adjust copy
* Simplify ccr->rfp relationship
Add admin approval email
Fixup copy
* Show Message on RFP Detail
Make Header CTAs change based on draft status
Adjust proposal card style
* Bugfix: Show header for non signed in users
* Add 'create a request' to intro
* Profile Created CCRs
RFP CCR attribution
* ignore
* CCR Price in USD (#85)
* init profile tipjar backend
* init profile tipjar frontend
* fix lint
* implement tip jar block
* fix wrapping, hide tip block on self
* init backend proposal tipjar
* init frontend proposal tipjar
* add hide title, fix bug
* uncomment rate limit
* rename vars, use null check
* allow address and view key to be unset
* add api tests
* fix tsc errors
* fix lint
* fix CopyInput styling
* fix migrations
* hide tipping in proposal if address not set
* add tip address to create flow
* redesign campaign block
* fix typo
* init backend changes
* init admin changes
* init frontend changes
* fix backend tests
* update campaign block
* be - init rfp usd changes
* admin - init rfp usd changes
* fe - fully adapt api util functions to usd
* fe - init rfp usd changes
* adapt profile created to usd
* misc usd changes
* add tip jar to dedicated card
* fix tipjar bug
* use zf light logo
* switch to zf grants logo
* hide profile tip jar if address not set
* add comment, run prettier
* conditionally add info icon and tooltip to funding line
* admin - disallow decimals in RFPs
* fe - cover usd string edge case
* add Usd as rfp bounty type
* fix migration order
* fix email bug
* adapt CCRs to USD
* implement CCR preview
* fix tsc
* Copy Updates and UX Tweaks (#87)
* Add default structure to proposal content
* Landing page copy
* Hide contributors tab for v2 proposals
* Minor UX tweaks for Liking/Following/Tipping
* Copy for Tipping Tooltip, proposal explainer for review, and milestone day estimate notice.
* Fix header styles bug and remove commented out styles.
* Revert "like" / "unfollow" hyphenication
* Comment out unused tests related to staking
Increase PROPOSAL_TARGET_MAX in .env.example
* Comment out ccr approval email send until ready
* Adjust styles, copy.
* fix proposal prune test (#88)
* fix USD display in preview, fix non-unique key (#90)
* Pre-stepper explainer for CCRs.
* Tweak styles
* Default content for CCRs
* fix tsc
* CCR approval and rejection emails
* add back admin_approval_ccr email templates
* Link ccr author name to profile in RFPs
* copy tweaks
* copy tweak
* hookup mangle user command
* Fix/add endif in jinja
* fix tests
* review
* fix review
2019-12-05 17:01:02 -08:00
|
|
|
|
import { toUsd } from 'utils/units';
|
|
|
|
|
import { PROPOSAL_STAGE, RFP_STATUS } from 'api/constants';
|
2019-02-11 21:42:21 -08:00
|
|
|
|
import {
|
|
|
|
|
ProposalDetail,
|
|
|
|
|
PROPOSAL_DETAIL_INITIAL_STATE,
|
|
|
|
|
} from 'modules/proposals/reducers';
|
2018-09-20 11:58:47 -07:00
|
|
|
|
|
|
|
|
|
interface CreateFormErrors {
|
2019-03-06 12:25:58 -08:00
|
|
|
|
rfpOptIn?: string;
|
2018-09-20 11:58:47 -07:00
|
|
|
|
title?: string;
|
|
|
|
|
brief?: string;
|
2018-11-14 08:43:00 -08:00
|
|
|
|
target?: string;
|
2018-09-27 13:25:49 -07:00
|
|
|
|
team?: string[];
|
2018-11-14 09:59:48 -08:00
|
|
|
|
content?: string;
|
2018-11-14 08:43:00 -08:00
|
|
|
|
payoutAddress?: string;
|
2019-11-20 13:37:26 -08:00
|
|
|
|
tipJarAddress?: string;
|
2018-09-20 11:58:47 -07:00
|
|
|
|
milestones?: string[];
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-14 09:59:48 -08:00
|
|
|
|
export type KeyOfForm = keyof CreateFormErrors;
|
2018-09-20 11:58:47 -07:00
|
|
|
|
export const FIELD_NAME_MAP: { [key in KeyOfForm]: string } = {
|
2019-12-09 13:57:32 -08:00
|
|
|
|
rfpOptIn: 'KYC',
|
2018-09-20 11:58:47 -07:00
|
|
|
|
title: 'Title',
|
|
|
|
|
brief: 'Brief',
|
2018-11-14 08:43:00 -08:00
|
|
|
|
target: 'Target amount',
|
2018-09-27 13:25:49 -07:00
|
|
|
|
team: 'Team',
|
2018-11-14 09:59:48 -08:00
|
|
|
|
content: 'Details',
|
2018-11-14 08:43:00 -08:00
|
|
|
|
payoutAddress: 'Payout address',
|
2019-11-20 13:37:26 -08:00
|
|
|
|
tipJarAddress: 'Tip address',
|
2018-09-20 11:58:47 -07:00
|
|
|
|
milestones: 'Milestones',
|
|
|
|
|
};
|
|
|
|
|
|
2019-11-20 13:37:26 -08:00
|
|
|
|
const requiredFields = ['title', 'brief', 'target', 'content', 'payoutAddress'];
|
2018-11-14 09:59:48 -08:00
|
|
|
|
|
2018-09-20 11:58:47 -07:00
|
|
|
|
export function getCreateErrors(
|
2018-11-14 08:43:00 -08:00
|
|
|
|
form: Partial<ProposalDraft>,
|
2018-09-20 11:58:47 -07:00
|
|
|
|
skipRequired?: boolean,
|
|
|
|
|
): CreateFormErrors {
|
|
|
|
|
const errors: CreateFormErrors = {};
|
2019-03-18 11:35:08 -07:00
|
|
|
|
const {
|
|
|
|
|
title,
|
|
|
|
|
content,
|
|
|
|
|
team,
|
|
|
|
|
milestones,
|
|
|
|
|
target,
|
|
|
|
|
payoutAddress,
|
2019-11-20 13:37:26 -08:00
|
|
|
|
tipJarAddress,
|
2019-03-18 11:35:08 -07:00
|
|
|
|
rfpOptIn,
|
|
|
|
|
brief,
|
|
|
|
|
} = form;
|
2018-09-20 11:58:47 -07:00
|
|
|
|
|
|
|
|
|
// Required fields with no extra validation
|
|
|
|
|
if (!skipRequired) {
|
2018-11-14 09:59:48 -08:00
|
|
|
|
for (const key of requiredFields) {
|
2018-10-19 15:03:37 -07:00
|
|
|
|
if (!form[key as KeyOfForm]) {
|
2018-11-14 09:59:48 -08:00
|
|
|
|
errors[key as KeyOfForm] = `${FIELD_NAME_MAP[key as KeyOfForm]} is required`;
|
2018-09-20 11:58:47 -07:00
|
|
|
|
}
|
2018-10-19 15:03:37 -07:00
|
|
|
|
}
|
2018-09-20 11:58:47 -07:00
|
|
|
|
|
|
|
|
|
if (!milestones || !milestones.length) {
|
|
|
|
|
errors.milestones = ['Must have at least one milestone'];
|
|
|
|
|
}
|
2018-09-27 13:25:49 -07:00
|
|
|
|
if (!team || !team.length) {
|
|
|
|
|
errors.team = ['Must have at least one team member'];
|
|
|
|
|
}
|
2018-09-20 11:58:47 -07:00
|
|
|
|
}
|
|
|
|
|
|
2019-03-06 12:25:58 -08:00
|
|
|
|
// RFP opt-in
|
2020-12-20 14:06:47 -08:00
|
|
|
|
if (!rfpOptIn) {
|
|
|
|
|
errors.rfpOptIn = 'Please accept KYC to submit.'
|
2019-03-06 12:25:58 -08:00
|
|
|
|
}
|
|
|
|
|
|
2018-09-20 11:58:47 -07:00
|
|
|
|
// Title
|
2018-10-19 15:03:37 -07:00
|
|
|
|
if (title && title.length > 60) {
|
2018-09-20 11:58:47 -07:00
|
|
|
|
errors.title = 'Title can only be 60 characters maximum';
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-14 21:24:10 -07:00
|
|
|
|
// Brief
|
|
|
|
|
if (brief && brief.length > 140) {
|
|
|
|
|
errors.brief = 'Brief can only be 140 characters maximum';
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-18 11:35:08 -07:00
|
|
|
|
// Content limit for our database's sake
|
|
|
|
|
if (content && content.length > 250000) {
|
|
|
|
|
errors.content = 'Details can only be 250,000 characters maximum';
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-20 11:58:47 -07:00
|
|
|
|
// Amount to raise
|
2018-11-14 08:43:00 -08:00
|
|
|
|
const targetFloat = target ? parseFloat(target) : 0;
|
|
|
|
|
if (target && !Number.isNaN(targetFloat)) {
|
2019-03-18 11:35:08 -07:00
|
|
|
|
const limit = parseFloat(process.env.PROPOSAL_TARGET_MAX as string);
|
2019-12-03 16:02:39 -08:00
|
|
|
|
const targetErr =
|
|
|
|
|
getAmountErrorUsd(targetFloat, limit) || getAmountErrorUsdFromString(target);
|
2018-11-14 08:43:00 -08:00
|
|
|
|
if (targetErr) {
|
|
|
|
|
errors.target = targetErr;
|
2018-09-20 11:58:47 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Payout address
|
2019-03-04 12:02:51 -08:00
|
|
|
|
if (payoutAddress && !isValidSaplingAddress(payoutAddress)) {
|
|
|
|
|
if (isValidSproutAddress(payoutAddress)) {
|
|
|
|
|
errors.payoutAddress = 'Must be a Sapling address, not a Sprout address';
|
|
|
|
|
} else if (isValidTAddress(payoutAddress)) {
|
|
|
|
|
errors.payoutAddress = 'Must be a Sapling Z address, not a T address';
|
|
|
|
|
} else {
|
|
|
|
|
errors.payoutAddress = 'That doesn’t look like a valid Sapling address';
|
|
|
|
|
}
|
2018-09-20 11:58:47 -07:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-20 13:37:26 -08:00
|
|
|
|
// Tip Jar Address
|
|
|
|
|
if (tipJarAddress && !isValidSaplingAddress(tipJarAddress)) {
|
|
|
|
|
if (isValidSproutAddress(tipJarAddress)) {
|
|
|
|
|
errors.tipJarAddress = 'Must be a Sapling address, not a Sprout address';
|
|
|
|
|
} else if (isValidTAddress(tipJarAddress)) {
|
|
|
|
|
errors.tipJarAddress = 'Must be a Sapling Z address, not a T address';
|
|
|
|
|
} else {
|
|
|
|
|
errors.tipJarAddress = 'That doesn’t look like a valid Sapling address';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-20 11:58:47 -07:00
|
|
|
|
// Milestones
|
2018-10-19 15:03:37 -07:00
|
|
|
|
if (milestones) {
|
|
|
|
|
let cumulativeMilestonePct = 0;
|
|
|
|
|
const milestoneErrors = milestones.map((ms, idx) => {
|
2019-07-24 11:29:11 -07:00
|
|
|
|
// check payout first so we collect the cumulativePayout even if other fields are invalid
|
|
|
|
|
if (!ms.payoutPercent) {
|
|
|
|
|
return 'Payout percent is required';
|
|
|
|
|
} else if (Number.isNaN(parseInt(ms.payoutPercent, 10))) {
|
|
|
|
|
return 'Payout percent must be a valid number';
|
|
|
|
|
} else if (parseInt(ms.payoutPercent, 10) !== parseFloat(ms.payoutPercent)) {
|
|
|
|
|
return 'Payout percent must be a whole number, no decimals';
|
|
|
|
|
} else if (parseInt(ms.payoutPercent, 10) <= 0) {
|
|
|
|
|
return 'Payout percent must be greater than 0%';
|
|
|
|
|
} else if (parseInt(ms.payoutPercent, 10) > 100) {
|
|
|
|
|
return 'Payout percent must be less than or equal to 100%';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Last one shows percentage errors
|
|
|
|
|
cumulativeMilestonePct += parseInt(ms.payoutPercent, 10);
|
|
|
|
|
|
2019-02-20 13:34:05 -08:00
|
|
|
|
if (!ms.title) {
|
|
|
|
|
return 'Title is required';
|
|
|
|
|
} else if (ms.title.length > 40) {
|
|
|
|
|
return 'Title length can only be 40 characters maximum';
|
2018-10-19 15:03:37 -07:00
|
|
|
|
}
|
2018-09-20 11:58:47 -07:00
|
|
|
|
|
2019-02-20 13:34:05 -08:00
|
|
|
|
if (!ms.content) {
|
|
|
|
|
return 'Description is required';
|
2018-11-14 08:43:00 -08:00
|
|
|
|
} else if (ms.content.length > 200) {
|
2019-02-20 13:34:05 -08:00
|
|
|
|
return 'Description can only be 200 characters maximum';
|
2018-10-19 15:03:37 -07:00
|
|
|
|
}
|
2018-09-20 11:58:47 -07:00
|
|
|
|
|
2019-11-13 14:38:17 -08:00
|
|
|
|
if (!ms.immediatePayout) {
|
|
|
|
|
if (!ms.daysEstimated) {
|
|
|
|
|
return 'Estimate in days is required';
|
|
|
|
|
} else if (Number.isNaN(parseInt(ms.daysEstimated, 10))) {
|
|
|
|
|
return 'Days estimated must be a valid number';
|
|
|
|
|
} else if (parseInt(ms.daysEstimated, 10) !== parseFloat(ms.daysEstimated)) {
|
|
|
|
|
return 'Days estimated must be a whole number, no decimals';
|
|
|
|
|
} else if (parseInt(ms.daysEstimated, 10) <= 0) {
|
|
|
|
|
return 'Days estimated must be greater than 0';
|
|
|
|
|
} else if (parseInt(ms.daysEstimated, 10) > 365) {
|
|
|
|
|
return 'Days estimated must be less than or equal to 365';
|
2019-07-24 11:29:11 -07:00
|
|
|
|
}
|
2019-02-19 13:42:40 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
idx === milestones.length - 1 &&
|
|
|
|
|
cumulativeMilestonePct !== 100 &&
|
|
|
|
|
!Number.isNaN(cumulativeMilestonePct)
|
|
|
|
|
) {
|
2019-02-20 13:34:05 -08:00
|
|
|
|
return `Payout percentages don’t add up to 100% (currently ${cumulativeMilestonePct}%)`;
|
2018-10-19 15:03:37 -07:00
|
|
|
|
}
|
2019-02-20 13:34:05 -08:00
|
|
|
|
return '';
|
2018-10-19 15:03:37 -07:00
|
|
|
|
});
|
2019-02-20 13:34:05 -08:00
|
|
|
|
if (milestoneErrors.find(err => !!err)) {
|
2018-10-19 15:03:37 -07:00
|
|
|
|
errors.milestones = milestoneErrors;
|
|
|
|
|
}
|
2018-09-20 11:58:47 -07:00
|
|
|
|
}
|
|
|
|
|
return errors;
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-17 12:36:17 -08:00
|
|
|
|
export function validateUserProfile(user: User) {
|
2019-03-18 12:03:01 -07:00
|
|
|
|
if (user.displayName.length > 50) {
|
|
|
|
|
return 'Display name can only be 50 characters maximum';
|
|
|
|
|
} else if (user.title.length > 50) {
|
|
|
|
|
return 'Title can only be 50 characters maximum';
|
2018-09-27 13:25:49 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-16 08:57:03 -08:00
|
|
|
|
export function getCreateWarnings(form: Partial<ProposalDraft>): string[] {
|
|
|
|
|
const warnings = [];
|
|
|
|
|
|
|
|
|
|
// Warn about pending invites
|
2018-11-16 11:23:42 -08:00
|
|
|
|
const hasPending =
|
|
|
|
|
(form.invites || []).filter(inv => inv.accepted === null).length !== 0;
|
|
|
|
|
if (hasPending) {
|
2018-11-16 08:57:03 -08:00
|
|
|
|
warnings.push(`
|
|
|
|
|
You still have pending team invitations. If you publish before they
|
|
|
|
|
are accepted, your team will be locked in and they won’t be able to
|
2019-03-14 21:24:10 -07:00
|
|
|
|
join.
|
2018-11-16 08:57:03 -08:00
|
|
|
|
`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return warnings;
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-20 11:58:47 -07:00
|
|
|
|
// This is kind of a disgusting function, sorry.
|
2019-02-11 21:42:21 -08:00
|
|
|
|
export function makeProposalPreviewFromDraft(draft: ProposalDraft): ProposalDetail {
|
2019-02-01 11:13:30 -08:00
|
|
|
|
const { invites, ...rest } = draft;
|
2018-11-14 08:43:00 -08:00
|
|
|
|
const target = parseFloat(draft.target);
|
2018-09-20 11:58:47 -07:00
|
|
|
|
|
|
|
|
|
return {
|
2019-02-01 11:13:30 -08:00
|
|
|
|
...rest,
|
2018-11-07 09:33:19 -08:00
|
|
|
|
proposalId: 0,
|
2019-01-09 10:23:08 -08:00
|
|
|
|
status: STATUS.DRAFT,
|
2018-11-07 09:33:19 -08:00
|
|
|
|
proposalUrlId: '0-title',
|
|
|
|
|
proposalAddress: '0x0',
|
2018-12-27 09:41:26 -08:00
|
|
|
|
payoutAddress: '0x0',
|
2019-02-01 11:13:30 -08:00
|
|
|
|
dateCreated: Date.now() / 1000,
|
|
|
|
|
datePublished: Date.now() / 1000,
|
2019-02-05 13:05:45 -08:00
|
|
|
|
dateApproved: Date.now() / 1000,
|
CCRs (#86)
* CCRs API / Models boilerplate
* start on frontend
* backendy things
* Create CCR redux module, integrate API endpoints, create types
* Fix/Cleanup API
* Wire up CreateRequestDraftList
* bounty->target
* Add 'Create Request Flow' MVP
* cleanup
* Tweak filenames
* Simplify migrations
* fix migrations
* CCR Staking MVP
* tslint
* Get Pending Requests into Profile
* Remove staking requirement
* more staking related removals
* MVP Admin integration
* Make RFP when CCR is accepted
* Add pagination to CCRs in Admin
Improve styles for Proposals
* Hookup notifications
Adjust copy
* Simplify ccr->rfp relationship
Add admin approval email
Fixup copy
* Show Message on RFP Detail
Make Header CTAs change based on draft status
Adjust proposal card style
* Bugfix: Show header for non signed in users
* Add 'create a request' to intro
* Profile Created CCRs
RFP CCR attribution
* ignore
* CCR Price in USD (#85)
* init profile tipjar backend
* init profile tipjar frontend
* fix lint
* implement tip jar block
* fix wrapping, hide tip block on self
* init backend proposal tipjar
* init frontend proposal tipjar
* add hide title, fix bug
* uncomment rate limit
* rename vars, use null check
* allow address and view key to be unset
* add api tests
* fix tsc errors
* fix lint
* fix CopyInput styling
* fix migrations
* hide tipping in proposal if address not set
* add tip address to create flow
* redesign campaign block
* fix typo
* init backend changes
* init admin changes
* init frontend changes
* fix backend tests
* update campaign block
* be - init rfp usd changes
* admin - init rfp usd changes
* fe - fully adapt api util functions to usd
* fe - init rfp usd changes
* adapt profile created to usd
* misc usd changes
* add tip jar to dedicated card
* fix tipjar bug
* use zf light logo
* switch to zf grants logo
* hide profile tip jar if address not set
* add comment, run prettier
* conditionally add info icon and tooltip to funding line
* admin - disallow decimals in RFPs
* fe - cover usd string edge case
* add Usd as rfp bounty type
* fix migration order
* fix email bug
* adapt CCRs to USD
* implement CCR preview
* fix tsc
* Copy Updates and UX Tweaks (#87)
* Add default structure to proposal content
* Landing page copy
* Hide contributors tab for v2 proposals
* Minor UX tweaks for Liking/Following/Tipping
* Copy for Tipping Tooltip, proposal explainer for review, and milestone day estimate notice.
* Fix header styles bug and remove commented out styles.
* Revert "like" / "unfollow" hyphenication
* Comment out unused tests related to staking
Increase PROPOSAL_TARGET_MAX in .env.example
* Comment out ccr approval email send until ready
* Adjust styles, copy.
* fix proposal prune test (#88)
* fix USD display in preview, fix non-unique key (#90)
* Pre-stepper explainer for CCRs.
* Tweak styles
* Default content for CCRs
* fix tsc
* CCR approval and rejection emails
* add back admin_approval_ccr email templates
* Link ccr author name to profile in RFPs
* copy tweaks
* copy tweak
* hookup mangle user command
* Fix/add endif in jinja
* fix tests
* review
* fix review
2019-12-05 17:01:02 -08:00
|
|
|
|
target: toUsd(draft.target),
|
|
|
|
|
funded: toUsd('0'),
|
2019-01-29 15:50:27 -08:00
|
|
|
|
contributionMatching: 0,
|
CCRs (#86)
* CCRs API / Models boilerplate
* start on frontend
* backendy things
* Create CCR redux module, integrate API endpoints, create types
* Fix/Cleanup API
* Wire up CreateRequestDraftList
* bounty->target
* Add 'Create Request Flow' MVP
* cleanup
* Tweak filenames
* Simplify migrations
* fix migrations
* CCR Staking MVP
* tslint
* Get Pending Requests into Profile
* Remove staking requirement
* more staking related removals
* MVP Admin integration
* Make RFP when CCR is accepted
* Add pagination to CCRs in Admin
Improve styles for Proposals
* Hookup notifications
Adjust copy
* Simplify ccr->rfp relationship
Add admin approval email
Fixup copy
* Show Message on RFP Detail
Make Header CTAs change based on draft status
Adjust proposal card style
* Bugfix: Show header for non signed in users
* Add 'create a request' to intro
* Profile Created CCRs
RFP CCR attribution
* ignore
* CCR Price in USD (#85)
* init profile tipjar backend
* init profile tipjar frontend
* fix lint
* implement tip jar block
* fix wrapping, hide tip block on self
* init backend proposal tipjar
* init frontend proposal tipjar
* add hide title, fix bug
* uncomment rate limit
* rename vars, use null check
* allow address and view key to be unset
* add api tests
* fix tsc errors
* fix lint
* fix CopyInput styling
* fix migrations
* hide tipping in proposal if address not set
* add tip address to create flow
* redesign campaign block
* fix typo
* init backend changes
* init admin changes
* init frontend changes
* fix backend tests
* update campaign block
* be - init rfp usd changes
* admin - init rfp usd changes
* fe - fully adapt api util functions to usd
* fe - init rfp usd changes
* adapt profile created to usd
* misc usd changes
* add tip jar to dedicated card
* fix tipjar bug
* use zf light logo
* switch to zf grants logo
* hide profile tip jar if address not set
* add comment, run prettier
* conditionally add info icon and tooltip to funding line
* admin - disallow decimals in RFPs
* fe - cover usd string edge case
* add Usd as rfp bounty type
* fix migration order
* fix email bug
* adapt CCRs to USD
* implement CCR preview
* fix tsc
* Copy Updates and UX Tweaks (#87)
* Add default structure to proposal content
* Landing page copy
* Hide contributors tab for v2 proposals
* Minor UX tweaks for Liking/Following/Tipping
* Copy for Tipping Tooltip, proposal explainer for review, and milestone day estimate notice.
* Fix header styles bug and remove commented out styles.
* Revert "like" / "unfollow" hyphenication
* Comment out unused tests related to staking
Increase PROPOSAL_TARGET_MAX in .env.example
* Comment out ccr approval email send until ready
* Adjust styles, copy.
* fix proposal prune test (#88)
* fix USD display in preview, fix non-unique key (#90)
* Pre-stepper explainer for CCRs.
* Tweak styles
* Default content for CCRs
* fix tsc
* CCR approval and rejection emails
* add back admin_approval_ccr email templates
* Link ccr author name to profile in RFPs
* copy tweaks
* copy tweak
* hookup mangle user command
* Fix/add endif in jinja
* fix tests
* review
* fix review
2019-12-05 17:01:02 -08:00
|
|
|
|
contributionBounty: toUsd('0'),
|
2018-12-27 11:08:14 -08:00
|
|
|
|
percentFunded: 0,
|
2019-02-13 08:54:46 -08:00
|
|
|
|
stage: PROPOSAL_STAGE.PREVIEW,
|
2019-01-31 14:56:16 -08:00
|
|
|
|
isStaked: true,
|
2019-02-09 19:03:19 -08:00
|
|
|
|
arbiter: {
|
|
|
|
|
status: PROPOSAL_ARBITER_STATUS.ACCEPTED,
|
|
|
|
|
},
|
ZF Grants 2.1 (#496)
* fix ccr pagination defaults
* add ccr admin tests
* add ccr user tests
* checkpoint
* fix tslint
* request changes discussion flow mvp
* admin - add discussion status
* backend - add live drafts
* admin - add live drafts
* frontend - add live drafts
* frontend - add edit discussion proposal
* fix tsc
* include DISCUSSION status in propsal listview
* do not make live draft on admin request changes
* hide live drafts from user proposal draft list
* fix backend tests
* add admin tests
* add user tests
* fix: liking, viewing discussion proposals, admin menu
* admin - update hints for live drafts
* fe - add better messaging when updating a proposal
* be - fix like test
* remove TODO comments
* add new email types
* fix storybook
* add revision tab story
* backend - implement proposal revisions
* frontend - implement proposal revisions
* update revision tab story
* fix lint
* remove set detection
* email proposal followers on revision
* restrict banner to team members only
* misc bug fixes
* update, add backend tests
* add milestone title change to revision history story
* fix milestones display in preview
* allow archived proposals to be queried
* implement archived proposal page
* fix tsc
* implement archived proposal get route
* move styling into less
* remove proposal archive parent id
* handle archived proposal status
* cleanup
* remove contributions, switch to USD, implement quarters
* use Qs to preserve formatting
* handle edit only kyc
* prevent ARCHIVED proposals from being sent to admin
* display latest revision first
* admin - proposal & ccr reject permanently
* backend - proposal & ccr reject permanently
* frontend - proposal & ccr reject permanently
* fix tsc
* use $ in milestone payout email
* introduce custom filters to proposal listview
* hide archive link on first revision
* upgrade packages
* add bech32 implementation
* add z address validation with tests
* fix tslint
* use local address validation
* fix tests, remove blockchain mock gets
* add additional bad addresses
* update briefs to include page break message
* remove contributions routes, menu entry
* disable countribution count admin stats
* remove matching and pretty print in finance
* fix tslint
* separate out rejected permanently proposals
* make removing proposals generic
* allow linked tabs to be ignored
* remove rejected permanently, bugfix
* update preview link to point to rejected tab
* implement rejected permanently tab, add tab message
* refactor variable
* fix tslint
* fix tslint
* send ccr reject permanently email on rejection
* fix preview message
* wire up proposal arbiter and rejected emails
* disable tip jar in proposal and profile
* sync ccr/proposal drafts on create form init
* check invites on submit modal open
* update team invite language
* update team text when edit
* fix ccr rejected permanently tag
* text changes, email preview fix
* display changes requested tag when in discussion with changes requested
* enable social share on open for discussion proposals, update language
* place sort below filter
* derive filter from query string
* use better filter names in query params
* fix tslint
* create snapshot of original proposal on first revision
* clear invites between edits, account for additional changes not tracked in revisions
* update tests
* fix test
* remove print
* SameSite Fixes (#150)
* QA Fixes 2 (#151)
* set filters as query strings on change
* remove rejected permanently tags
* add dollar sign in financials legend
* fix tsc
* Copy Touchups (#152)
* Email Fixes (#155)
* fix ZEC in milestone payout emails
* fix links in rejected permanently CCR/proposal emails
* Poll for Team and Invite Changes in Create Flow (#153)
* poll for team and invite changes in create flow
* fix tslint
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* pretty print payouts by quarter (#156)
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* Remove Blockchain Module (#154)
* remove blockchain route from backend, remove calls to node
* revert blockchain_get removal
* Add Tags to Proposal Cards (#157)
* add tag to proposals and dynamically set v1 card height
* listen on window resize
* make card height props optional
* set tag in bottom right, remove dynamic card resize, add dynamic tag resize
* cleanup
* cleanup
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* Improve Frontend Address Validation (#158)
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* Remove blockchain module (#162)
* remove blockchain route from backend, remove calls to node
* revert blockchain_get removal
* Remove Blockchain App (#160)
* remove blockchain app
* remove blockchain app from travis
Co-authored-by: Danny Skubak <skubakdj@gmail.com>
* Proposal Edit Fixes (#161)
* fe - display error if edit creation fails
* be - restrict live draft publish
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* Restrict Arbiter Assignment (#159)
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* Email Copy updates
* Remove Admin Financials Card
* Hookup 'proposal_approved_without_funding' to admin email example
* bump various package versions
* Update yarn.lock files
* Attach 'proposal_approved_without_funding' to backend example email
* bump package versions
Co-authored-by: Danny Skubak <skubakdj@gmail.com>
2020-04-07 19:56:32 -07:00
|
|
|
|
changesRequestedDiscussion: null,
|
|
|
|
|
changesRequestedDiscussionReason: null,
|
|
|
|
|
liveDraftId: null,
|
2019-11-20 13:37:26 -08:00
|
|
|
|
tipJarAddress: null,
|
|
|
|
|
tipJarViewKey: null,
|
2019-10-16 20:43:20 -07:00
|
|
|
|
acceptedWithFunding: false,
|
2019-10-23 14:34:10 -07:00
|
|
|
|
authedFollows: false,
|
|
|
|
|
followersCount: 0,
|
2019-10-24 10:32:00 -07:00
|
|
|
|
authedLiked: false,
|
|
|
|
|
likesCount: 0,
|
2019-10-11 12:51:10 -07:00
|
|
|
|
isVersionTwo: true,
|
2018-11-14 08:43:00 -08:00
|
|
|
|
milestones: draft.milestones.map((m, idx) => ({
|
2019-02-11 21:42:21 -08:00
|
|
|
|
id: idx,
|
2018-09-20 11:58:47 -07:00
|
|
|
|
index: idx,
|
|
|
|
|
title: m.title,
|
2018-11-14 08:43:00 -08:00
|
|
|
|
content: m.content,
|
CCRs (#86)
* CCRs API / Models boilerplate
* start on frontend
* backendy things
* Create CCR redux module, integrate API endpoints, create types
* Fix/Cleanup API
* Wire up CreateRequestDraftList
* bounty->target
* Add 'Create Request Flow' MVP
* cleanup
* Tweak filenames
* Simplify migrations
* fix migrations
* CCR Staking MVP
* tslint
* Get Pending Requests into Profile
* Remove staking requirement
* more staking related removals
* MVP Admin integration
* Make RFP when CCR is accepted
* Add pagination to CCRs in Admin
Improve styles for Proposals
* Hookup notifications
Adjust copy
* Simplify ccr->rfp relationship
Add admin approval email
Fixup copy
* Show Message on RFP Detail
Make Header CTAs change based on draft status
Adjust proposal card style
* Bugfix: Show header for non signed in users
* Add 'create a request' to intro
* Profile Created CCRs
RFP CCR attribution
* ignore
* CCR Price in USD (#85)
* init profile tipjar backend
* init profile tipjar frontend
* fix lint
* implement tip jar block
* fix wrapping, hide tip block on self
* init backend proposal tipjar
* init frontend proposal tipjar
* add hide title, fix bug
* uncomment rate limit
* rename vars, use null check
* allow address and view key to be unset
* add api tests
* fix tsc errors
* fix lint
* fix CopyInput styling
* fix migrations
* hide tipping in proposal if address not set
* add tip address to create flow
* redesign campaign block
* fix typo
* init backend changes
* init admin changes
* init frontend changes
* fix backend tests
* update campaign block
* be - init rfp usd changes
* admin - init rfp usd changes
* fe - fully adapt api util functions to usd
* fe - init rfp usd changes
* adapt profile created to usd
* misc usd changes
* add tip jar to dedicated card
* fix tipjar bug
* use zf light logo
* switch to zf grants logo
* hide profile tip jar if address not set
* add comment, run prettier
* conditionally add info icon and tooltip to funding line
* admin - disallow decimals in RFPs
* fe - cover usd string edge case
* add Usd as rfp bounty type
* fix migration order
* fix email bug
* adapt CCRs to USD
* implement CCR preview
* fix tsc
* Copy Updates and UX Tweaks (#87)
* Add default structure to proposal content
* Landing page copy
* Hide contributors tab for v2 proposals
* Minor UX tweaks for Liking/Following/Tipping
* Copy for Tipping Tooltip, proposal explainer for review, and milestone day estimate notice.
* Fix header styles bug and remove commented out styles.
* Revert "like" / "unfollow" hyphenication
* Comment out unused tests related to staking
Increase PROPOSAL_TARGET_MAX in .env.example
* Comment out ccr approval email send until ready
* Adjust styles, copy.
* fix proposal prune test (#88)
* fix USD display in preview, fix non-unique key (#90)
* Pre-stepper explainer for CCRs.
* Tweak styles
* Default content for CCRs
* fix tsc
* CCR approval and rejection emails
* add back admin_approval_ccr email templates
* Link ccr author name to profile in RFPs
* copy tweaks
* copy tweak
* hookup mangle user command
* Fix/add endif in jinja
* fix tests
* review
* fix review
2019-12-05 17:01:02 -08:00
|
|
|
|
amount: (target * (parseInt(m.payoutPercent, 10) / 100)).toFixed(2),
|
2019-11-13 14:38:17 -08:00
|
|
|
|
daysEstimated: m.daysEstimated,
|
2018-09-20 11:58:47 -07:00
|
|
|
|
immediatePayout: m.immediatePayout,
|
|
|
|
|
payoutPercent: m.payoutPercent.toString(),
|
2019-02-11 13:22:40 -08:00
|
|
|
|
stage: MILESTONE_STAGE.IDLE,
|
2018-09-20 11:58:47 -07:00
|
|
|
|
})),
|
2019-02-11 21:42:21 -08:00
|
|
|
|
...PROPOSAL_DETAIL_INITIAL_STATE,
|
2018-09-20 11:58:47 -07:00
|
|
|
|
};
|
|
|
|
|
}
|
CCRs (#86)
* CCRs API / Models boilerplate
* start on frontend
* backendy things
* Create CCR redux module, integrate API endpoints, create types
* Fix/Cleanup API
* Wire up CreateRequestDraftList
* bounty->target
* Add 'Create Request Flow' MVP
* cleanup
* Tweak filenames
* Simplify migrations
* fix migrations
* CCR Staking MVP
* tslint
* Get Pending Requests into Profile
* Remove staking requirement
* more staking related removals
* MVP Admin integration
* Make RFP when CCR is accepted
* Add pagination to CCRs in Admin
Improve styles for Proposals
* Hookup notifications
Adjust copy
* Simplify ccr->rfp relationship
Add admin approval email
Fixup copy
* Show Message on RFP Detail
Make Header CTAs change based on draft status
Adjust proposal card style
* Bugfix: Show header for non signed in users
* Add 'create a request' to intro
* Profile Created CCRs
RFP CCR attribution
* ignore
* CCR Price in USD (#85)
* init profile tipjar backend
* init profile tipjar frontend
* fix lint
* implement tip jar block
* fix wrapping, hide tip block on self
* init backend proposal tipjar
* init frontend proposal tipjar
* add hide title, fix bug
* uncomment rate limit
* rename vars, use null check
* allow address and view key to be unset
* add api tests
* fix tsc errors
* fix lint
* fix CopyInput styling
* fix migrations
* hide tipping in proposal if address not set
* add tip address to create flow
* redesign campaign block
* fix typo
* init backend changes
* init admin changes
* init frontend changes
* fix backend tests
* update campaign block
* be - init rfp usd changes
* admin - init rfp usd changes
* fe - fully adapt api util functions to usd
* fe - init rfp usd changes
* adapt profile created to usd
* misc usd changes
* add tip jar to dedicated card
* fix tipjar bug
* use zf light logo
* switch to zf grants logo
* hide profile tip jar if address not set
* add comment, run prettier
* conditionally add info icon and tooltip to funding line
* admin - disallow decimals in RFPs
* fe - cover usd string edge case
* add Usd as rfp bounty type
* fix migration order
* fix email bug
* adapt CCRs to USD
* implement CCR preview
* fix tsc
* Copy Updates and UX Tweaks (#87)
* Add default structure to proposal content
* Landing page copy
* Hide contributors tab for v2 proposals
* Minor UX tweaks for Liking/Following/Tipping
* Copy for Tipping Tooltip, proposal explainer for review, and milestone day estimate notice.
* Fix header styles bug and remove commented out styles.
* Revert "like" / "unfollow" hyphenication
* Comment out unused tests related to staking
Increase PROPOSAL_TARGET_MAX in .env.example
* Comment out ccr approval email send until ready
* Adjust styles, copy.
* fix proposal prune test (#88)
* fix USD display in preview, fix non-unique key (#90)
* Pre-stepper explainer for CCRs.
* Tweak styles
* Default content for CCRs
* fix tsc
* CCR approval and rejection emails
* add back admin_approval_ccr email templates
* Link ccr author name to profile in RFPs
* copy tweaks
* copy tweak
* hookup mangle user command
* Fix/add endif in jinja
* fix tests
* review
* fix review
2019-12-05 17:01:02 -08:00
|
|
|
|
|
|
|
|
|
export function makeRfpPreviewFromCcrDraft(draft: CCRDraft): RFP {
|
|
|
|
|
const ccr: CCR = {
|
|
|
|
|
...draft,
|
|
|
|
|
};
|
|
|
|
|
const now = new Date().getTime();
|
|
|
|
|
const { brief, content, title } = draft;
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
id: 0,
|
|
|
|
|
urlId: '',
|
|
|
|
|
status: RFP_STATUS.LIVE,
|
|
|
|
|
acceptedProposals: [],
|
|
|
|
|
bounty: draft.target ? toUsd(draft.target) : null,
|
|
|
|
|
matching: false,
|
|
|
|
|
dateOpened: now / 1000,
|
|
|
|
|
authedLiked: false,
|
|
|
|
|
likesCount: 0,
|
|
|
|
|
isVersionTwo: true,
|
|
|
|
|
ccr,
|
|
|
|
|
brief,
|
|
|
|
|
content,
|
|
|
|
|
title,
|
|
|
|
|
};
|
|
|
|
|
}
|
ZF Grants 2.1 (#496)
* fix ccr pagination defaults
* add ccr admin tests
* add ccr user tests
* checkpoint
* fix tslint
* request changes discussion flow mvp
* admin - add discussion status
* backend - add live drafts
* admin - add live drafts
* frontend - add live drafts
* frontend - add edit discussion proposal
* fix tsc
* include DISCUSSION status in propsal listview
* do not make live draft on admin request changes
* hide live drafts from user proposal draft list
* fix backend tests
* add admin tests
* add user tests
* fix: liking, viewing discussion proposals, admin menu
* admin - update hints for live drafts
* fe - add better messaging when updating a proposal
* be - fix like test
* remove TODO comments
* add new email types
* fix storybook
* add revision tab story
* backend - implement proposal revisions
* frontend - implement proposal revisions
* update revision tab story
* fix lint
* remove set detection
* email proposal followers on revision
* restrict banner to team members only
* misc bug fixes
* update, add backend tests
* add milestone title change to revision history story
* fix milestones display in preview
* allow archived proposals to be queried
* implement archived proposal page
* fix tsc
* implement archived proposal get route
* move styling into less
* remove proposal archive parent id
* handle archived proposal status
* cleanup
* remove contributions, switch to USD, implement quarters
* use Qs to preserve formatting
* handle edit only kyc
* prevent ARCHIVED proposals from being sent to admin
* display latest revision first
* admin - proposal & ccr reject permanently
* backend - proposal & ccr reject permanently
* frontend - proposal & ccr reject permanently
* fix tsc
* use $ in milestone payout email
* introduce custom filters to proposal listview
* hide archive link on first revision
* upgrade packages
* add bech32 implementation
* add z address validation with tests
* fix tslint
* use local address validation
* fix tests, remove blockchain mock gets
* add additional bad addresses
* update briefs to include page break message
* remove contributions routes, menu entry
* disable countribution count admin stats
* remove matching and pretty print in finance
* fix tslint
* separate out rejected permanently proposals
* make removing proposals generic
* allow linked tabs to be ignored
* remove rejected permanently, bugfix
* update preview link to point to rejected tab
* implement rejected permanently tab, add tab message
* refactor variable
* fix tslint
* fix tslint
* send ccr reject permanently email on rejection
* fix preview message
* wire up proposal arbiter and rejected emails
* disable tip jar in proposal and profile
* sync ccr/proposal drafts on create form init
* check invites on submit modal open
* update team invite language
* update team text when edit
* fix ccr rejected permanently tag
* text changes, email preview fix
* display changes requested tag when in discussion with changes requested
* enable social share on open for discussion proposals, update language
* place sort below filter
* derive filter from query string
* use better filter names in query params
* fix tslint
* create snapshot of original proposal on first revision
* clear invites between edits, account for additional changes not tracked in revisions
* update tests
* fix test
* remove print
* SameSite Fixes (#150)
* QA Fixes 2 (#151)
* set filters as query strings on change
* remove rejected permanently tags
* add dollar sign in financials legend
* fix tsc
* Copy Touchups (#152)
* Email Fixes (#155)
* fix ZEC in milestone payout emails
* fix links in rejected permanently CCR/proposal emails
* Poll for Team and Invite Changes in Create Flow (#153)
* poll for team and invite changes in create flow
* fix tslint
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* pretty print payouts by quarter (#156)
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* Remove Blockchain Module (#154)
* remove blockchain route from backend, remove calls to node
* revert blockchain_get removal
* Add Tags to Proposal Cards (#157)
* add tag to proposals and dynamically set v1 card height
* listen on window resize
* make card height props optional
* set tag in bottom right, remove dynamic card resize, add dynamic tag resize
* cleanup
* cleanup
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* Improve Frontend Address Validation (#158)
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* Remove blockchain module (#162)
* remove blockchain route from backend, remove calls to node
* revert blockchain_get removal
* Remove Blockchain App (#160)
* remove blockchain app
* remove blockchain app from travis
Co-authored-by: Danny Skubak <skubakdj@gmail.com>
* Proposal Edit Fixes (#161)
* fe - display error if edit creation fails
* be - restrict live draft publish
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* Restrict Arbiter Assignment (#159)
Co-authored-by: Daniel Ternyak <dternyak@gmail.com>
* Email Copy updates
* Remove Admin Financials Card
* Hookup 'proposal_approved_without_funding' to admin email example
* bump various package versions
* Update yarn.lock files
* Attach 'proposal_approved_without_funding' to backend example email
* bump package versions
Co-authored-by: Danny Skubak <skubakdj@gmail.com>
2020-04-07 19:56:32 -07:00
|
|
|
|
|
|
|
|
|
export function makeProposalPreviewFromArchived(proposal: Proposal): ProposalDetail {
|
|
|
|
|
return {
|
|
|
|
|
...proposal,
|
|
|
|
|
...PROPOSAL_DETAIL_INITIAL_STATE,
|
|
|
|
|
};
|
|
|
|
|
}
|