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

[EASI-4614] Async GRB Discussions #2874

Draft
wants to merge 34 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a735764
Empty commit to start feature branch
ClayBenson94 Nov 4, 2024
5279f64
Merge branch 'main' into feature/EASI-4614_grb_discussions
samoddball Nov 7, 2024
0507a9f
Merge branch 'main' into feature/EASI-4614_grb_discussions
samoddball Nov 12, 2024
63491a1
Add new discussions i18n file (#2886)
downeyn-cms Nov 13, 2024
83d4891
Merge branch 'main' into feature/EASI-4614_grb_discussions
samoddball Nov 14, 2024
92c3f05
[NOREF] Discussions translation fixes (#2888)
aterstriep Nov 14, 2024
dcd703e
[EASI-4635] Initial discussions API schema and migration (#2887)
mynar7 Nov 15, 2024
a33d63a
EASI-4634 MentionTextArea Tiptap (#2882)
adamodd Nov 18, 2024
50aee92
Merge branch 'main' into feature/EASI-4614_grb_discussions
ClayBenson94 Nov 19, 2024
25c596e
Merge branch 'main' into feature/EASI-4614_grb_discussions
samoddball Nov 19, 2024
5d4ca36
[EASI-4636] GRB discussions card (#2889)
aterstriep Nov 19, 2024
b44edab
Merge branch 'main' into feature/EASI-4614_grb_discussions
samoddball Nov 20, 2024
95efd7c
[EASI-4635] Discussions store methods and resolvers (#2896)
mynar7 Nov 21, 2024
820a81d
[EASI-4639] Discussions panel views (#2895)
aterstriep Nov 22, 2024
605e674
Easi 4633/editor html (#2892)
samoddball Nov 25, 2024
316650f
disallow numbered /bullet lists (#2900)
samoddball Nov 25, 2024
1c9d8be
Merge branch 'main' into feature/EASI-4614_grb_discussions
samoddball Nov 25, 2024
cd16886
Merge branch 'main' into feature/EASI-4614_grb_discussions
samoddball Nov 26, 2024
b5c9655
Merge branch 'main' into feature/EASI-4614_grb_discussions
ClayBenson94 Nov 26, 2024
7c58868
Fix GRB Discussions SQL files with new SQLFluff linter
ClayBenson94 Nov 26, 2024
4b99bca
[EASI-4614] Initial email work for GRB Discussions (#2875)
downeyn-cms Nov 26, 2024
5b9db15
Merge branch 'main' into feature/EASI-4614_grb_discussions
samoddball Nov 27, 2024
b1d16ac
Easi 4614/follow up items (#2906)
samoddball Dec 2, 2024
969297f
EASI-4667 Side Panel Routing / State management (#2901)
adamodd Dec 3, 2024
03f4fcc
[EASI-4639] Discussion views cleanup (#2907)
aterstriep Dec 4, 2024
589b70c
Merge branch 'main' into feature/EASI-4614_grb_discussions
samoddball Dec 4, 2024
6b1363c
[EASI-4635] Discussions API tests (#2908)
mynar7 Dec 6, 2024
4ca90c0
Merge branch 'main' into feature/EASI-4614_grb_discussions
ClayBenson94 Dec 9, 2024
de03329
Merge branch 'main' into feature/EASI-4614_grb_discussions
samoddball Dec 10, 2024
9a50dd9
Easi 4645/send emails (#2910)
samoddball Dec 10, 2024
ce5a0be
[EASI-4658] Integrate discussions tagging (#2917)
aterstriep Dec 11, 2024
d76cff8
Merge branch 'main' into feature/EASI-4614_grb_discussions
ClayBenson94 Dec 12, 2024
961ae4b
Merge branch 'main' into feature/EASI-4614_grb_discussions
samoddball Dec 12, 2024
6304b7c
Merge branch 'main' into feature/EASI-4614_grb_discussions
samoddball Dec 12, 2024
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
226 changes: 219 additions & 7 deletions EASI.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@
"listen": "test",
"script": {
"exec": [
"pm.collectionVariables.set(\"SystemIntakeGRBReviewerID\", pm.response.json().data.createSystemIntakeGRBReviewer.id)"
"pm.collectionVariables.set(\"SystemIntakeGRBReviewerID\", pm.response.json().data.createSystemIntakeGRBReviewers.reviewers[0].id)"
],
"type": "text/javascript",
"packages": {}
Expand All @@ -1013,8 +1013,8 @@
"body": {
"mode": "graphql",
"graphql": {
"query": "mutation createS($input: CreateSystemIntakeGRBReviewerInput!) {\n createSystemIntakeGRBReviewer(input: $input) {\n id\n userAccount {\n id\n }\n grbRole\n votingRole\n systemIntakeID\n createdBy\n createdAt\n modifiedBy\n modifiedAt\n }\n}",
"variables": "{\r\n \"input\": {\r\n \"euaUserId\": \"ABCD\",\r\n \"systemIntakeID\": \"8edb237e-ad48-49b2-91cf-8534362bc6cf\",\r\n \"votingRole\": \"NON_VOTING\",\r\n \"grbRole\": \"CMCS_REP\"\r\n }\r\n}"
"query": "mutation createSystemIntakeGRBReviewer($input: CreateSystemIntakeGRBReviewersInput!) {\n createSystemIntakeGRBReviewers(input: $input) {\n reviewers {\n id\n userAccount {\n id\n }\n grbRole\n votingRole\n systemIntakeID\n createdBy\n createdAt\n modifiedBy\n modifiedAt\n }\n \n }\n}",
"variables": "{\r\n \"input\": {\r\n \"systemIntakeID\": \"8edb237e-ad48-49b2-91cf-8534362bc6cf\",\r\n \"reviewers\": {\r\n \"euaUserId\": \"ABCD\",\r\n \"votingRole\": \"NON_VOTING\",\r\n \"grbRole\": \"CMCS_REP\"\r\n }\r\n }\r\n}"
}
},
"url": {
Expand Down Expand Up @@ -1124,6 +1124,171 @@
}
},
"response": []
},
{
"name": "Get GRB Discussions",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "graphql",
"graphql": {
"query": "query getSystemIntakeGRBReviewers($systemIntakeID: UUID!) {\n systemIntake(id: $systemIntakeID) {\n id\n grbDiscussions {\n initialPost {\n id\n content\n votingRole\n grbRole\n systemIntakeID\n createdAt\n createdByUserAccount {\n givenName\n familyName\n }\n modifiedAt\n modifiedByUserAccount {\n givenName\n familyName\n }\n }\n replies {\n id\n content\n votingRole\n grbRole\n systemIntakeID\n createdAt\n createdByUserAccount {\n givenName\n familyName\n }\n modifiedAt\n modifiedByUserAccount {\n givenName\n familyName\n }\n }\n }\n }\n}",
"variables": "{\r\n \"systemIntakeID\": \"{{systemIntakeID}}\"\r\n}"
}
},
"url": {
"raw": "{{url}}",
"host": [
"{{url}}"
]
}
},
"response": []
},
{
"name": "Create GRB Discussion",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.collectionVariables.set(\"SystemIntakeGRBDiscussionID\", pm.response.json().data.createSystemIntakeGRBDiscussionPost.id)"
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "graphql",
"graphql": {
"query": "mutation createSystemIntakeGRBDiscussion(\n $input: createSystemIntakeGRBDiscussionPostInput!\n) {\n createSystemIntakeGRBDiscussionPost(input: $input) {\n id\n content\n grbRole\n votingRole\n systemIntakeID\n createdByUserAccount {\n id\n username\n }\n }\n}\n",
"variables": "{\r\n \"input\": {\r\n \"systemIntakeID\": \"{{systemIntakeID}}\",\r\n \"content\": \"<p>banana apple carburetor Let me look into it, ok? <span data-type=\\\"mention\\\" tag-type=\\\"USER_ACCOUNT\\\" class=\\\"mention\\\" data-id-db=\\\"{{UserAccountID}}\\\">@Mckayla Fritsch</span>!</p>\"\r\n }\r\n}"
}
},
"url": {
"raw": "{{url}}",
"host": [
"{{url}}"
]
}
},
"response": []
},
{
"name": "Create GRB Discussion Group Tags",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.collectionVariables.set(\"SystemIntakeGRBDiscussionID\", pm.response.json().data.createSystemIntakeGRBDiscussionPost.id)"
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "graphql",
"graphql": {
"query": "mutation createSystemIntakeGRBDiscussion(\n $input: createSystemIntakeGRBDiscussionPostInput!\n) {\n createSystemIntakeGRBDiscussionPost(input: $input) {\n id\n content\n grbRole\n votingRole\n systemIntakeID\n createdByUserAccount {\n id\n username\n }\n }\n}\n",
"variables": "{\r\n \"input\": {\r\n \"systemIntakeID\": \"{{systemIntakeID}}\",\r\n \"content\": \"<p>banana apple carburetor Let me look into it, ok? <span data-type=\\\"mention\\\" tag-type=\\\"GROUP_IT_GOV\\\" class=\\\"mention\\\">@Group</span> middle <span data-type=\\\"mention\\\" tag-type=\\\"GROUP_GRB_REVIEWERS\\\" class=\\\"mention\\\">@Group2</span>!\\\"</p>\"\r\n }\r\n}"
}
},
"url": {
"raw": "{{url}}",
"host": [
"{{url}}"
]
}
},
"response": []
},
{
"name": "Add GRB Discussion Reply",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "graphql",
"graphql": {
"query": "mutation createSystemIntakeGRBDiscussionReply($input: createSystemIntakeGRBDiscussionReplyInput!) {\n createSystemIntakeGRBDiscussionReply(input: $input) {\n id\n content\n grbRole\n votingRole\n systemIntakeID\n createdByUserAccount {\n id\n username\n }\n }\n}",
"variables": "{\r\n \"input\": {\r\n \"initialPostID\": \"{{SystemIntakeGRBDiscussionID}}\",\r\n \"content\": \"<p>monkey kiwi maduros senor <span data-type=\\\"mention\\\" tag-type=\\\"USER_ACCOUNT\\\" class=\\\"mention\\\" data-id-db=\\\"{{UserAccountID}}\\\">@Mckayla Fritsch</span>!</p>\"\r\n }\r\n}"
}
},
"url": {
"raw": "{{url}}",
"host": [
"{{url}}"
]
}
},
"response": []
},
{
"name": "Add GRB Discussion Reply Group Tags",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "graphql",
"graphql": {
"query": "mutation createSystemIntakeGRBDiscussionReply($input: createSystemIntakeGRBDiscussionReplyInput!) {\n createSystemIntakeGRBDiscussionReply(input: $input) {\n id\n content\n grbRole\n votingRole\n systemIntakeID\n createdByUserAccount {\n id\n username\n }\n }\n}",
"variables": "{\r\n \"input\": {\r\n \"initialPostID\": \"{{SystemIntakeGRBDiscussionID}}\",\r\n \"content\": \"<p>Let me look into it, ok? <span data-type=\\\"mention\\\" tag-type=\\\"GROUP_IT_GOV\\\" class=\\\"mention\\\">@Group</span><span data-type=\\\"mention\\\" tag-type=\\\"GROUP_GRB_REVIEWERS\\\" class=\\\"mention\\\">@Group2</span>!</p>\"\r\n }\r\n}"
}
},
"url": {
"raw": "{{url}}",
"host": [
"{{url}}"
]
}
},
"response": []
}
]
},
Expand Down Expand Up @@ -1411,6 +1576,39 @@
},
"response": []
},
{
"name": "SystemIntake Get All w/ Discussions",
"event": [
{
"listen": "test",
"script": {
"exec": [
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "graphql",
"graphql": {
"query": "query systemIntake {\n systemIntakes(openRequests: true) {\n id\n requestName\n grbDiscussions {\n initialPost {\n id\n content\n }\n replies {\n id\n content\n }\n }\n }\n}",
"variables": ""
}
},
"url": {
"raw": "{{url}}",
"host": [
"{{url}}"
]
}
},
"response": []
},
{
"name": "SystemIntake Get (Workflow state/statuses)",
"event": [
Expand Down Expand Up @@ -3824,9 +4022,10 @@
"listen": "test",
"script": {
"exec": [
""
"pm.collectionVariables.set(\"UserAccountID\", pm.response.json().data.userAccount.id)"
],
"type": "text/javascript"
"type": "text/javascript",
"packages": {}
}
}
],
Expand All @@ -3836,8 +4035,8 @@
"body": {
"mode": "graphql",
"graphql": {
"query": "query {\n userAccount(username: \"EASI_SYSTEM\") {\n id\n username\n commonName\n familyName\n givenName\n email\n locale\n }\n}",
"variables": ""
"query": "query($username: String!) {\n userAccount(username: $username) {\n id\n username\n commonName\n familyName\n givenName\n email\n locale\n }\n}",
"variables": "{\r\n \"username\": \"USR1\"\r\n}"
}
},
"url": {
Expand Down Expand Up @@ -4073,6 +4272,19 @@
{
"key": "CedarAtoIds",
"value": ""
},
{
"key": "SystemIntakeGRBReviewerID",
"value": ""
},
{
"key": "SystemIntakeGRBDiscussionID",
"value": "",
"type": "string"
},
{
"key": "UserAccountID",
"value": ""
}
]
}
83 changes: 79 additions & 4 deletions cmd/devdata/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import (

"github.com/cms-enterprise/easi-app/cmd/devdata/mock"
"github.com/cms-enterprise/easi-app/pkg/appconfig"
"github.com/cms-enterprise/easi-app/pkg/appcontext"
"github.com/cms-enterprise/easi-app/pkg/dataloaders"
"github.com/cms-enterprise/easi-app/pkg/local"
"github.com/cms-enterprise/easi-app/pkg/models"
"github.com/cms-enterprise/easi-app/pkg/storage"
Expand Down Expand Up @@ -80,10 +82,30 @@ func main() {

s3Client := upload.NewS3Client(s3Cfg)

ctx := context.Background()
// nonUserCtx represents a context that has dataloaders, a logger, and other dependencies EXCEPT a principal
// This allows us to use this context as a base to create other contexts with different users without having to re-create all those dependencies each time.
nonUserCtx := context.Background()
nonUserCtx = mock.CtxWithNewDataloaders(nonUserCtx, store)
nonUserCtx = appcontext.WithLogger(nonUserCtx, logger)
nonUserCtx = appcontext.WithUserAccountService(nonUserCtx, dataloaders.GetUserAccountByID)

// userCtx is a local helper function (so we can not have to pass local variables all the time) that adds a principal
// to a context object and returns it.
// Useful for making calls as different types of users within the dev data
userCtx := func(username string, itGovAdmin bool, trbAdmin bool) context.Context {
return mock.CtxWithPrincipal(nonUserCtx, store, username, itGovAdmin, trbAdmin)
}
// userCtxNonAdmin wraps userCtx to allow creating a regular user context (no admin permissions)
userCtxNonAdmin := func(username string) context.Context {
return userCtx(username, false, false)
}
// userCtxITGovAdmin wraps userCtx to allow creating a context with IT Gov Admin permissions
userCtxITGovAdmin := func(username string) context.Context {
return userCtx(username, true, false)
}

ctx = mock.CtxWithNewDataloaders(ctx, store)
ctx = mock.CtxWithLoggerAndPrincipal(ctx, logger, store, mock.PrincipalUser)
// Create a context that most of the dev data can use
ctx := userCtx(mock.PrincipalUser, true, false)

localOktaClient := local.NewOktaAPIClient()

Expand Down Expand Up @@ -284,7 +306,7 @@ func main() {
intakeID = uuid.MustParse("61efa6eb-1976-4431-a158-d89cc00ce31d")
intake = makeSystemIntakeAndProgressToStep(
ctx,
"System Intake with some different GRB Reviewers",
"System Intake with some different GRB Reviewers (and discussions)",
&intakeID,
mock.PrincipalUser,
store,
Expand Down Expand Up @@ -328,6 +350,59 @@ func main() {
},
)

// Forgive my incredibly uncreative seed data...
// TODO, remove <b> when they're not supported when we add tagging. Just using it now to show this is HTML

// Initial Post
postA := createSystemIntakeGRBDiscussionPost(ctx, store, intake, models.TaggedHTML{
RawContent: "Post <b>A</b> (Replies)",
Tags: nil,
})

// First reply is from an Admin -- default context user USR1 is an Admin
createSystemIntakeGRBDiscussionReply(userCtxITGovAdmin("ADMN"), store, postA.ID, models.TaggedHTML{
RawContent: "Reply <b>A1</b>",
Tags: nil,
})

// Then, create a reply from most of the GRB reviewers so we get replies from different non-admin GRB & Voting roles
createSystemIntakeGRBDiscussionReply(ctx, store, postA.ID, models.TaggedHTML{
RawContent: "Reply <b>A2</b>",
Tags: nil,
})
createSystemIntakeGRBDiscussionReply(userCtxNonAdmin("USR2"), store, postA.ID, models.TaggedHTML{
RawContent: "Reply <b>A2</b>",
Tags: nil,
})
createSystemIntakeGRBDiscussionReply(userCtxNonAdmin("USR3"), store, postA.ID, models.TaggedHTML{
RawContent: "Reply <b>A3</b>",
Tags: nil,
})
createSystemIntakeGRBDiscussionReply(userCtxNonAdmin("USR4"), store, postA.ID, models.TaggedHTML{
RawContent: "Reply <b>A4</b>",
Tags: nil,
})

// Make one more thread with some replies
postB := createSystemIntakeGRBDiscussionPost(ctx, store, intake, models.TaggedHTML{
RawContent: "Post <b>B</b>",
Tags: nil,
})
createSystemIntakeGRBDiscussionReply(userCtxNonAdmin("USR3"), store, postB.ID, models.TaggedHTML{
RawContent: "Reply <b>B1</b>",
Tags: nil,
})
createSystemIntakeGRBDiscussionReply(userCtxNonAdmin("USR4"), store, postB.ID, models.TaggedHTML{
RawContent: "Reply <b>B2</b>",
Tags: nil,
})

// Lastly, create a new initial post with no replies
createSystemIntakeGRBDiscussionPost(ctx, store, intake, models.TaggedHTML{
RawContent: "Post <b>C</b> (No replies)",
Tags: nil,
})

intakeID = uuid.MustParse("d80cf287-35cb-4e76-b8b3-0467eabd75b8")
makeSystemIntakeAndProgressToStep(
ctx,
Expand Down
Loading
Loading