Skip to content

Comments

[pull] main from forem:main#79

Merged
pull[bot] merged 3 commits intoamishakov:mainfrom
forem:main
Sep 16, 2025
Merged

[pull] main from forem:main#79
pull[bot] merged 3 commits intoamishakov:mainfrom
forem:main

Conversation

@pull
Copy link

@pull pull bot commented Sep 16, 2025

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 : )

…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.
@pull pull bot locked and limited conversation to collaborators Sep 16, 2025
@pull pull bot added the ⤵️ pull label Sep 16, 2025
@pull pull bot merged commit d985e1d into amishakov:main Sep 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant