2019-03-14 13:29:02 -07:00
|
|
|
import validators
|
2019-01-16 14:26:45 -08:00
|
|
|
from animal_case import keys_to_snake_case
|
2019-03-14 13:29:02 -07:00
|
|
|
from flask import Blueprint, g, current_app
|
2019-03-01 12:11:03 -08:00
|
|
|
from marshmallow import fields
|
2019-03-14 13:29:02 -07:00
|
|
|
from validate_email import validate_email
|
2019-03-18 12:03:01 -07:00
|
|
|
from webargs import validate
|
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
|
|
|
from grant.email.send import send_email
|
|
|
|
from grant.utils.misc import make_url
|
2019-03-01 12:11:03 -08:00
|
|
|
|
|
|
|
import grant.utils.auth as auth
|
2018-11-30 15:52:00 -08:00
|
|
|
from grant.comment.models import Comment, user_comments_schema
|
2019-01-22 21:35:22 -08:00
|
|
|
from grant.email.models import EmailRecovery
|
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 grant.ccr.models import CCR, ccrs_schema
|
2019-03-14 13:29:02 -07:00
|
|
|
from grant.extensions import limiter
|
2019-03-01 12:11:03 -08:00
|
|
|
from grant.parser import query, body
|
2018-11-30 15:52:00 -08:00
|
|
|
from grant.proposal.models import (
|
|
|
|
Proposal,
|
|
|
|
ProposalTeamInvite,
|
|
|
|
invites_with_proposal_schema,
|
2019-01-09 11:07:50 -08:00
|
|
|
user_proposal_contributions_schema,
|
2019-01-09 10:23:08 -08:00
|
|
|
user_proposals_schema,
|
2019-02-09 18:58:40 -08:00
|
|
|
user_proposal_arbiters_schema
|
2018-11-30 15:52:00 -08: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
|
|
|
from grant.proposal.models import ProposalContribution
|
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
|
|
|
from grant.utils.enums import ProposalStatus, ContributionStatus, CCRStatus
|
2019-01-22 21:35:22 -08:00
|
|
|
from grant.utils.exceptions import ValidationException
|
2019-01-02 10:23:02 -08:00
|
|
|
from grant.utils.social import verify_social, get_social_login_url, VerifySocialException
|
2019-01-22 21:35:22 -08:00
|
|
|
from grant.utils.upload import remove_avatar, sign_avatar_upload, AvatarException
|
2019-01-16 14:26:45 -08:00
|
|
|
from .models import (
|
|
|
|
User,
|
|
|
|
SocialMedia,
|
|
|
|
Avatar,
|
2019-01-27 14:13:12 -08:00
|
|
|
self_user_schema,
|
2019-01-16 14:26:45 -08:00
|
|
|
user_schema,
|
|
|
|
user_settings_schema,
|
|
|
|
db
|
|
|
|
)
|
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
|
|
|
from grant.utils.validate import is_z_address_valid
|
2018-09-25 13:09:25 -07:00
|
|
|
|
|
|
|
blueprint = Blueprint('user', __name__, url_prefix='/api/v1/users')
|
|
|
|
|
|
|
|
|
2018-10-19 22:18:27 -07:00
|
|
|
@blueprint.route("/me", methods=["GET"])
|
2019-02-21 14:23:46 -08:00
|
|
|
@auth.requires_auth
|
2018-10-19 22:18:27 -07:00
|
|
|
def get_me():
|
2019-01-27 14:13:12 -08:00
|
|
|
dumped_user = self_user_schema.dump(g.current_user)
|
2018-11-04 10:33:22 -08:00
|
|
|
return dumped_user
|
2018-10-19 22:18:27 -07:00
|
|
|
|
|
|
|
|
2018-12-14 11:36:22 -08:00
|
|
|
@blueprint.route("/<user_id>", methods=["GET"])
|
2019-03-01 12:11:03 -08:00
|
|
|
@query({
|
|
|
|
"withProposals": fields.Bool(required=False, missing=None),
|
|
|
|
"withComments": fields.Bool(required=False, missing=None),
|
|
|
|
"withFunded": fields.Bool(required=False, missing=None),
|
|
|
|
"withPending": fields.Bool(required=False, missing=None),
|
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
|
|
|
"withArbitrated": fields.Bool(required=False, missing=None),
|
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
|
|
|
"withRequests": fields.Bool(required=False, missing=None),
|
|
|
|
"withRejectedPermanently": fields.Bool(required=False, missing=None)
|
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
|
|
|
|
2019-03-01 12:11:03 -08:00
|
|
|
})
|
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
|
|
|
def get_user(user_id, with_proposals, with_comments, with_funded, with_pending, with_arbitrated, with_requests, with_rejected_permanently):
|
2018-12-14 11:36:22 -08:00
|
|
|
user = User.get_by_id(user_id)
|
2018-09-26 12:42:40 -07:00
|
|
|
if user:
|
|
|
|
result = user_schema.dump(user)
|
2019-02-21 14:23:46 -08:00
|
|
|
authed_user = auth.get_authed_user()
|
2019-02-06 14:37:45 -08:00
|
|
|
is_self = authed_user and authed_user.id == user.id
|
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
|
|
|
if with_requests:
|
|
|
|
requests = CCR.get_by_user(user)
|
|
|
|
requests_dump = ccrs_schema.dump(requests)
|
|
|
|
result["requests"] = requests_dump
|
2018-11-30 15:52:00 -08:00
|
|
|
if with_proposals:
|
|
|
|
proposals = Proposal.get_by_user(user)
|
|
|
|
proposals_dump = user_proposals_schema.dump(proposals)
|
2019-01-09 11:07:50 -08:00
|
|
|
result["proposals"] = proposals_dump
|
2018-11-30 15:52:00 -08:00
|
|
|
if with_funded:
|
2019-01-09 11:07:50 -08:00
|
|
|
contributions = ProposalContribution.get_by_userid(user_id)
|
2019-01-09 14:54:41 -08:00
|
|
|
if not authed_user or user.id != authed_user.id:
|
2019-01-30 09:59:15 -08:00
|
|
|
contributions = [c for c in contributions if c.status == ContributionStatus.CONFIRMED]
|
2019-06-11 19:49:14 -07:00
|
|
|
contributions = [c for c in contributions if not c.private]
|
2019-02-25 08:41:00 -08:00
|
|
|
contributions = [c for c in contributions if c.proposal.status == ProposalStatus.LIVE]
|
2019-01-09 11:07:50 -08:00
|
|
|
contributions_dump = user_proposal_contributions_schema.dump(contributions)
|
|
|
|
result["contributions"] = contributions_dump
|
2018-11-30 15:52:00 -08:00
|
|
|
if with_comments:
|
|
|
|
comments = Comment.get_by_user(user)
|
|
|
|
comments_dump = user_comments_schema.dump(comments)
|
|
|
|
result["comments"] = comments_dump
|
2019-02-06 14:37:45 -08:00
|
|
|
if with_pending and is_self:
|
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
|
|
|
pending_proposals = Proposal.get_by_user(user, [
|
|
|
|
ProposalStatus.STAKING,
|
|
|
|
ProposalStatus.PENDING,
|
|
|
|
ProposalStatus.APPROVED,
|
|
|
|
ProposalStatus.REJECTED,
|
|
|
|
])
|
|
|
|
pending_proposals_dump = user_proposals_schema.dump(pending_proposals)
|
|
|
|
result["pendingProposals"] = pending_proposals_dump
|
|
|
|
pending_ccrs = CCR.get_by_user(user, [
|
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
|
|
|
CCRStatus.PENDING,
|
|
|
|
CCRStatus.APPROVED,
|
|
|
|
CCRStatus.REJECTED,
|
2019-01-30 09:59:15 -08: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
|
|
|
pending_ccrs_dump = ccrs_schema.dump(pending_ccrs)
|
|
|
|
result["pendingRequests"] = pending_ccrs_dump
|
2019-02-06 14:37:45 -08:00
|
|
|
if with_arbitrated and is_self:
|
2019-02-09 18:58:40 -08:00
|
|
|
result["arbitrated"] = user_proposal_arbiters_schema.dump(user.arbiter_proposals)
|
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
|
|
|
if with_rejected_permanently and is_self:
|
|
|
|
rejected_proposals = Proposal.get_by_user(user, [
|
|
|
|
ProposalStatus.REJECTED_PERMANENTLY
|
|
|
|
])
|
|
|
|
result["rejectedPermanentlyProposals"] = user_proposals_schema.dump(rejected_proposals)
|
|
|
|
|
|
|
|
rejected_ccrs = CCR.get_by_user(user, [
|
|
|
|
CCRStatus.REJECTED_PERMANENTLY,
|
|
|
|
])
|
|
|
|
result["rejectedPermanentlyRequests"] = ccrs_schema.dump(rejected_ccrs)
|
2019-02-09 18:58:40 -08:00
|
|
|
|
2018-11-04 10:33:22 -08:00
|
|
|
return result
|
2018-09-26 12:42:40 -07:00
|
|
|
else:
|
2018-12-14 11:36:22 -08:00
|
|
|
message = "User with id matching {} not found".format(user_id)
|
2018-11-04 10:33:22 -08:00
|
|
|
return {"message": message}, 404
|
2018-10-01 16:22:56 -07:00
|
|
|
|
2018-10-19 22:18:27 -07:00
|
|
|
|
2018-10-01 16:22:56 -07:00
|
|
|
@blueprint.route("/", methods=["POST"])
|
2019-03-12 20:35:38 -07:00
|
|
|
@limiter.limit("30/day;5/minute")
|
2019-03-01 12:11:03 -08:00
|
|
|
@body({
|
2019-03-14 13:29:02 -07:00
|
|
|
"emailAddress": fields.Str(required=True, validate=lambda e: validate_email(e)),
|
2019-03-01 12:11:03 -08:00
|
|
|
"password": fields.Str(required=True),
|
2019-03-18 12:03:01 -07:00
|
|
|
"displayName": fields.Str(required=True, validate=validate.Length(min=2, max=50)),
|
|
|
|
"title": fields.Str(required=True, validate=validate.Length(min=2, max=50)),
|
2019-03-01 12:11:03 -08:00
|
|
|
})
|
2018-11-07 11:08:42 -08:00
|
|
|
def create_user(
|
2018-11-13 06:17:06 -08:00
|
|
|
email_address,
|
2018-12-14 11:36:22 -08:00
|
|
|
password,
|
2018-11-13 06:17:06 -08:00
|
|
|
display_name,
|
2018-12-14 11:36:22 -08:00
|
|
|
title
|
2018-11-07 11:08:42 -08:00
|
|
|
):
|
2018-12-14 11:36:22 -08:00
|
|
|
existing_user = User.get_by_email(email_address)
|
2018-10-01 16:22:56 -07:00
|
|
|
if existing_user:
|
2018-12-14 11:36:22 -08:00
|
|
|
return {"message": "User with that email already exists"}, 409
|
2018-10-01 16:22:56 -07:00
|
|
|
|
2018-11-02 09:07:06 -07:00
|
|
|
user = User.create(
|
2018-10-01 16:22:56 -07:00
|
|
|
email_address=email_address,
|
2018-12-14 11:36:22 -08:00
|
|
|
password=password,
|
2018-10-01 16:22:56 -07:00
|
|
|
display_name=display_name,
|
|
|
|
title=title
|
|
|
|
)
|
2018-12-14 11:36:22 -08:00
|
|
|
user.login()
|
2019-01-27 14:13:12 -08:00
|
|
|
result = self_user_schema.dump(user)
|
2018-11-27 11:07:09 -08:00
|
|
|
return result, 201
|
2018-10-30 07:40:21 -07:00
|
|
|
|
2018-11-13 06:17:06 -08:00
|
|
|
|
2018-11-07 11:08:42 -08:00
|
|
|
@blueprint.route("/auth", methods=["POST"])
|
2019-06-25 08:02:44 -07:00
|
|
|
@limiter.limit("30/hour;5/minute")
|
2019-03-01 12:11:03 -08:00
|
|
|
@body({
|
|
|
|
"email": fields.Str(required=True),
|
|
|
|
"password": fields.Str(required=True)
|
|
|
|
})
|
2018-12-14 11:36:22 -08:00
|
|
|
def auth_user(email, password):
|
2019-02-21 14:23:46 -08:00
|
|
|
authed_user = auth.auth_user(email, password)
|
|
|
|
return self_user_schema.dump(authed_user)
|
2018-11-07 11:08:42 -08:00
|
|
|
|
2018-11-13 06:17:06 -08:00
|
|
|
|
2019-01-24 10:53:26 -08:00
|
|
|
@blueprint.route("/me/password", methods=["PUT"])
|
2019-02-21 14:23:46 -08:00
|
|
|
@auth.requires_auth
|
2019-03-01 12:11:03 -08:00
|
|
|
@body({
|
|
|
|
"currentPassword": fields.Str(required=True),
|
|
|
|
"password": fields.Str(required=True)
|
|
|
|
})
|
2018-12-14 11:36:22 -08:00
|
|
|
def update_user_password(current_password, password):
|
|
|
|
if not g.current_user.check_password(current_password):
|
|
|
|
return {"message": "Current password incorrect"}, 403
|
|
|
|
g.current_user.set_password(password)
|
2019-03-01 12:11:03 -08:00
|
|
|
return {"message": "ok"}, 200
|
2018-10-30 07:40:21 -07:00
|
|
|
|
2018-11-13 06:17:06 -08:00
|
|
|
|
2019-01-24 10:53:26 -08:00
|
|
|
@blueprint.route("/me/email", methods=["PUT"])
|
2019-02-21 14:23:46 -08:00
|
|
|
@auth.requires_auth
|
2019-03-01 12:11:03 -08:00
|
|
|
@body({
|
2019-03-14 13:29:02 -07:00
|
|
|
"email": fields.Str(required=True, validate=lambda e: validate_email(e)),
|
2019-03-01 12:11:03 -08:00
|
|
|
"password": fields.Str(required=True)
|
|
|
|
})
|
2019-01-24 10:53:26 -08:00
|
|
|
def update_user_email(email, password):
|
|
|
|
if not g.current_user.check_password(password):
|
|
|
|
return {"message": "Password is incorrect"}, 403
|
2019-03-14 13:29:02 -07:00
|
|
|
current_app.logger.info(
|
|
|
|
f"Updating userId: {g.current_user.id} with current email: {g.current_user.email_address} to new email: {email}"
|
|
|
|
)
|
2019-01-24 10:53:26 -08:00
|
|
|
g.current_user.set_email(email)
|
2019-03-01 12:11:03 -08:00
|
|
|
return {"message": "ok"}, 200
|
2019-01-24 10:53:26 -08:00
|
|
|
|
|
|
|
|
2019-02-08 11:57:54 -08:00
|
|
|
@blueprint.route("/me/resend-verification", methods=["PUT"])
|
2019-02-21 14:23:46 -08:00
|
|
|
@auth.requires_auth
|
2019-02-08 11:57:54 -08:00
|
|
|
def resend_email_verification():
|
|
|
|
g.current_user.send_verification_email()
|
2019-03-01 12:11:03 -08:00
|
|
|
return {"message": "ok"}, 200
|
2019-02-08 11:57:54 -08:00
|
|
|
|
|
|
|
|
2018-12-14 11:36:22 -08:00
|
|
|
@blueprint.route("/logout", methods=["POST"])
|
2019-02-21 14:23:46 -08:00
|
|
|
@auth.requires_auth
|
2018-12-14 11:36:22 -08:00
|
|
|
def logout_user():
|
2019-02-21 14:23:46 -08:00
|
|
|
auth.logout_current_user()
|
2019-03-01 12:11:03 -08:00
|
|
|
return {"message": "ok"}, 200
|
2018-12-14 11:36:22 -08:00
|
|
|
|
|
|
|
|
2019-01-02 10:23:02 -08:00
|
|
|
@blueprint.route("/social/<service>/authurl", methods=["GET"])
|
2019-02-21 14:23:46 -08:00
|
|
|
@auth.requires_auth
|
2019-01-02 10:23:02 -08:00
|
|
|
def get_user_social_auth_url(service):
|
|
|
|
try:
|
|
|
|
return {"url": get_social_login_url(service)}
|
|
|
|
|
|
|
|
except VerifySocialException as e:
|
|
|
|
return {"message": str(e)}, 400
|
|
|
|
|
|
|
|
|
|
|
|
@blueprint.route("/social/<service>/verify", methods=["POST"])
|
2019-02-21 14:23:46 -08:00
|
|
|
@auth.requires_auth
|
2019-03-01 12:11:03 -08:00
|
|
|
@body({
|
|
|
|
"code": fields.Str(required=True)
|
|
|
|
})
|
2019-01-02 10:23:02 -08:00
|
|
|
def verify_user_social(service, code):
|
|
|
|
try:
|
|
|
|
# 1. verify with 3rd party
|
|
|
|
username = verify_social(service, code)
|
|
|
|
# 2. remove existing username/service
|
|
|
|
sm_other_db = SocialMedia.query.filter_by(service=service, username=username).first()
|
|
|
|
if sm_other_db:
|
|
|
|
db.session.delete(sm_other_db)
|
|
|
|
# 3. remove existing for authed user/service
|
|
|
|
sm_self_db = SocialMedia.query.filter_by(service=service, user_id=g.current_user.id).first()
|
|
|
|
if sm_self_db:
|
|
|
|
db.session.delete(sm_self_db)
|
|
|
|
# 4. set this users verified social item
|
|
|
|
sm = SocialMedia(service=service, username=username, user_id=g.current_user.id)
|
|
|
|
db.session.add(sm)
|
|
|
|
db.session.commit()
|
|
|
|
return {"username": username}, 200
|
|
|
|
|
|
|
|
except VerifySocialException as e:
|
|
|
|
return {"message": str(e)}, 400
|
|
|
|
|
|
|
|
|
2018-12-17 10:33:33 -08:00
|
|
|
@blueprint.route("/recover", methods=["POST"])
|
2019-03-12 20:35:38 -07:00
|
|
|
@limiter.limit("10/day;2/minute")
|
2019-03-01 12:11:03 -08:00
|
|
|
@body({
|
|
|
|
"email": fields.Str(required=True)
|
|
|
|
})
|
2018-12-17 10:33:33 -08:00
|
|
|
def recover_user(email):
|
|
|
|
existing_user = User.get_by_email(email)
|
|
|
|
if not existing_user:
|
|
|
|
return {"message": "No user exists with that email"}, 400
|
2019-02-21 14:23:46 -08:00
|
|
|
auth.throw_on_banned(existing_user)
|
2018-12-17 10:33:33 -08:00
|
|
|
existing_user.send_recovery_email()
|
2019-03-01 12:11:03 -08:00
|
|
|
return {"message": "ok"}, 200
|
2018-12-17 10:33:33 -08:00
|
|
|
|
|
|
|
|
|
|
|
@blueprint.route("/recover/<code>", methods=["POST"])
|
2019-03-01 12:11:03 -08:00
|
|
|
@body({
|
|
|
|
"password": fields.Str(required=True)
|
|
|
|
})
|
2018-12-17 10:33:33 -08:00
|
|
|
def recover_email(code, password):
|
|
|
|
er = EmailRecovery.query.filter_by(code=code).first()
|
|
|
|
if er:
|
|
|
|
if er.is_expired():
|
|
|
|
return {"message": "Reset code expired"}, 401
|
2019-02-21 14:23:46 -08:00
|
|
|
auth.throw_on_banned(er.user)
|
2018-12-17 10:33:33 -08:00
|
|
|
er.user.set_password(password)
|
|
|
|
db.session.delete(er)
|
|
|
|
db.session.commit()
|
2019-03-01 12:11:03 -08:00
|
|
|
return {"message": "ok"}, 200
|
2018-12-17 10:33:33 -08:00
|
|
|
|
|
|
|
return {"message": "Invalid reset code"}, 400
|
|
|
|
|
|
|
|
|
2018-12-14 11:36:22 -08:00
|
|
|
@blueprint.route("/avatar", methods=["POST"])
|
2019-03-12 20:35:38 -07:00
|
|
|
@limiter.limit("20/day;3/minute")
|
2019-02-21 14:23:46 -08:00
|
|
|
@auth.requires_auth
|
2019-03-01 12:11:03 -08:00
|
|
|
@body({
|
|
|
|
"mimetype": fields.Str(required=True)
|
|
|
|
})
|
2018-12-14 11:36:22 -08:00
|
|
|
def upload_avatar(mimetype):
|
2018-11-16 19:33:25 -08:00
|
|
|
user = g.current_user
|
|
|
|
try:
|
2018-12-14 11:36:22 -08:00
|
|
|
signed_post = sign_avatar_upload(mimetype, user.id)
|
|
|
|
return signed_post
|
|
|
|
except AvatarException as e:
|
2018-11-16 19:33:25 -08:00
|
|
|
return {"message": str(e)}, 400
|
|
|
|
|
|
|
|
|
|
|
|
@blueprint.route("/avatar", methods=["DELETE"])
|
2019-02-21 14:23:46 -08:00
|
|
|
@auth.requires_auth
|
2019-03-01 12:11:03 -08:00
|
|
|
@body({
|
|
|
|
"url": fields.Str(required=True)
|
|
|
|
})
|
2018-11-16 19:33:25 -08:00
|
|
|
def delete_avatar(url):
|
|
|
|
user = g.current_user
|
|
|
|
remove_avatar(url, user.id)
|
|
|
|
|
|
|
|
|
2018-12-14 11:36:22 -08:00
|
|
|
@blueprint.route("/<user_id>", methods=["PUT"])
|
2019-02-21 14:23:46 -08:00
|
|
|
@auth.requires_auth
|
|
|
|
@auth.requires_same_user_auth
|
2019-03-01 12:11:03 -08:00
|
|
|
@body({
|
2019-03-14 13:29:02 -07:00
|
|
|
"displayName": fields.Str(required=True, validate=lambda d: 2 <= len(d) <= 60),
|
|
|
|
"title": fields.Str(required=True, validate=lambda t: 2 <= len(t) <= 60),
|
2019-03-01 12:11:03 -08:00
|
|
|
"socialMedias": fields.List(fields.Dict(), required=True),
|
2019-03-14 18:55:13 -07:00
|
|
|
"avatar": fields.Str(required=True, allow_none=True, validate=lambda d: validators.url(d))
|
2019-03-01 12:11:03 -08:00
|
|
|
})
|
2018-12-14 11:36:22 -08:00
|
|
|
def update_user(user_id, display_name, title, social_medias, avatar):
|
2018-11-13 06:17:06 -08:00
|
|
|
user = g.current_user
|
2018-10-30 07:40:21 -07:00
|
|
|
|
|
|
|
if display_name is not None:
|
|
|
|
user.display_name = display_name
|
|
|
|
|
|
|
|
if title is not None:
|
|
|
|
user.title = title
|
|
|
|
|
2019-01-02 10:23:02 -08:00
|
|
|
# only allow deletions here, check for absent items
|
2018-11-16 15:05:17 -08:00
|
|
|
db_socials = SocialMedia.query.filter_by(user_id=user.id).all()
|
2019-01-02 10:23:02 -08:00
|
|
|
new_socials = list(map(lambda s: s['service'], social_medias))
|
|
|
|
for social in db_socials:
|
|
|
|
if social.service not in new_socials:
|
|
|
|
db.session.delete(social)
|
2018-11-16 15:05:17 -08:00
|
|
|
|
|
|
|
db_avatar = Avatar.query.filter_by(user_id=user.id).first()
|
|
|
|
if db_avatar:
|
|
|
|
db.session.delete(db_avatar)
|
|
|
|
if avatar:
|
|
|
|
new_avatar = Avatar(image_url=avatar, user_id=user.id)
|
|
|
|
db.session.add(new_avatar)
|
2018-10-30 07:40:21 -07:00
|
|
|
|
2018-12-14 11:36:22 -08:00
|
|
|
old_avatar_url = db_avatar and db_avatar.image_url
|
|
|
|
if old_avatar_url and old_avatar_url != avatar:
|
|
|
|
remove_avatar(old_avatar_url, user.id)
|
2018-11-16 19:33:25 -08:00
|
|
|
|
2018-10-30 07:40:21 -07:00
|
|
|
db.session.commit()
|
2019-01-27 14:13:12 -08:00
|
|
|
result = self_user_schema.dump(user)
|
2018-10-30 07:40:21 -07:00
|
|
|
return result
|
2018-11-16 10:50:47 -08:00
|
|
|
|
2018-11-30 15:52:00 -08:00
|
|
|
|
2018-12-14 11:36:22 -08:00
|
|
|
@blueprint.route("/<user_id>/invites", methods=["GET"])
|
2019-02-21 14:23:46 -08:00
|
|
|
@auth.requires_same_user_auth
|
2018-12-14 11:36:22 -08:00
|
|
|
def get_user_invites(user_id):
|
2018-11-16 10:50:47 -08:00
|
|
|
invites = ProposalTeamInvite.get_pending_for_user(g.current_user)
|
|
|
|
return invites_with_proposal_schema.dump(invites)
|
|
|
|
|
2018-11-30 15:52:00 -08:00
|
|
|
|
2018-12-14 11:36:22 -08:00
|
|
|
@blueprint.route("/<user_id>/invites/<invite_id>/respond", methods=["PUT"])
|
2019-02-21 14:23:46 -08:00
|
|
|
@auth.requires_same_user_auth
|
2019-03-01 12:11:03 -08:00
|
|
|
@body({
|
|
|
|
"response": fields.Bool(required=True)
|
|
|
|
})
|
2018-12-14 11:36:22 -08:00
|
|
|
def respond_to_invite(user_id, invite_id, response):
|
2018-11-16 10:50:47 -08:00
|
|
|
invite = ProposalTeamInvite.query.filter_by(id=invite_id).first()
|
|
|
|
if not invite:
|
|
|
|
return {"message": "No invite found with id {}".format(invite_id)}, 404
|
2018-11-30 15:52:00 -08:00
|
|
|
|
2018-11-16 10:50:47 -08:00
|
|
|
invite.accepted = response
|
|
|
|
db.session.add(invite)
|
|
|
|
|
|
|
|
if invite.accepted:
|
|
|
|
invite.proposal.team.append(g.current_user)
|
|
|
|
db.session.add(invite)
|
2018-11-30 15:52:00 -08:00
|
|
|
|
2018-11-16 10:50:47 -08:00
|
|
|
db.session.commit()
|
2019-03-01 12:11:03 -08:00
|
|
|
return {"message": "ok"}, 200
|
2019-01-16 14:26:45 -08:00
|
|
|
|
|
|
|
|
|
|
|
@blueprint.route("/<user_id>/settings", methods=["GET"])
|
2019-02-21 14:23:46 -08:00
|
|
|
@auth.requires_same_user_auth
|
2019-01-16 14:26:45 -08:00
|
|
|
def get_user_settings(user_id):
|
|
|
|
return user_settings_schema.dump(g.current_user.settings)
|
|
|
|
|
|
|
|
|
|
|
|
@blueprint.route("/<user_id>/settings", methods=["PUT"])
|
2019-02-21 14:23:46 -08:00
|
|
|
@auth.requires_same_user_auth
|
2019-03-01 12:11:03 -08:00
|
|
|
@body({
|
2019-03-12 10:08:16 -07:00
|
|
|
"emailSubscriptions": fields.Dict(required=False, missing=None),
|
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
|
|
|
"refundAddress": fields.Str(required=False, missing=None),
|
2019-12-09 14:00:01 -08:00
|
|
|
"tipJarAddress": fields.Str(required=False, missing=None),
|
2019-11-13 15:44:35 -08:00
|
|
|
"tipJarViewKey": fields.Str(required=False, missing=None) # TODO: add viewkey validation here
|
2019-03-01 12:11:03 -08:00
|
|
|
})
|
2019-11-13 15:44:35 -08:00
|
|
|
def set_user_settings(user_id, email_subscriptions, refund_address, tip_jar_address, tip_jar_view_key):
|
2019-02-16 08:49:32 -08:00
|
|
|
if email_subscriptions:
|
|
|
|
try:
|
2019-01-16 14:26:45 -08:00
|
|
|
email_subscriptions = keys_to_snake_case(email_subscriptions)
|
|
|
|
g.current_user.settings.email_subscriptions = email_subscriptions
|
2019-02-16 08:49:32 -08:00
|
|
|
except ValidationException as e:
|
|
|
|
return {"message": str(e)}, 400
|
|
|
|
|
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
|
|
|
if refund_address is not None and refund_address != '' and not is_z_address_valid(refund_address):
|
|
|
|
return {"message": "Refund address is not a valid z address"}, 400
|
2019-03-13 16:36:24 -07:00
|
|
|
if refund_address == '' and g.current_user.settings.refund_address:
|
|
|
|
return {"message": "Refund address cannot be unset, only changed"}, 400
|
2019-02-16 08:49:32 -08:00
|
|
|
if refund_address:
|
|
|
|
g.current_user.settings.refund_address = refund_address
|
|
|
|
|
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
|
|
|
if tip_jar_address is not None and tip_jar_address is not '' and not is_z_address_valid(tip_jar_address):
|
|
|
|
return {"message": "Tip address is not a valid z address"}, 400
|
2019-11-13 15:44:35 -08:00
|
|
|
if tip_jar_address is not None:
|
|
|
|
g.current_user.settings.tip_jar_address = tip_jar_address
|
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
|
|
|
|
2019-11-13 15:44:35 -08:00
|
|
|
if tip_jar_view_key is not None:
|
|
|
|
g.current_user.settings.tip_jar_view_key = tip_jar_view_key
|
|
|
|
|
2019-01-16 14:26:45 -08:00
|
|
|
db.session.commit()
|
|
|
|
return user_settings_schema.dump(g.current_user.settings)
|
2019-02-09 18:58:40 -08:00
|
|
|
|
|
|
|
|
|
|
|
@blueprint.route("/<user_id>/arbiter/<proposal_id>", methods=["PUT"])
|
2019-02-21 14:23:46 -08:00
|
|
|
@auth.requires_same_user_auth
|
2019-03-01 12:11:03 -08:00
|
|
|
@body({
|
|
|
|
"isAccept": fields.Bool(required=False, missing=None)
|
|
|
|
})
|
2019-02-09 18:58:40 -08:00
|
|
|
def set_user_arbiter(user_id, proposal_id, is_accept):
|
|
|
|
try:
|
|
|
|
proposal = Proposal.query.filter_by(id=int(proposal_id)).first()
|
|
|
|
if not proposal:
|
|
|
|
return {"message": "No such proposal"}, 404
|
|
|
|
|
|
|
|
if is_accept:
|
|
|
|
proposal.arbiter.accept_nomination(g.current_user.id)
|
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
|
|
|
|
|
|
|
for user in proposal.team:
|
|
|
|
send_email(user.email_address, 'proposal_arbiter_assigned', {
|
|
|
|
'user': user,
|
|
|
|
'proposal': proposal,
|
|
|
|
'proposal_url': make_url(f'/proposals/{proposal.id}')
|
|
|
|
})
|
|
|
|
|
2019-02-09 18:58:40 -08:00
|
|
|
return {"message": "Accepted nomination"}, 200
|
|
|
|
else:
|
|
|
|
proposal.arbiter.reject_nomination(g.current_user.id)
|
|
|
|
return {"message": "Rejected nomination"}, 200
|
|
|
|
|
|
|
|
except ValidationException as e:
|
|
|
|
return {"message": str(e)}, 400
|