Skip to content

Add Team Settings for Timesheet Change Requirements #868

Open

Description

@Dharp02

Overview

Every team with an admin other than the editor sends timesheet changes through approval, and the evidence each change needs is fixed in code: edits and deletes need a written description (10+ characters), and brand-new entries need a description and a walkthrough video. Not every team wants that level of ceremony — some trust their members to correct their own time, others want a video for every change. Teams should be able to choose what a change request requires, separately for edits and for new entries.

Current State

  • Approval is implicit: requiresApproval() is true whenever the team has an admin other than the requester (meteor-backend/server/timesheet-change-requests.js). There is no way to turn it off.
  • Requirements are hard-coded on both sides:
    • Backend: VIDEO_REQUIRED_ACTIONS = ['create'] and a 10-character description minimum in assertJustification().
    • Frontend: timesheetVideoRequired() in src/lib/timesheetApproval.ts returns action === 'create'.
  • The same rule applies to session edits (Timesheet), ticket time edits (Clock page / WorkWeek.tsx) and admin edits (AdminTimesheetPanel.tsx).

Proposed Changes

1. Team setting: change requirements

  • Add two team-level settings, each with three levels:
    • Edits & deletes: none · description · description + video
    • New entries: none · description · description + video
  • none means the change applies directly, with no approval request.
  • Defaults preserve today's behavior: edits = description, new entries = description + video.
  • Shown in Team Settings (src/features/settings/TeamSettings.tsx), editable by team admins only.

2. Backend enforcement

  • requiresApproval() and assertJustification() read the team's setting for the action instead of the hard-coded constants.
  • The backend stays the authority — a client that skips the form still gets description-required / video-required errors.
  • Existing teams without the field fall back to the defaults (no migration needed).

3. Frontend follows the setting

  • Replace timesheetVideoRequired(action) with a helper that takes the team's setting, used by PersonalTimesheetPanel, WorkWeek and AdminTimesheetPanel.
  • When the level is none, the justification fields are hidden and the change saves directly.
  • The walkthrough field reads "(optional)" when video isn't required, as today.

Acceptance Criteria

  • Team admins can set edit and new-entry requirements independently in Team Settings
  • Defaults match today's behavior for every existing team
  • none applies the change immediately with no approval request
  • description requires 10+ characters and no video
  • description + video requires both, for edits as well as new entries
  • Backend rejects requests missing what the team requires, regardless of client
  • All three edit surfaces (Timesheet, Clock page, admin timesheet) follow the setting
  • Setting labels are externalized and the controls are accessible
  • Release note added

Out of Scope (for Now)

  • Per-member or per-role overrides
  • Organization-wide defaults
  • Different rules for deletes vs. edits
  • Changing who approves (still the team's other admins)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions