• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Freegle / Iznik / 11013

08 May 2026 05:47AM UTC coverage: 72.785% (+0.02%) from 72.769%
11013

Pull #392

circleci

edwh
feat(batch): migrate users_modmails.php to users:update-modmails

UserModMailsService scans logs from the last 10 minutes for mod actions
(Message/Rejected, Message/Deleted, Message/Replied, User/Mailed,
User/Rejected, User/Deleted) where byuser != user, then INSERT IGNOREs
into users_modmails. Also prunes entries older than 30 days.

Mirrors V1 cron/users_modmails.php / User::updateModMails().

10 tests covering: all relevant log subtypes, duplicate prevention,
old-log skip, irrelevant-subtype skip, byuser=user skip, prune.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pull Request #392: feat(batch): migrate users_modmails.php to users:update-modmails

13778 of 20744 branches covered (66.42%)

Branch coverage included in aggregate %.

35 of 45 new or added lines in 2 files covered. (77.78%)

40 existing lines in 4 files now uncovered.

99507 of 134900 relevant lines covered (73.76%)

22.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/iznik-batch/app/Console/Commands/User/UpdateModMailsCommand.php
1
<?php
2

3
namespace App\Console\Commands\User;
4

5
use App\Services\UserModMailsService;
6
use Illuminate\Console\Command;
7
use Illuminate\Support\Facades\Log;
8

9
class UpdateModMailsCommand extends Command
10
{
11
    protected $signature = 'users:update-modmails
12
                            {--dry-run : Show counts without making changes}';
13

14
    protected $description = 'Sync recent mod actions into users_modmails and prune old entries (V1: users_modmails.php)';
15

NEW
16
    public function handle(UserModMailsService $service): int
×
17
    {
NEW
18
        $dryRun = $this->option('dry-run');
×
19

NEW
20
        if ($dryRun) {
×
NEW
21
            $this->info('DRY RUN — no changes will be made.');
×
22

NEW
23
            return Command::SUCCESS;
×
24
        }
25

NEW
26
        $inserted = $service->updateModMails();
×
NEW
27
        $deleted = $service->pruneOldEntries();
×
28

NEW
29
        $this->info("users:update-modmails complete — inserted: {$inserted}, pruned: {$deleted}");
×
NEW
30
        Log::info('users:update-modmails complete', ['inserted' => $inserted, 'pruned' => $deleted]);
×
31

NEW
32
        return Command::SUCCESS;
×
33
    }
34
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc