Merged
Conversation
…nt (#22334) * feat: Add intelligent subforem reassignment system for offtopic content This PR introduces a comprehensive subforem reassignment system that automatically moves articles to more appropriate communities when they are marked as offtopic by the AI moderation system. ## Key Features ### 🎯 Smart Content Routing - Automatically identifies offtopic content using AI moderation labels - Uses AI to find the most appropriate subforem based on content description specs - Falls back to misc subforem (open discussion space) when no specific match found - Only processes content that's genuinely offtopic (excludes spam/harmful content) ### 🔧 Technical Implementation #### New Models & Attributes - Added boolean attribute to Subforems table to designate open discussion spaces - Enhanced Subforem model with helper methods for misc subforem discovery - Proper caching and cache busting for performance #### AI-Powered Reassignment - : Orchestrates the reassignment process - : Analyzes article content against subforem descriptions - Intelligent fallback logic to misc subforem when no specific match found #### Notification System - : User-friendly notifications - : Async notification processing - Special messaging for misc subforem moves (open discussion space) - Uses mascot account for consistent branding #### Performance Optimizations - Only checks reassignment for offtopic labels (not all content) - Spam filtering prevents notifications for problematic content - Efficient caching of misc subforem lookups ### 🌍 Internationalization - Added localization strings for English, Portuguese, and French - Contextual messaging for different subforem types - Clear explanations for users about content moves ### 🧪 Comprehensive Testing - 65+ test cases covering all scenarios - Edge case handling (deleted subforems, AI failures, etc.) - Performance optimization validation - Integration testing between all components ## User Experience ### For Content Creators - Clear notifications when content is moved - Explanations of why content was moved - Links to both old and new communities - Special messaging for open discussion spaces ### For Community Managers - Automatic content organization - Reduced manual moderation workload - Better content discoverability - Maintained community quality standards ## Technical Details ### Database Changes - Migration adds boolean column to subforems table - Proper indexing for performance ### Integration Points - Hooks into existing automod system in - Works with existing notification infrastructure - Compatible with existing subforem management ### Error Handling - Graceful fallbacks when AI services fail - Proper logging for debugging - No impact on core functionality when disabled ## Performance Impact - Minimal overhead (only processes offtopic content) - Efficient caching reduces database queries - Async notifications prevent blocking operations - Smart filtering reduces unnecessary processing This system significantly improves content organization while maintaining high performance and user experience standards. * fix: Resolve test failures in subforem reassignment and tag adjustment notifications - Remove problematic Ai::Base::DEFAULT_KEY mocking that was causing frozen object errors - Add mascot account mocking to tag adjustment notification tests - Simplify AI service availability check in SubforemReassignmentService - All tests now passing with comprehensive coverage
…articles - Add mapping from offtopic labels to their on-topic equivalents - Update SubforemReassignmentService to change automod_label during reassignment - Add comprehensive tests for automod label updates - All existing tests still pass with new functionality This ensures that when articles are moved to appropriate subforems, their moderation status accurately reflects their new context.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )