Skip to content

Conversation

Copy link

Copilot AI commented Jan 23, 2026

General Info

Changes

Instructors can now provide feedback when approving or rejecting extension requests. Feedback is stored in the database and included in email notifications to students.

Database Schema

  • requests.feedback_message (text, nullable) - stores instructor feedback for both approved/rejected requests
  • course_settings.rejection_email_subject (string, nullable) - customizable rejection email subject
  • course_settings.rejection_email_template (text, nullable) - customizable rejection email body with {{feedback_message}} placeholder
  • No database-level defaults: Default values are provided by the application layer through constants in the CourseSettings model

Model Layer

# Updated method signatures with optional keyword argument
request.approve(lms_facade, user, feedback_message: "Approved with note")
request.reject(user, feedback_message: "Past deadline")

# Email template selection based on status
def send_email_response
  if status == 'denied'
    subject_template = cs.rejection_email_subject.presence || CourseSettings::DEFAULT_REJECTION_EMAIL_SUBJECT
    body_template = cs.rejection_email_template.presence || CourseSettings::DEFAULT_REJECTION_EMAIL_TEMPLATE
  end
  # mapping includes 'feedback_message' with default fallback
end

Application-Layer Defaults:

  • CourseSettings::DEFAULT_REJECTION_EMAIL_SUBJECT - default rejection subject line
  • CourseSettings::DEFAULT_REJECTION_EMAIL_TEMPLATE - default rejection template with {{feedback_message}}
  • Request::DEFAULT_FEEDBACK_MESSAGE - default message when feedback is nil

UI/UX

  • Replaced direct approve/reject buttons with Bootstrap 5 modals
  • Approve modal: optional feedback textarea (3 rows)
  • Reject modal: required feedback textarea (4 rows) with HTML5 validation
  • Both modals include proper ARIA labels (aria-labelledby, aria-describedby) and keyboard navigation

Backward Compatibility

  • feedback_message parameter is optional (defaults to nil)
  • Falls back to application-defined default templates if rejection templates not configured
  • Default message "No additional feedback provided." used in emails when feedback_message is nil
  • Existing approve/reject calls work unchanged

Testing

Added 20 test cases:

  • Model tests: approve/reject with/without feedback_message, email template selection
  • Controller tests: parameter passing from forms to model methods
  • Email tests: rejection template usage, default message handling

All tests pass. Syntax validated with ruby -c.

Documentation

Updated instructor documentation in docs/instructors.md:

  • Added "Providing Feedback to Students" section explaining the approve/reject feedback feature
  • Added "Rejection Email Template" subsection with configuration instructions and example template
  • Updated available email template variables list to include {{feedback_message}}

Code includes self-documenting constants:

  • DEFAULT_FEEDBACK_MESSAGE, DEFAULT_REJECTION_EMAIL_SUBJECT, DEFAULT_REJECTION_EMAIL_TEMPLATE
  • ARIA labels in views explain field purposes

Checklist

  • Name of branch corresponds to story (copilot/improve-request-rejection-flow)
Original prompt

This section details on the original issue you should resolve

<issue_title>Improve the Request Rejection Flow (Custom Templates)</issue_title>
<issue_description>- [ ] #150

  • Create a specific email template for rejected requests. This template should include the reason provided. </issue_description>

<agent_instructions>Please start by adding a migration and improving the instructor UI. Make a new popup window (following Bootstrap conventions).

Please add tests
HTML should meet accessibility standards.
Please make distinct commits for individual components of work.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@cycomachead - the reject button should pop up a text box asking for a reason - there should be a new email template specifically for rejected requests which has a new field `feedback_message` that can be injected in the body - this `feedback_message` should be saved as a field on the extension request table

Round two:

  • adapt the approval flow to optionally pass an additional feedback message. </comment_new>

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 6 commits January 23, 2026 23:31
Co-authored-by: cycomachead <1505907+cycomachead@users.noreply.github.com>
… modal

Co-authored-by: cycomachead <1505907+cycomachead@users.noreply.github.com>
Co-authored-by: cycomachead <1505907+cycomachead@users.noreply.github.com>
Co-authored-by: cycomachead <1505907+cycomachead@users.noreply.github.com>
Co-authored-by: cycomachead <1505907+cycomachead@users.noreply.github.com>
…consistency

Co-authored-by: cycomachead <1505907+cycomachead@users.noreply.github.com>
Copilot AI changed the title [WIP] Add email template for rejected requests with feedback Add feedback message support to request approval/rejection flow Jan 23, 2026
Copilot AI requested a review from cycomachead January 23, 2026 23:42
@cycomachead
Copy link
Contributor

@copilot can you remove the default text from the DB entry.

Update docs/instructors documentation

…tion

Co-authored-by: cycomachead <1505907+cycomachead@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jan 24, 2026

@copilot can you remove the default text from the DB entry.

Update docs/instructors documentation

Done in commit 1d10e5f:

  1. Removed default text from DB migration: The rejection_email_subject and rejection_email_template columns no longer have database-level defaults. Instead, defaults are provided by the application layer using constants in the CourseSettings model (DEFAULT_REJECTION_EMAIL_SUBJECT and DEFAULT_REJECTION_EMAIL_TEMPLATE).

  2. Updated instructor documentation: Added comprehensive documentation in docs/instructors.md:

    • New "Providing Feedback to Students" section explaining the approve/reject feedback feature
    • New "Rejection Email Template" subsection with configuration instructions and example template
    • Updated variables list to include {{feedback_message}}

The Request model now uses CourseSettings::DEFAULT_REJECTION_EMAIL_TEMPLATE as the fallback when rejection_email_template is nil in the database.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve the Request Rejection Flow (Custom Templates)

2 participants