Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/truncate-group-key
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 authored Dec 4, 2024
2 parents a6f9327 + 597e6f1 commit 6084092
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 26 deletions.
53 changes: 37 additions & 16 deletions src/dispatch/plugins/dispatch_slack/case/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -2511,28 +2511,49 @@ def ack_mfa_required_submission_event(
) -> None:
"""Handles the add engagement submission event acknowledgement."""

blocks = []

if mfa_enabled:
mfa_text = (
"🔐 To complete this action, you need to verify your identity through Multi-Factor Authentication (MFA).\n\n"
f"Please <{challenge_url}|*click here*> to open the MFA verification page."
blocks.extend(
[
Section(
text="To complete this action, you need to verify your identity through Multi-Factor Authentication (MFA).\n\n"
"Please click the verify button to open the MFA verification page."
),
Actions(
elements=[
Button(
text="🔐 Verify",
action_id="button-link",
style="primary",
url=challenge_url,
)
]
),
]
)
else:
mfa_text = "✅ No additional verification required. You can proceed with the confirmation."
blocks.append(
Section(
text="✅ No additional verification required. You can proceed with the confirmation."
)
)

blocks = [
Section(text=mfa_text),
Divider(),
Context(
elements=[
MarkdownText(
text="💡 This step protects against unauthorized confirmation if your account is compromised."
)
]
),
]
blocks.extend(
[
Divider(),
Context(
elements=[
MarkdownText(
text="💡 This step protects against unauthorized confirmation if your account is compromised."
)
]
),
]
)

modal = Modal(
title="Confirm Your Identity",
title="Verify Your Identity",
close="Cancel",
blocks=blocks,
).build()
Expand Down
7 changes: 6 additions & 1 deletion src/dispatch/static/dispatch/src/case/type/NewEditSheet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ import PluginMetadataInput from "@/plugin/PluginMetadataInput.vue"
import ServiceSelect from "@/service/ServiceSelect.vue"
import ProjectSelect from "@/project/ProjectSelect.vue"
import TemplateSelect from "@/document/template/TemplateSelect.vue"
import ProjectApi from "@/project/api"
export default {
setup() {
Expand Down Expand Up @@ -220,8 +221,12 @@ export default {
},
created() {
if (this.$route.query.project) {
// required for plugin metadata
this.project = { name: this.$route.query.project }
this.incidentProject = this.project
ProjectApi.getAll({ q: this.$route.query.project }).then((response) => {
this.incidentProject = response.data.items[0]
this.project = response.data.items[0]
})
}
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default {
if (this.project) {
filterOptions.filters = {
project: [this.project],
project_id: this.project_id,
enabled: ["true"],
}
}
Expand Down
16 changes: 16 additions & 0 deletions src/dispatch/static/dispatch/src/plugin/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,22 @@ function convertToFormkit(json_schema) {
help: value.description,
},
}
} else if (value.allOf) {
const ref = value.allOf[0].$ref
// will be something like "#/definitions/HostingType"
const ref_name = ref.split("/").pop()
const ref_obj = json_schema.definitions[ref_name]["enum"]
obj = {
$formkit: "select",
name: key,
label: value.title,
help: value.description,
options: ref_obj.map((item) => {
return { label: item, value: item }
}),
default: value.default,
validation: "required",
}
}
formkit_schema.push(obj)
}
Expand Down
4 changes: 2 additions & 2 deletions src/dispatch/static/dispatch/src/service/ServiceSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ export default {
}
if (this.project) {
filterOptions.filters.project_id = this.project.map((p) => p.id)
filterOptions.filters.project_id = this.project.id
}
if (this.healthMetrics) {
filterOptions.filters.health_metrics = ["true"]
}
filterOptions = SearchUtils.createParametersFromTableOptions({ ...filterOptions })
filterOptions = SearchUtils.createParametersFromTableOptions({ ...filterOptions }, "Service")
ServiceApi.getAll(filterOptions).then((response) => {
this.items = response.data.items
Expand Down
12 changes: 6 additions & 6 deletions src/dispatch/task/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ def create(*, db_session, task_in: TaskCreate) -> Task:
db_session=db_session, incident_id=incident.id, email=i.individual.email
)

assignee = incident_flows.incident_add_or_reactivate_participant_flow(
db_session=db_session,
incident_id=incident.id,
user_email=i.individual.email,
)

if not participant or not participant.active_roles:
# send emphemeral message to user about why they are being added to the incident
send_task_add_ephemeral_message(
Expand All @@ -88,12 +94,6 @@ def create(*, db_session, task_in: TaskCreate) -> Task:
task=task_in,
)

assignee = incident_flows.incident_add_or_reactivate_participant_flow(
db_session=db_session,
incident_id=incident.id,
user_email=i.individual.email,
)

# due to the freeform nature of task assignment, we can sometimes pick up other emails
# e.g. a google group that we cannot resolve to an individual assignee
if assignee:
Expand Down

0 comments on commit 6084092

Please sign in to comment.