Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions src/dispatch/case/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ class Case(Base, TimeStampMixin, ProjectMixin):

ticket = relationship("Ticket", uselist=False, backref="case", cascade="all, delete-orphan")

# Foreign key to individual who resolved
resolved_by_id = Column(Integer, ForeignKey("individual_contact.id"))
resolved_by = relationship("IndividualContact", foreign_keys=[resolved_by_id])

# resources
case_costs = relationship(
"CaseCost",
Expand Down Expand Up @@ -325,6 +329,7 @@ class CaseBase(DispatchBase):
description: str | None = None
resolution: str | None = None
resolution_reason: CaseResolutionReason | None = None
resolved_by: IndividualContactRead | None = None
status: CaseStatus | None = None
visibility: Visibility | None = None

Expand Down
8 changes: 8 additions & 0 deletions src/dispatch/case/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,14 @@ def update(*, db_session, case: Case, case_in: CaseUpdate, current_user: Dispatc
case_id=case.id,
)

if case.status == CaseStatus.closed:
individual = individual_service.get_or_create(
db_session=db_session,
email=current_user.email,
project=case.project,
)
case.resolved_by = individual

if case.visibility != case_in.visibility:
case.visibility = case_in.visibility

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Add resolved_by to case table

Revision ID: 4649b11b683f
Revises: 408118048599
Create Date: 2025-08-01 14:11:04.276577

"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "4649b11b683f"
down_revision = "408118048599"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("case", sa.Column("resolved_by_id", sa.Integer(), nullable=True))
op.create_foreign_key(
"fk_case_resolved_by_id", "case", "individual_contact", ["resolved_by_id"], ["id"]
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint("fk_case_resolved_by_id", "case", type_="foreignkey")
op.drop_column("case", "resolved_by_id")
# ### end Alembic commands ###
24 changes: 14 additions & 10 deletions src/dispatch/plugins/dispatch_slack/case/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,22 @@ def create_case_message(case: Case, channel_id: str) -> list[Block]:
Section(
text=f"*Resolution description* \n {case.resolution}"[:MAX_SECTION_TEXT_LENGTH]
),
Actions(
elements=[
Button(
text="Re-open",
action_id=CaseNotificationActions.reopen,
style="primary",
value=button_metadata,
)
]
),
]
)
if case.resolved_by:
blocks.append(Section(text=f"*Resolved by* \n {case.resolved_by.individual.email}"))
blocks.append(
Actions(
elements=[
Button(
text="Re-open",
action_id=CaseNotificationActions.reopen,
style="primary",
value=button_metadata,
)
]
),
)
else:
action_buttons = [
Button(
Expand Down
21 changes: 21 additions & 0 deletions src/dispatch/static/dispatch/src/case/CaseAttributesDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,27 @@ const handleResolutionUpdate = (newResolution) => {
</v-col>
</v-row>

<v-row no-gutters align="center" class="pt-6">
<v-col cols="1">
<div class="dispatch-font">Resolved By</div>
</v-col>
<v-col cols="10">
<div class="pl-8 d-flex align-center ml-3">
<v-icon size="14px" class="mr-2">mdi-account-check</v-icon>
<span
style="
font-weight: 500;
color: rgb(60, 65, 73);
font-size: 0.8125rem;
margin-left: 2px;
"
>
{{ modelValue.resolved_by?.name || "Not specified" }}
</span>
</div>
</v-col>
</v-row>

<v-row no-gutters align="center" class="pt-6">
<v-col cols="1">
<div class="dispatch-font">Priority</div>
Expand Down
94 changes: 59 additions & 35 deletions src/dispatch/static/dispatch/src/case/DetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,42 +24,63 @@
/>
</v-col>
<v-col cols="12">
<v-select
v-model="resolution_reason"
label="Resolution Reason"
:items="$store.state.case_management.resolutionReasons"
hint="The general reason why a given case was resolved."
:menu-props="{ contentClass: 'resolution-menu' }"
>
<template #item="{ item, props }">
<v-list-item v-bind="props">
<template #title>
<div class="d-flex align-center justify-space-between">
{{ item.title }}
<v-tooltip location="right">
<template #activator="{ props: tooltipProps }">
<v-icon
v-bind="tooltipProps"
icon="mdi-information"
size="small"
class="ml-2"
/>
<v-card variant="outlined" class="pa-4 mt-n5">
<v-card-title class="text-h6 pa-0 mb-4">Resolution Details</v-card-title>
<v-row>
<v-col cols="12">
<div class="d-flex align-center">
<span class="text-body-2 text-medium-emphasis mr-2">Resolved By:</span>
<v-chip v-if="resolved_by" pill size="small">
<v-avatar color="teal" start>
<span class="text-white">{{ initials(resolved_by.name) }}</span>
</v-avatar>
{{ resolved_by.name }}
</v-chip>
<span v-else class="text-body-2 text-disabled">Not specified</span>
</div>
</v-col>
<v-col cols="12">
<v-select
v-model="resolution_reason"
label="Resolution Reason"
:items="$store.state.case_management.resolutionReasons"
hint="The general reason why a given case was resolved."
:menu-props="{ contentClass: 'resolution-menu' }"
>
<template #item="{ item, props }">
<v-list-item v-bind="props">
<template #title>
<div class="d-flex align-center justify-space-between">
{{ item.title }}
<v-tooltip location="right">
<template #activator="{ props: tooltipProps }">
<v-icon
v-bind="tooltipProps"
icon="mdi-information"
size="small"
class="ml-2"
/>
</template>
<span>{{
$store.state.case_management.resolutionTooltips[item.title]
}}</span>
</v-tooltip>
</div>
</template>
<span>{{ $store.state.case_management.resolutionTooltips[item.title] }}</span>
</v-tooltip>
</div>
</template>
</v-list-item>
</template>
</v-select>
</v-col>
<v-col cols="12">
<v-textarea
v-model="resolution"
label="Resolution"
hint="Description of the actions taken to resolve the case."
clearable
/>
</v-list-item>
</template>
</v-select>
</v-col>
<v-col cols="12">
<v-textarea
v-model="resolution"
label="Resolution"
hint="Description of the actions taken to resolve the case."
clearable
/>
</v-col>
</v-row>
</v-card>
</v-col>
<v-col cols="12">
<participant-select
Expand Down Expand Up @@ -195,6 +216,7 @@
<script>
import { required } from "@/util/form"
import { mapFields } from "vuex-map-fields"
import { initials } from "@/filters"

import CaseFilterCombobox from "@/case/CaseFilterCombobox.vue"
import CasePrioritySelect from "@/case/priority/CasePrioritySelect.vue"
Expand All @@ -210,6 +232,7 @@ export default {
setup() {
return {
rules: { required },
initials,
}
},
name: "CaseDetailsTab",
Expand Down Expand Up @@ -264,6 +287,7 @@ export default {
"selected.reported_at",
"selected.resolution_reason",
"selected.resolution",
"selected.resolved_by",
"selected.signals",
"selected.stable_at",
"selected.status",
Expand Down
Loading