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

jefftmarks/APPEALS-24999 #19154

Closed
wants to merge 128 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
76063b5
APPEALS-24996 Create new file for modal component
msteele96 Jul 17, 2023
89e2334
APPEALS-24996 Create EfolderUrlField component and add to HPR version…
msteele96 Jul 20, 2023
3b549d4
APPEALS-24996 Delete incorrectly created component
msteele96 Jul 20, 2023
4462f88
APPEALS-24996 Added error messaging, updated validation, disabled sub…
msteele96 Jul 21, 2023
d73d045
jefftmarks/APPEALS-24994-24995 (#19018)
jefftmarks Jul 25, 2023
e658492
Merge branch 'feature/APPEALS-21339' into msteele/APPEALS-24996
msteele96 Jul 25, 2023
e02cc8b
APPEALS-24996 Basic Jest tests and setup
msteele96 Jul 25, 2023
6a7f753
APPEALS-24996 update name of efolderurlfield
msteele96 Jul 25, 2023
493ba81
APPEALS-24996 import initialState for code climate issue
msteele96 Jul 25, 2023
8ccfbe6
APPEALS-24997 created CompleteHearingPostponementRequestModal file
jefftmarks Jul 26, 2023
cc93ae1
APPEALS-24997 Created modal and completed base level granted/denied r…
jefftmarks Jul 26, 2023
a6896e7
APPEALS-24997 Completed alert functionality and toyed with styling...
jefftmarks Jul 26, 2023
ef3ae72
APPEALS-24997 completed date selector
jefftmarks Jul 26, 2023
ccd944e
APPEALS-24997 Created schedule option radio
jefftmarks Jul 26, 2023
0d5c82f
APPEALS-24997 adjusted margins
jefftmarks Jul 26, 2023
9d78fe0
APPEALS-24996 Update styling and formatting of instructions
msteele96 Jul 26, 2023
c1e11e3
APPEALS-24996 Adjusted font size of bold text
msteele96 Jul 26, 2023
a387744
APPEALS-24996 Code review suggested changes
msteele96 Jul 27, 2023
b09f416
APPEALS-24996 Removed unused imports, adjusted label text in expect s…
msteele96 Jul 27, 2023
082bdf3
APPEALS-24997 fixed scheduledFor controlled input
jefftmarks Jul 27, 2023
8dc91fb
APPEALS-24997 Added date validation to prevent form submission
jefftmarks Jul 27, 2023
968a1a2
APPEALS-24997 improved validation to include incorrect dates
jefftmarks Jul 30, 2023
bcb5e80
APPEALS-24997 refactored useEffect on DateSelector
jefftmarks Jul 30, 2023
a332659
APPEALS-24997 refactored constants
jefftmarks Jul 31, 2023
dd562b7
APPEALS-24997 implemented useState to reduce date validation firing
jefftmarks Jul 31, 2023
394fccb
APPEALS-24997 played with styling
jefftmarks Jul 31, 2023
4d87f8d
APPEALS-24997 refactored copy
jefftmarks Jul 31, 2023
6a8676f
APPEALS-25001 Removed constraint on AMA only
msteele96 Aug 1, 2023
6e85fa2
APPEALS-25001 Reduced options for legacy appeals to only allow for ne…
msteele96 Aug 1, 2023
e9e3a89
Merge branch 'master' into feature/APPEALS-21339
ThorntonMatthew Aug 1, 2023
93cca5f
Merge branch 'feature/APPEALS-21339' of https://github.com/department…
jefftmarks Aug 1, 2023
b11efc9
Merge branch 'feature/APPEALS-21339' into msteele/APPEALS-24996
msteele96 Aug 1, 2023
793b446
Merge branch 'feature/APPEALS-21339' into msteele/APPEALS-25001
msteele96 Aug 1, 2023
ad116d5
APPEALS-25000 added feature test for hearing postponement request for…
minhazur9 Aug 1, 2023
7892f2e
Merge branch 'feature/APPEALS-21339' into min/APPEALS-25000
minhazur9 Aug 1, 2023
a3b2a15
APPEALS-24997 testing date selector
jefftmarks Aug 1, 2023
fff5e0c
APPEALS-25000 added feature test for assigning to team
minhazur9 Aug 1, 2023
caedc51
Merge branch 'master' into feature/APPEALS-21339
ThorntonMatthew Aug 2, 2023
c7b63a4
Merge branch 'feature/APPEALS-21339' of https://github.com/department…
jefftmarks Aug 2, 2023
adec792
Created test for date selector
jefftmarks Aug 2, 2023
95b0501
APPEALS-25001 Added comment to legacy mail tasks constant
msteele96 Aug 2, 2023
c2bb3c6
APPEALS-25001 Uncomment line in tasks_for_appeal
msteele96 Aug 2, 2023
265b5aa
APPEALS-24997 Updated modal utils and completed jest tests
jefftmarks Aug 2, 2023
26ebcf2
APPEALS-25000 added in more feature tests
minhazur9 Aug 2, 2023
aaa3af7
Merge branch 'feature/APPEALS-21339' into min/APPEALS-25000
minhazur9 Aug 2, 2023
73c5967
Merge branch 'feature/APPEALS-21339' into msteele/APPEALS-24996
msteele96 Aug 2, 2023
bcddb8c
Merge branch 'feature/APPEALS-21339' into msteele/APPEALS-25001
msteele96 Aug 2, 2023
268135c
APPEALS-24996 Updated color to use existing variable name
msteele96 Aug 2, 2023
699fd14
APPEALS-24997 refactored tests to fix code climate duplicate code
jefftmarks Aug 2, 2023
ee758e3
APPEALS-25000 adjusted time check in feature tests
minhazur9 Aug 2, 2023
c6a62c5
Merge branch 'master' into feature/APPEALS-21339
ThorntonMatthew Aug 2, 2023
77d89f4
Merge branch 'feature/APPEALS-21339' into msteele/APPEALS-24996
msteele96 Aug 2, 2023
ffe69ec
Merge branch 'feature/APPEALS-21339' into msteele/APPEALS-25001
msteele96 Aug 2, 2023
c210ad5
Merge branch 'feature/APPEALS-21339' into min/APPEALS-25000
minhazur9 Aug 2, 2023
837c0e1
Merge branch 'feature/APPEALS-21339' of https://github.com/department…
jefftmarks Aug 2, 2023
b926d32
APPEALS-24997 uncommented out jestSetup line
jefftmarks Aug 2, 2023
8f2cacb
APPEALS-25001 Update all relevant rspec
msteele96 Aug 3, 2023
3eaac19
APPEALS-24997 refactored all 'Provide instructions and context for th…
jefftmarks Aug 3, 2023
b74bd1e
Merge pull request #19012 from department-of-veterans-affairs/msteele…
ThorntonMatthew Aug 3, 2023
afa6777
Merge branch 'feature/APPEALS-21339' into msteele/APPEALS-25001
msteele96 Aug 3, 2023
4b85c8b
refactored all 'Provide context and instructions' copy across caseflo…
jefftmarks Aug 3, 2023
3e2a91e
Merge branch 'master' into feature/APPEALS-21339
ThorntonMatthew Aug 3, 2023
69c3fb8
Merge branch 'feature/APPEALS-21339' into msteele/APPEALS-25001
msteele96 Aug 3, 2023
bc39b17
APPEALS-25000 changed enabled submit colors and restricted task from …
minhazur9 Aug 3, 2023
254651c
Merge branch 'min/APPEALS-25000' of github.com:department-of-veterans…
minhazur9 Aug 3, 2023
bc94e84
Merge branch 'feature/APPEALS-21339' into min/APPEALS-25000
minhazur9 Aug 3, 2023
c479915
APPEALS-25000 changed submit button colors when enabled
minhazur9 Aug 3, 2023
220c832
Merge branch 'min/APPEALS-25000' of github.com:department-of-veterans…
minhazur9 Aug 3, 2023
ede92a3
APPEALS-24997 fixed bug in form validation
jefftmarks Aug 3, 2023
1b233bc
APPEALS-24997 refactored event sequences in test and date UTC issue
jefftmarks Aug 4, 2023
6ce41dd
APPEALS-24997 changed tomorrow to futureDate
jefftmarks Aug 4, 2023
c6c375e
APPEALS-24997 uncommented jestsetup and fixed describe name in test
jefftmarks Aug 4, 2023
36dc0d8
Merge branch 'feature/APPEALS-21339' into jefftmarks/APPEALS-24997
jefftmarks Aug 4, 2023
8886c94
APPEALS-24997 fixed missing controlled form
jefftmarks Aug 4, 2023
a7df964
Merge branch 'jefftmarks/APPEALS-24997' of https://github.com/departm…
jefftmarks Aug 4, 2023
ea59c71
APPEALS-24997 fixed linting in QueueApp
jefftmarks Aug 4, 2023
938cd05
APPEALS-24997 Removed old useEffect from DateSelector
jefftmarks Aug 4, 2023
0b0ebed
APPEALS-25000 buttons are now disabled when required information is n…
minhazur9 Aug 7, 2023
df08aec
APPEALS-25001 Ignore CC issues
msteele96 Aug 7, 2023
d785c6d
Merge pull request #19088 from department-of-veterans-affairs/msteele…
ThorntonMatthew Aug 7, 2023
a537444
Merge branch 'feature/APPEALS-21339' into jefftmarks/APPEALS-24997
ThorntonMatthew Aug 7, 2023
d23f082
APPEALS 25000 added more feature tests
minhazur9 Aug 7, 2023
6b2df8f
Merge branch 'feature/APPEALS-21339' into min/APPEALS-25000
minhazur9 Aug 7, 2023
9e2421a
APPEALS-24997: Fix typo in unrelated portion of modal
ThorntonMatthew Aug 7, 2023
33254e3
APPEALS-25000 removed highlighting error messages
minhazur9 Aug 7, 2023
392b15f
Merge branch 'master' into feature/APPEALS-21339
ThorntonMatthew Aug 7, 2023
fda13bb
Merge branch 'feature/APPEALS-21339' into jefftmarks/APPEALS-24997
ThorntonMatthew Aug 7, 2023
1e89934
APPEALS-25000 fixed colocated task feature test
minhazur9 Aug 7, 2023
be158c5
Merge branch 'feature/APPEALS-21339' into min/APPEALS-25000
minhazur9 Aug 7, 2023
646156b
Merge pull request #19111 from department-of-veterans-affairs/min/APP…
ThorntonMatthew Aug 7, 2023
dcb7967
Merge branch 'feature/APPEALS-21339' into jefftmarks/APPEALS-24997
ThorntonMatthew Aug 7, 2023
7d3fe81
APPEALS-24997 Updated CAVC modal snapshots after COPY standardization
jefftmarks Aug 8, 2023
af1ebc5
APPEALS-24997 changed flow modal default classname from usa-button-se…
jefftmarks Aug 8, 2023
487fb51
APPEALS-24997 Merged updates from feature
jefftmarks Aug 8, 2023
8bfbe07
APPEALS-24997 fixed typo in queue/constants and removed comment
jefftmarks Aug 8, 2023
b83e11d
APPEALS-24997 Added period to end of alert in modal
jefftmarks Aug 8, 2023
bce2e44
APPEALS-249979 fixed typo
jefftmarks Aug 8, 2023
a68ab05
APPEALS-24997 Removed unnecessary prop types declaration
jefftmarks Aug 8, 2023
ca8ebba
Merge branch 'jefftmarks/APPEALS-24997' of https://github.com/departm…
jefftmarks Aug 8, 2023
1fb433d
APPEALS-24997 manually update schema to remove MST/PACT tables
jefftmarks Aug 8, 2023
069bc44
Merge branch 'master' into feature/APPEALS-21339
ThorntonMatthew Aug 8, 2023
6cb3596
APPEALS-24997 update snapshots for AddCavcDatesModal jest test
jefftmarks Aug 8, 2023
478d5ea
APPEALS-25000 Added route and controller action
msteele96 Aug 8, 2023
bc42c45
APPEALS-25277 Comment out appeal since it's not necessary in appeals_…
msteele96 Aug 8, 2023
f00a65f
Merge branch 'feature/APPEALS-21339' into jefftmarks/APPEALS-24997
ThorntonMatthew Aug 9, 2023
f7bd235
Merge pull request #19067 from department-of-veterans-affairs/jefftma…
ThorntonMatthew Aug 9, 2023
8933f56
APPEALS-25277 Add rspec, remove useless line in controller
msteele96 Aug 9, 2023
e7611da
Merge branch 'feature/APPEALS-21339' into msteele/APPEALS-25277
msteele96 Aug 9, 2023
dc23803
APPEALS-24999 Merged in frontend changes to CompleteHPRMailTask from …
jefftmarks Aug 9, 2023
7bc6935
APPEALS-24999 Merged in backend changes to HPRMailTask from prototype…
jefftmarks Aug 9, 2023
6684a50
APPEALS-25277 Fixed Code Climate issue
msteele96 Aug 9, 2023
5c2b94d
APPEALS-25277 Update fake to match UAT/PROD return
msteele96 Aug 9, 2023
1c3117c
APPEALS-25277 Added check to make sure document.file_number matches a…
msteele96 Aug 9, 2023
d89c44c
APPEALS-24997 Changed redirect after submit to case details page
jefftmarks Aug 9, 2023
e26a4ef
APPEALS-24999 Hid parent mail task from case timeline
jefftmarks Aug 9, 2023
23de7e2
APPEALS-24999 Added extra line break in instructions field
jefftmarks Aug 9, 2023
ed95fd7
APPEALS-24999 Formatted markdown for task completion on case timeline
jefftmarks Aug 10, 2023
4933184
APPEALS-24999 Changed margin on hr tag
jefftmarks Aug 10, 2023
2b48cee
APPEALS-25277 Code Climate fixes
msteele96 Aug 10, 2023
af54300
APPEALS-25277 Undo CancelTaskModal CC fixes
msteele96 Aug 10, 2023
00406c0
APPEALS-25277 Suggested changes to reduce ! usage
msteele96 Aug 10, 2023
47fccaa
Merge pull request #19141 from department-of-veterans-affairs/msteele…
ThorntonMatthew Aug 10, 2023
f0342f0
APPEALS-24999 Completed markdown styling of case timeline
jefftmarks Aug 10, 2023
f9b2976
APPEALS-24999 Accounted for HPR mail task when no open hearing
jefftmarks Aug 10, 2023
abd7fb5
APPEALS-24999 Made css change to break word for long links in case ti…
jefftmarks Aug 11, 2023
5a06f45
APPEALS-24999 Refactored and renamed methods to dry up HPR mail task …
jefftmarks Aug 11, 2023
83609a6
Merge branch 'feature/APPEALS-21339' of https://github.com/department…
jefftmarks Aug 11, 2023
63b3ba4
APPEALS-24999 merged in work from combined branch
jefftmarks Aug 14, 2023
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
13 changes: 12 additions & 1 deletion app/controllers/appeals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@ def document_count
handle_non_critical_error("document_count", error)
end

# series_id is lowercase, no curly braces because it comes from url
def document_lookup
series_id = "{#{params[:series_id]}}".upcase
document = Document.find_by(series_id: series_id, file_number: appeal.veteran_file_number)

unless document
document = VBMSService.fetch_document_series_for(appeal).map(&:series_id).include?(series_id)
end

render json: { document_presence: document.present? }
end

def power_of_attorney
render json: power_of_attorney_data
end
Expand Down Expand Up @@ -395,4 +407,3 @@ def get_appeal_object(appeals_id)
end
end
end

1 change: 1 addition & 0 deletions app/controllers/tasks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class TasksController < ApplicationController
EducationDocumentSearchTask: EducationDocumentSearchTask,
FoiaTask: FoiaTask,
HearingAdminActionTask: HearingAdminActionTask,
HearingPostponementRequestMailTask: HearingPostponementRequestMailTask,
InformalHearingPresentationTask: InformalHearingPresentationTask,
JudgeAddressMotionToVacateTask: JudgeAddressMotionToVacateTask,
JudgeAssignTask: JudgeAssignTask,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
# frozen_string_literal: true

##
# Task to process a hearing postponement request received via the mail
#
# When this task is created:
# - It's parent task is set as the RootTask of the associated appeal
# - The task is assigned to the MailTeam to track where the request originated
# - A child task of the same name is created and assigned to the HearingAdmin organization
##
class HearingPostponementRequestMailTask < HearingRequestMailTask
include RunAsyncable

class << self
def label
COPY::HEARING_POSTPONEMENT_REQUEST_MAIL_TASK_LABEL
end

def allow_creation?(*)
true
end
end

TASK_ACTIONS = [
Constants.TASK_ACTIONS.CHANGE_TASK_TYPE.to_h,
Constants.TASK_ACTIONS.COMPLETE_AND_POSTPONE.to_h,
Constants.TASK_ACTIONS.ASSIGN_TO_TEAM.to_h,
Constants.TASK_ACTIONS.ASSIGN_TO_PERSON.to_h,
Constants.TASK_ACTIONS.CANCEL_TASK.to_h
].freeze

def available_actions(user)
return [] unless user.in_hearing_admin_team?

if active_schedule_hearing_task || hearing_scheduled_and_awaiting_disposition?
TASK_ACTIONS
else
[
Constants.TASK_ACTIONS.CHANGE_TASK_TYPE.to_h,
Constants.TASK_ACTIONS.CANCEL_TASK.to_h
]
end
end

def update_from_params(params, user)
payload_values = params.delete(:business_payloads)&.dig(:values)

# If request to postpone hearing is granted
if payload_values[:disposition].present?
created_tasks = update_hearing_and_create_tasks(payload_values[:after_disposition_update])
end
update_self_and_parent_mail_task(user: user, params: params, payload_values: payload_values)

[self] + (created_tasks || [])
end

# Only show HPR mail task assigned to "HearingAdmin" on the Case Timeline
def hide_from_case_timeline
assigned_to.type == "MailTeam"
end

def recent_hearing
@recent_hearing ||= open_assign_hearing_disposition_task&.hearing
end

def hearing_task
@hearing_task ||= recent_hearing&.hearing_task || active_schedule_hearing_task&.parent
end

private

def active_schedule_hearing_task
appeal.tasks.where(type: ScheduleHearingTask.name).active.first
end

# ChangeHearingDispositionTask is a subclass of AssignHearingDispositionTask
ASSIGN_HEARING_DISPOSITION_TASKS = [
AssignHearingDispositionTask.name,
ChangeHearingDispositionTask.name
].freeze

def open_assign_hearing_disposition_task
@open_assign_hearing_disposition_task ||= appeal.tasks.where(type: ASSIGN_HEARING_DISPOSITION_TASKS).open.first
end

def hearing_scheduled_and_awaiting_disposition?
return false if recent_hearing.nil?

# Ensure associated hearing is not scheduled for the past
!recent_hearing.scheduled_for_past?
end

def update_hearing_and_create_tasks(after_disposition_update)
multi_transaction do
unless recent_hearing.nil?
update_hearing(disposition: Constants.HEARING_DISPOSITION_TYPES.postponed)
clean_up_virtual_hearing
end
reschedule_or_schedule_later(after_disposition_update)
end
end

def update_hearing(hearing_hash)
if recent_hearing.is_a?(LegacyHearing)
recent_hearing.update_caseflow_and_vacols(hearing_hash)
else
recent_hearing.update(hearing_hash)
end
end

def clean_up_virtual_hearing
if recent_hearing.virtual?
perform_later_or_now(VirtualHearings::DeleteConferencesJob)
end
end

def reschedule_or_schedule_later(after_disposition_update)
case after_disposition_update[:action]
when "reschedule"
new_hearing_attrs = after_disposition_update[:new_hearing_attrs]
reschedule(
hearing_day_id: new_hearing_attrs[:hearing_day_id],
scheduled_time_string: new_hearing_attrs[:scheduled_time_string],
hearing_location: new_hearing_attrs[:hearing_location],
virtual_hearing_attributes: new_hearing_attrs[:virtual_hearing_attributes],
notes: new_hearing_attrs[:notes],
email_recipients_attributes: new_hearing_attrs[:email_recipients]
)
when "schedule_later"
schedule_later
else
fail ArgumentError, "unknown disposition action"
end
end

# rubocop:disable Metrics/ParameterLists
def reschedule(
hearing_day_id:,
scheduled_time_string:,
hearing_location: nil,
virtual_hearing_attributes: nil,
notes: nil,
email_recipients_attributes: nil
)
multi_transaction do
new_hearing_task = hearing_task.cancel_and_recreate

new_hearing = HearingRepository.slot_new_hearing(hearing_day_id: hearing_day_id,
appeal: appeal,
hearing_location_attrs: hearing_location&.to_hash,
scheduled_time_string: scheduled_time_string,
notes: notes)
if virtual_hearing_attributes.present?
@alerts = VirtualHearings::ConvertToVirtualHearingService
.convert_hearing_to_virtual(new_hearing, virtual_hearing_attributes)
elsif email_recipients_attributes.present?
create_or_update_email_recipients(new_hearing, email_recipients_attributes)
end

disposition_task = AssignHearingDispositionTask
.create_assign_hearing_disposition_task!(appeal, new_hearing_task, new_hearing)

[new_hearing_task, disposition_task]
end
end
# rubocop:enable Metrics/ParameterLists

def schedule_later
new_hearing_task = hearing_task.cancel_and_recreate
schedule_task = ScheduleHearingTask.create!(appeal: appeal, parent: new_hearing_task)

[new_hearing_task, schedule_task].compact
end

def update_self_and_parent_mail_task(user:, params:, payload_values:)
updated_instructions = format_instructions_on_completion(
admin_context: params[:instructions],
granted: payload_values[:disposition].present?,
date_of_ruling: payload_values[:date_of_ruling]
)

update!(
completed_by: user,
status: Constants.TASK_STATUSES.completed,
instructions: updated_instructions
)
update_parent_status
end

def format_instructions_on_completion(admin_context:, granted:, date_of_ruling:)
formatted_date = date_of_ruling.to_date.strftime("%m/%d/%Y")

markdown_to_append = <<~EOS

***

###### Marked as complete:

**DECISION**
Motion to postpone #{granted ? 'GRANTED' : 'DENIED'}

**DATE OF RULING**
#{formatted_date}

**DETAILS**
#{admin_context}
EOS

[instructions[0] + markdown_to_append]
end
end
41 changes: 41 additions & 0 deletions app/models/tasks/hearing_mail_tasks/hearing_request_mail_task.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# frozen_string_literal: true

##
# Task to serve as interface with shared methods for the following hearings mail tasks:
# - HearingPostponementRequestMailTask
# - HearingWithdrawalRequestMailTask
# HearingRequestMailTask is itself not an assignable task type
##
class HearingRequestMailTask < MailTask
validates :parent, presence: true, on: :create

before_validation :verify_request_type_designated

class << self
def allow_creation?(*)
false
end

# All descendant postponement/withdrawal tasks will initially be assigned to the Hearing Admin org
def default_assignee(_task)
HearingAdmin.singleton
end
end

def available_actions(_user)
[]
end

def update_from_params(params, current_user)
super(params, current_user)
end

private

# Ensure create is called on a descendant mail task and not directly on the HearingRequestMailTask class
def verify_request_type_designated
if self.class == HearingRequestMailTask
fail Caseflow::Error::InvalidTaskTypeOnTaskCreate, task_type: type
end
end
end
14 changes: 11 additions & 3 deletions app/models/tasks/mail_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# - withdrawing an appeal
# - switching dockets
# - add post-decision motions
# - postponing a hearing
# - withdrawing a hearing
# Adding a mail task to an appeal is done by mail team members and will create a task assigned to the mail team. It
# will also automatically create a child task assigned to the team the task should be routed to.

Expand All @@ -18,15 +20,21 @@ class MailTask < Task
def verify_org_task_unique; end
prepend PrivacyActPending

# This constant is more efficient than iterating through all mail tasks
# and filtering out almost all of them since only HPR and HWR are approved for now
LEGACY_MAIL_TASKS = [
{ label: "Hearing postponement request", value: "HearingPostponementRequestMailTask" }
].freeze

class << self
def blocking?
# Some open mail tasks should block distribution of an appeal to judges.
# Define this method in subclasses for blocking task types.
# Define this method in descendants for blocking task types.
false
end

def subclass_routing_options(user: nil, appeal: nil)
filtered = MailTask.subclasses.select { |sc| sc.allow_creation?(user: user, appeal: appeal) }
def descendant_routing_options(user: nil, appeal: nil)
filtered = MailTask.descendants.select { |sc| sc.allow_creation?(user: user, appeal: appeal) }
sorted = filtered.sort_by(&:label).map { |subclass| { value: subclass.name, label: subclass.label } }
sorted
end
Expand Down
3 changes: 2 additions & 1 deletion app/models/tasks/root_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ def hide_from_task_snapshot
true
end

# :reek:UtilityFunction
def available_actions(user)
return [Constants.TASK_ACTIONS.CREATE_MAIL_TASK.to_h] if RootTask.user_can_create_mail_task?(user) && ama?
return [Constants.TASK_ACTIONS.CREATE_MAIL_TASK.to_h] if RootTask.user_can_create_mail_task?(user)

[]
end
Expand Down
Loading
Loading