Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

profile: show warning and option to reactivate when contact method is disabled #28

Merged
merged 89 commits into from
Jul 16, 2019
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
0928219
update gql schema
Forfold Jun 20, 2019
a6b5714
add verification form and dialog components
Forfold Jun 20, 2019
5fbcf49
adjust warning tooltip prop name
Forfold Jun 20, 2019
efcb0a4
call new verification dialog from relevant components
Forfold Jun 20, 2019
2f1bef4
delete old verification dialog/form
Forfold Jun 20, 2019
d24e414
add graphql2 mutations for verifying and testing contact method phone…
Forfold Jun 21, 2019
b1c8940
remove old graphql mutations
Forfold Jun 21, 2019
ed4a8e7
update verify and send mutations on ui to reference new code
Forfold Jun 21, 2019
eabaaef
use formcontainer and add field error checks to verification code field
Forfold Jun 24, 2019
c3f8245
use else
Forfold Jun 24, 2019
3ecc8c2
update verification smoketest
Forfold Jun 26, 2019
f0728ac
update other smoketests
Forfold Jun 26, 2019
64f04c0
Merge branch 'master' of https://github.com/target/goalert into conta…
Forfold Jun 28, 2019
a1dfb01
update schema from pr comments
Forfold Jun 28, 2019
10f81e3
move field error to graphql layer and remove references to the resend…
Forfold Jun 28, 2019
cb9e43f
rename verification form and dialog with User prefixed to match other…
Forfold Jun 28, 2019
5c03210
rename warning "tooltip" text prop to "message" and add a proptype fo…
Forfold Jun 28, 2019
f5ca02a
reword a CM's disabled warning message to be type agnostic
Forfold Jun 28, 2019
b182a4c
modify db statement to only reactivate that single contact method, an…
Forfold Jun 28, 2019
38117ae
create migration to update verification table
Forfold Jul 1, 2019
79d88f4
Merge branch 'master' of https://github.com/target/goalert into conta…
Forfold Jul 2, 2019
edfdc14
fix smoketests using incorrect variable name for the verification code
Forfold Jul 2, 2019
be181f4
give each action menu it's own state via a new component
Forfold Jul 2, 2019
165e977
set verification text field to type number
Forfold Jul 2, 2019
2ef865d
disable submit button until code has been sent at least once
Forfold Jul 2, 2019
fc4e163
delete dupe function and fix india phone number formatting
Forfold Jul 2, 2019
878d990
render subtitle properly in verification form
Forfold Jul 2, 2019
1b35170
add a caption for UNSTOP use cases
Forfold Jul 2, 2019
563b3f0
Merge branch 'master' of https://github.com/target/goalert into conta…
Forfold Jul 2, 2019
b337326
add apollo hooks library
Forfold Jul 8, 2019
e795760
add apollo hooks provider
Forfold Jul 8, 2019
5583efe
update FlatList avatar/icon padding
Forfold Jul 8, 2019
62546f2
add reactivate button directly to CM list item if disabled
Forfold Jul 8, 2019
1388552
send code immediately as dialog opens to reactivate
Forfold Jul 8, 2019
fff677c
only call the useEffect hook once, after render
Forfold Jul 8, 2019
21af60a
don't show reactivate button on enabled CMs
Forfold Jul 8, 2019
d92efd3
address no-op setState warning
Forfold Jul 8, 2019
cbe376c
fix deleting a contact method if a verification code is in flight
Forfold Jul 8, 2019
f636e06
fix for closing delete contact method dialog manually
Forfold Jul 8, 2019
2347c64
don't show UNSTOP message for voice calls
Forfold Jul 9, 2019
c120d95
add avatar and icon support to PaginatedList
Forfold Jul 9, 2019
9973aa2
remove tx from graphql funcs
Forfold Jul 9, 2019
b3c05fd
lock apollo hooks version in package.json
Forfold Jul 9, 2019
3a41e8c
remove sendAttempted and default the button to say "resend"
Forfold Jul 9, 2019
d15ca54
send verification code from form
Forfold Jul 9, 2019
3820a61
pr comment: remove references to using an avatar
Forfold Jul 10, 2019
8d65afb
pr comment: adjust FlatList action prop names
Forfold Jul 10, 2019
ea1a1f1
remove unused state vars
Forfold Jul 10, 2019
44cfbfa
remove submitDisabled from FormDialog
Forfold Jul 10, 2019
865f06b
fix spacing
Forfold Jul 10, 2019
c3163fa
better error message
Forfold Jul 10, 2019
ed4035f
Show disabled attributes on unowned profiles
Forfold Jul 11, 2019
2add043
Merge branch 'master' of https://github.com/target/goalert into conta…
Forfold Jul 11, 2019
8527daa
remove unused proptype
Forfold Jul 11, 2019
964cd63
pr comment: remove tertiary action
Forfold Jul 12, 2019
2dcb903
pr comment: move open verify dialog logic
Forfold Jul 12, 2019
5a4b217
use @apollo/react-hooks instead of react-apollo-hooks
Forfold Jul 12, 2019
e6a2594
refactor contact method list to use hooks
Forfold Jul 12, 2019
de595cf
use hook mutation for sending the verification code on button
Forfold Jul 12, 2019
33963cc
add no type submit option to loading button
Forfold Jul 12, 2019
3dfe17e
use hook mutation to submit verification form
Forfold Jul 12, 2019
2b2e5be
update too many messages error message
Forfold Jul 12, 2019
f1bde04
fix phone number formatting in test
Forfold Jul 15, 2019
5c3cc9f
don't show spacing if no icon specified on paginated lists
Forfold Jul 15, 2019
fe6a5d6
fix avatar
Forfold Jul 15, 2019
c2d673a
fix code types on smoketests
Forfold Jul 15, 2019
231375e
spacing
Forfold Jul 15, 2019
0c36e24
remove code expiration function
Forfold Jul 15, 2019
f21f2d5
don't recalculate when verification code expires
Forfold Jul 15, 2019
35c60b2
update stmt call to use stmtContext function
Forfold Jul 15, 2019
b18d7aa
remove duplicate permissions check
Forfold Jul 15, 2019
cfecfb5
adjust func definition
Forfold Jul 15, 2019
b599601
remove redundant console.error
Forfold Jul 15, 2019
2b12871
cleanup getIcon func
Forfold Jul 15, 2019
1a9a38a
consolidate duplicate lines into function
Forfold Jul 15, 2019
e840a92
fix status reference when sending a verification code
Forfold Jul 15, 2019
76bb0be
rename migration such that it's the most recent one
Forfold Jul 15, 2019
7f65594
only use international formats for all supported phone numbers
Forfold Jul 15, 2019
5f7485e
refactor how a test message is sent
Forfold Jul 15, 2019
f240633
re-add user id lookup
Forfold Jul 16, 2019
1a14704
sending a test should fail if the CM is disabled
Forfold Jul 16, 2019
1c29df5
update enable voice sms test
Forfold Jul 16, 2019
4dcc067
update enable by sms test
Forfold Jul 16, 2019
47be33c
update sms verification smoketest
Forfold Jul 16, 2019
4312f80
update voice verification smoketest
Forfold Jul 16, 2019
d487b76
update variable names for better readabilitiy
Forfold Jul 16, 2019
8741e8e
Merge branch 'master' into contact-method-warning-disabled
Forfold Jul 16, 2019
5492324
gofmt
Forfold Jul 16, 2019
e6db578
clear send error when attempting to verify
Forfold Jul 16, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions engine/verifymanager/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func (db *DB) Name() string { return "Engine.VerificationManager" }
func NewDB(ctx context.Context, db *sql.DB) (*DB, error) {
lock, err := processinglock.NewLock(ctx, db, processinglock.Config{
Type: processinglock.TypeVerify,
Version: 1,
Version: 2,
})
if err != nil {
return nil, err
Expand All @@ -34,15 +34,16 @@ func NewDB(ctx context.Context, db *sql.DB) (*DB, error) {
insertMessages: p.P(`
with rows as (
insert into outgoing_messages (message_type, contact_method_id, user_id, user_verification_code_id)
select 'verification_message', send_to, user_id, code.id
select 'verification_message', contact_method_id, cm.user_id, code.id
from user_verification_codes code
where send_to notnull and now() < expires_at
join user_contact_methods cm on cm.id = contact_method_id
where not sent and now() < expires_at
limit 100
for update skip locked
returning user_verification_code_id id
)
update user_verification_codes code
set send_to = null
set sent = true
from rows
where code.id = rows.id
`),
Expand Down
74 changes: 0 additions & 74 deletions graphql/contactmethod.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,77 +170,3 @@ func (h *Handler) sendContactMethodTest() *g.Field {
},
}
}

func (h *Handler) sendContactMethodVerification() *g.Field {
return &g.Field{
Type: g.NewObject(g.ObjectConfig{
Name: "SendContactMethodVerification",
Fields: g.Fields{"id": &g.Field{Type: g.String}},
}),
Args: g.FieldConfigArgument{
"input": &g.ArgumentConfig{
Type: g.NewInputObject(g.InputObjectConfig{
Name: "SendContactMethodVerificationInput",
Fields: g.InputObjectConfigFieldMap{
"contact_method_id": &g.InputObjectFieldConfig{Type: g.NewNonNull(g.String)},
"resend": &g.InputObjectFieldConfig{Type: g.Boolean},
},
}),
},
},
Resolve: func(p g.ResolveParams) (interface{}, error) {
m, ok := p.Args["input"].(map[string]interface{})
if !ok {
return nil, errors.New("invalid input type")
}

resend, _ := m["resend"].(bool)
var result struct {
CMID string `json:"id"`
}
result.CMID, _ = m["contact_method_id"].(string)

err := h.c.NotificationStore.SendContactMethodVerification(p.Context, result.CMID, resend)
return newScrubber(p.Context).scrub(result, err)
},
}
}

func (h *Handler) verifyContactMethod() *g.Field {
return &g.Field{
Type: g.NewObject(g.ObjectConfig{
Name: "VerifyContactMethodOutput",
Fields: g.Fields{
"contact_method_ids": &g.Field{Type: g.NewList(g.String), Description: "IDs of contact methods that have been enabled by this operation."}},
}),
Args: g.FieldConfigArgument{
"input": &g.ArgumentConfig{
Type: g.NewInputObject(g.InputObjectConfig{
Name: "VerifyContactMethodInput",
Fields: g.InputObjectConfigFieldMap{
"verification_code": &g.InputObjectFieldConfig{Type: g.NewNonNull(g.Int)},
"contact_method_id": &g.InputObjectFieldConfig{Type: g.NewNonNull(g.String)},
},
}),
},
},
Resolve: func(p g.ResolveParams) (interface{}, error) {
m, ok := p.Args["input"].(map[string]interface{})
if !ok {
return nil, errors.New("invalid input type")
}

id, _ := m["contact_method_id"].(string)
var code int
code, _ = m["verification_code"].(int)

changed, err := h.c.NotificationStore.VerifyContactMethod(p.Context, id, code)
var result struct {
IDs []string `json:"contact_method_ids"`
}
result.IDs = changed
return newScrubber(p.Context).scrub(result, err)

},
}
}
2 changes: 0 additions & 2 deletions graphql/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ func (h *Handler) buildSchema() error {
"createAll": h.createAllField(),
"updateConfigLimit": h.updateConfigLimitField(),
"sendContactMethodTest": h.sendContactMethodTest(),
"sendContactMethodVerification": h.sendContactMethodVerification(),
"verifyContactMethod": h.verifyContactMethod(),
"deleteHeartbeatMonitor": h.deleteHeartbeatMonitorField(),
"updateUserOverride": h.updateUserOverrideField(),
"deleteAll": h.deleteAllField(),
Expand Down
Loading