Skip to content

Retire app/presenters in favor of Draper decorators #6909

@compwron

Description

@compwron

Problem

The codebase has two parallel abstractions for view-layer logic:

  • 15 Draper decorators in app/decorators/ — the dominant pattern.
  • 2 presenters in app/presenters/ (BasePresenter, CaseContactPresenter).

BasePresenter (app/presenters/base_presenter.rb) just wraps current_user, current_organization, and policy_scope — all things decorators can already access via the h helper or by accepting them as arguments.

Only one usage exists: app/controllers/concerns/loads_case_contacts.rb:24 instantiates CaseContactPresenter.

Maintaining two abstractions for the same job creates choice paralysis for new contributors and a small amount of cognitive overhead reading the codebase.

Proposal

  1. Move the logic in CaseContactPresenter (the casa_cases lookup + display_case_number + boolean_select_options) into either:
    • A CaseContactDecorator collection method, or
    • A small query object under app/queries/ if it belongs upstream of the view.
  2. Update app/controllers/concerns/loads_case_contacts.rb to consume the new home.
  3. Delete app/presenters/ and the corresponding spec/presenters/ directory (the existing base_presenter_spec.rb is a generator stub anyway).
  4. Remove spec/presenters from spec/.prosopite_ignore.

Acceptance criteria

  • app/presenters/ deleted.
  • No references to BasePresenter or CaseContactPresenter remain (grep -r Presenter app/).
  • All existing case-contact views render the same content.
  • Tests still pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions