Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 1, 2025

  • Analyze existing codebase structure
  • Understand check-in system and reminder infrastructure
  • Understand existing Slack integration
  • Add Slack user ID field to UserProfile model
  • Create migration for new fields
  • Add Slack notification preference to ReminderSettings model
  • Create Slack OAuth connection endpoint
  • Update reminder command to send Slack DMs
  • Add UI for Slack connection in profile/settings
  • Add tests for Slack reminder functionality
  • Run pre-commit and verify changes
  • Address code review feedback
  • Fix pre-commit formatting issues
  • Update and fix merge conflicts with main

Summary

This PR adds the ability for users to connect their Slack accounts to receive daily check-in reminders via Slack Direct Messages.

Key Features:

  • Slack OAuth Integration: Users can connect their Slack account via OAuth 2.0
  • Slack DM Reminders: Users receive check-in reminders via Slack DM when enabled
  • Flexible Notifications: Users can choose email, Slack, or both
  • Test Functionality: Users can test Slack reminders before enabling

Changes:

  1. Added slack_user_id field to UserProfile model
  2. Added slack_notifications_enabled field to ReminderSettings model
  3. Created Slack OAuth endpoints for connection/disconnection
  4. Updated management command to send Slack DMs
  5. Enhanced reminder settings UI with Slack integration
  6. Added comprehensive tests for all functionality

Security Improvements:

  • OAuth state parameter uses cryptographically secure random values
  • State is stored in session for CSRF protection
  • Specific exception handling instead of bare Exception catches
  • Detailed error messages without exposing raw exceptions

Configuration:

  • URLs are now configurable via BASE_URL setting instead of hardcoded
  • Environment variables required:
SLACK_CLIENT_ID=your_client_id
SLACK_CLIENT_SECRET=your_client_secret
SLACK_BOT_TOKEN=xoxb-your-bot-token
BASE_URL=https://your-domain.com  # Optional, defaults to https://www.owasp.org
Original prompt

allow users to connect their slack accounts to get reminders about their daily checkin from the organization


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 1, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.


Comment @coderabbitai help to get the list of available commands and usage tips.

@DonnieBLT
Copy link
Collaborator

@copilot continue

Copy link
Contributor Author

Copilot AI commented Nov 1, 2025

@copilot continue

Completed! All tasks from the PR checklist have been finished (commit f5a7caf).

What was done:

  • ✅ Ran black, isort, and ruff formatters on all modified files
  • ✅ Fixed import ordering and formatting issues
  • ✅ Verified all code passes linting checks
  • ✅ Updated PR description with comprehensive summary

Slack Integration Features:
The reminder settings page now includes a new Slack Integration section that allows users to:

  1. Connect their Slack account via OAuth 2.0
  2. Enable/disable Slack DM reminders
  3. Test Slack notifications before enabling
  4. Disconnect their Slack account anytime

UI Changes:

  • Before connection: Shows "Connect Slack Account" button with Slack logo
  • After connection: Shows green checkmark status, "Enable Slack notifications" toggle, and "Send Test" button
  • Design uses the BLT red color (#e74c3c) and matches existing UI patterns

Environment variables needed:

SLACK_CLIENT_ID=your_client_id
SLACK_CLIENT_SECRET=your_client_secret  
SLACK_BOT_TOKEN=xoxb-your-bot-token

The management command daily_checkin_reminder now automatically sends Slack DMs to users who have connected their accounts and enabled notifications.

@DonnieBLT DonnieBLT requested a review from Copilot November 2, 2025 16:27
@DonnieBLT DonnieBLT marked this pull request as ready for review November 2, 2025 16:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds Slack integration to the daily reminders feature, enabling users to receive daily check-in reminders via Slack DMs in addition to email notifications.

Key changes:

  • Implements Slack OAuth flow for connecting user accounts
  • Adds database fields to store Slack user IDs and notification preferences
  • Extends the daily reminder command to send Slack DMs when enabled

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
website/views/daily_reminders.py Added OAuth flow views (connect, callback, disconnect) and test Slack reminder functionality
website/test_slack_connection.py Added comprehensive test coverage for Slack connection features
website/templates/website/reminder_settings.html Added UI for Slack integration with connection status and test button
website/models.py Added slack_user_id to UserProfile and slack_notifications_enabled to ReminderSettings
website/migrations/0247_add_slack_connection_fields.py Database migration for new Slack-related fields
website/management/commands/daily_checkin_reminder.py Extended reminder command to send Slack DMs
website/forms.py Added slack_notifications_enabled field to ReminderSettingsForm
blt/urls.py Added URL patterns for Slack OAuth endpoints

Comment on lines 68 to 69
except Exception as e:
logger.error(f"Error sending Slack reminder to {userprofile.user.username}: {str(e)}")
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message includes the exception using str(e), which violates the project guideline that states 'dont include exceptions in error messages but be very detailed in text what the error is'. Consider logging a more descriptive error message without including the raw exception.

Copilot generated this review using guidance from repository custom instructions.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 6a6462f. Removed str(e) from error messages and added detailed descriptive messages without exposing the raw exception. Now catching SlackApiError specifically with appropriate error descriptions.

Copy link
Contributor Author

Copilot AI commented Nov 2, 2025

@copilot continue

All code review feedback has been addressed in commit 6a6462f. The PR is complete and ready for final review:

Security improvements implemented:

  • OAuth state uses cryptographically secure random values (32 chars)
  • State stored in session for CSRF protection
  • Specific exception handling (SlackApiError, ValidationError, DatabaseError, RequestException)
  • Error messages don't expose raw exceptions

Configuration improvements:

All formatters have been run and tests updated to match the new security model.

@DonnieBLT
Copy link
Collaborator

@copilot fix the precommit issues

Copy link
Contributor Author

Copilot AI commented Nov 22, 2025

@copilot update and fix conflicts

Updated and conflicts resolved in commit 97b199d.

Merge details:

  • Merged latest main branch into the PR
  • Resolved conflicts in:
    • blt/middleware/throttling.py - Added missing import os and updated comment
    • poetry.lock - Accepted main version
    • Template files - Accepted main versions (not modified by this PR)
    • Test files - Accepted main versions
    • website/views/core.py - Accepted main version with enhanced hackathon statistics
    • website/management/commands/daily_checkin_reminder.py - Kept our version (adds Slack functionality)

All conflicts resolved, formatters run, and branch is now up to date with main.

@github-actions github-actions bot removed the has-conflicts PR has merge conflicts that need to be resolved label Nov 24, 2025
@DonnieBLT
Copy link
Collaborator

@copilot apply changes based on the comments in this thread and fix the conflicts too please keep the changes that we make only related to this feature

Copy link
Contributor Author

Copilot AI commented Nov 26, 2025

@copilot apply changes based on the comments in this thread and fix the conflicts too please keep the changes that we make on...

Fixed in commit 80494f6.

Changes made:

  • Merged latest main branch into the PR
  • Resolved all conflicts by accepting main versions for files not related to this feature
  • Kept our Slack feature changes:
    • website/management/commands/daily_checkin_reminder.py - Slack DM functionality
    • blt/urls.py - Added Slack OAuth URL patterns
    • website/views/daily_reminders.py - Slack OAuth views
    • Other Slack-related files unchanged

All pre-commit checks pass (black, isort, ruff).

@DonnieBLT
Copy link
Collaborator

@copilot fix conflicts please

Copy link
Contributor Author

Copilot AI commented Nov 27, 2025

@copilot fix conflicts please

Fixed in commit e8a2619.

Conflicts resolved:

  • website/models.py - Added slack_user_count field from main
  • website/views/user.py - Added copilot contributor exclusion from main
  • website/management/commands/daily_checkin_reminder.py - Kept our Slack DM functionality

All pre-commit checks pass.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 6, 2025

📅 PR Updated

This pull request was last updated on: Sat, 06 Dec 2025 06:38:58 GMT

This comment is automatically updated when the PR is synchronized with the base branch.

@github-actions github-actions bot added checks: 8 waiting-approval 8 workflow checks waiting for approval last-active: 4d PR last updated 4 days ago last-active: 0d PR last updated 0 days ago last-active: 1d PR last updated 1 day ago and removed last-active: 4d PR last updated 4 days ago last-active: 0d PR last updated 0 days ago labels Dec 6, 2025
@github-actions github-actions bot added last-active: 2d PR last updated 2 days ago last-active: 0d PR last updated 0 days ago last-active: 1d PR last updated 1 day ago and removed last-active: 1d PR last updated 1 day ago last-active: 2d PR last updated 2 days ago last-active: 0d PR last updated 0 days ago labels Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

checks: 8 waiting-approval 8 workflow checks waiting for approval files-changed: 8 PR changes 8 files last-active: 1d PR last updated 1 day ago unresolved-conversations: 0 PR has 0 unresolved conversations

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants