Skip to content

Latest commit

 

History

History
185 lines (141 loc) · 7.39 KB

File metadata and controls

185 lines (141 loc) · 7.39 KB

Phase 3 Completion Summary

Overview

Phase 3 of the discussion removal plan has been successfully implemented. All Django apps have been deleted, dependencies removed, and all import errors fixed. The application now runs without errors.

Changes Made

1. Deleted Django Apps

Successfully deleted entire app directories:

  • channels/ - Removed entire directory (all models, views, APIs, tests)
  • channels_fields/ - Removed entire directory
  • discussions/ - Removed entire directory
  • embedly/ - Removed entire directory

2. Removed Fixtures

  • ✅ Deleted fixtures/reddit.py
  • ✅ Updated fixtures/common.py - removed channels imports and fixtures
  • ✅ Updated fixtures/betamax.py - simplified betamax configuration

3. Updated Settings (open_discussions/settings.py)

Removed from INSTALLED_APPS:

  • 'channels'
  • 'channels_fields'
  • 'discussions'

Removed from MIDDLEWARE:

  • 'open_discussions.middleware.channel_api.ChannelApiMiddleware'

4. Updated URLs (open_discussions/urls.py)

  • ✅ Removed include("embedly.urls")

5. Removed Embedly Dependencies

Updated files to remove embedly usage:

  • search/tasks.py - Removed get_embedly_content import, update_link_post_with_preview(), and create_post_document() functions
  • open_discussions/views.py - Removed embedlyKey from JS settings
  • infinite_example/views.py - Removed embedlyKey from JS settings

6. Cleaned Up PRAW/Reddit Dependencies

  • search/tasks.py - Removed prawcore.exceptions.NotFound import, removed channels and Post/Comment imports
  • search/tasks.py - Removed REDDIT_EXCEPTIONS from imports
  • search/tasks.py - Removed index_posts() and index_comments() functions
  • search/tasks.py - Updated wrap_retry_exception() to remove Reddit-specific exception handling
  • search/tasks.py - Updated bulk_deindex_profiles() to not use REDDIT_EXCEPTIONS
  • search/constants.py - Removed praw and prawcore imports
  • search/constants.py - Removed REDDIT_EXCEPTIONS constant definition

7. Updated Dependencies (pyproject.toml)

Removed from [tool.poetry.dependencies]:

  • akismet = "^1.1"

  • base36 = "^0.1.1"

  • praw = "^4.5.1"

  • ✅ Ran poetry lock successfully

8. Updated Notifications Module

Updated notifications/models.py:

  • ✅ Removed from channels.models import Base36IntegerField, Channel
  • ✅ Removed channel field from NotificationSettings model
  • ✅ Removed CommentEvent model (discussion-related)
  • ✅ Removed PostEvent model (discussion-related)

Updated notifications/api.py:

  • ✅ Removed channel/post/comment handling
  • ✅ Made moderator and comment notifications return None
  • ✅ Simplified notification settings creation

Updated notifications/notifiers/frontpage.py:

  • ✅ Simplified to no-op (discussions removed)

Updated notifications/notifiers/moderator_posts.py:

  • ✅ Simplified to no-op (discussions removed)

Updated notifications/tasks.py:

  • ✅ Removed Channel model import

9. Fixed All Import Errors

Authentication Module:

  • authentication/api.py - removed channels_api.get_or_create_auth_tokens() call
  • authentication/pipeline/invite.py - made channel invite resolution no-op
  • authentication/pipeline/user.py - removed membership_api import and usage

Search Module:

  • search/api.py - removed channel constants and models, simplified filtering

Moira Lists:

  • moira_lists/tasks.py - made channel membership updates no-op

Open Discussions Core:

  • open_discussions/permissions.py - simplified channel-related permissions to return False
  • open_discussions/recorder.py - made Reddit recorder no-op
  • open_discussions/middleware/channel_api.py - made middleware no-op

Profiles:

  • profiles/views.py - made posts/comments views return empty lists

Files Modified Summary

File Change Type Description
channels/, channels_fields/, discussions/, embedly/ Deleted Entire Django apps removed
fixtures/reddit.py Deleted Reddit fixtures
fixtures/common.py Modified Removed channels imports and fixtures
fixtures/betamax.py Modified Simplified betamax configuration
open_discussions/settings.py Modified Removed apps from INSTALLED_APPS and middleware
open_discussions/urls.py Modified Removed embedly URLs
open_discussions/views.py Modified Removed embedlyKey
open_discussions/permissions.py Modified Simplified channel permissions
open_discussions/recorder.py Modified Made recorder no-op
open_discussions/middleware/channel_api.py Modified Made middleware no-op
infinite_example/views.py Modified Removed embedlyKey
search/tasks.py Modified Removed embedly, praw, and discussion functions
search/constants.py Modified Removed PRAW imports and REDDIT_EXCEPTIONS
search/api.py Modified Removed channel filtering logic
notifications/models.py Modified Removed discussion-related models and fields
notifications/api.py Modified Removed channel/post/comment handling
notifications/notifiers/frontpage.py Modified Simplified to no-op
notifications/notifiers/moderator_posts.py Modified Simplified to no-op
notifications/tasks.py Modified Removed Channel import
authentication/api.py Modified Removed channels_api usage
authentication/pipeline/invite.py Modified Made invite resolution no-op
authentication/pipeline/user.py Modified Made membership update no-op
moira_lists/tasks.py Modified Made channel updates no-op
profiles/views.py Modified Made posts/comments return empty
pyproject.toml Modified Removed akismet, base36, praw dependencies
poetry.lock Regenerated Updated lock file

Total:

  • Directories deleted: 4
  • Files deleted: 1 + all files in deleted directories (hundreds)
  • Files modified: 24
  • Lines removed: ~6000+ (rough estimate including all deleted apps)
  • Lines added: ~100 (stub implementations)

Current State

Application builds successfully!

  • Django check passes with no errors
  • All from channels imports resolved
  • No ModuleNotFoundError exceptions

Verification

# Django check passes
docker compose exec web python manage.py check
# Output: System check identified no issues (0 silenced).

Next Steps

Phase 3 is now COMPLETE. The remaining work includes:

  1. Phase 4: Database Migrations

    • Create migrations to remove notification fields (channel field, PostEvent, CommentEvent)
    • Test migrations in development
    • Plan migration strategy for production
  2. Phase 5: Cleanup and Testing

    • Delete discussion-related test files
    • Update documentation
    • Test preserved features (search, podcasts, courses)
    • Remove discussion email templates
  3. Phase 6: Verification

    • Full test suite
    • Manual testing checklist
    • Performance testing
    • Final verification

Notes

  • Phase 3 successfully removed all Django apps and fixed all import errors
  • Discussion functionality is now completely disabled via no-op stubs
  • The codebase is stable and Django can start without errors
  • All changes maintain backward compatibility where possible (functions return empty/None instead of erroring)
  • Ready to proceed with database migrations in Phase 4