-
Notifications
You must be signed in to change notification settings - Fork 17
feat: Add egg tag filtering for mclo.gs upload button #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit 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. 📝 WalkthroughWalkthroughAdded tag-based visibility to UploadLogsAction::setUp: after preserving the offline-server early exit, the action now checks for an egg-level Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php
🔇 Additional comments (3)
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php (3)
30-32: LGTM!The offline server check is preserved correctly and provides an appropriate early exit.
45-50: LGTM!The property-based tag check correctly handles both JSON string and array formats.
51-55: LGTM!The meta array tag check includes appropriate defensive checks before accessing nested array elements.
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php
Outdated
Show resolved
Hide resolved
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php
Outdated
Show resolved
Hide resolved
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php
Outdated
Show resolved
Hide resolved
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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 conditional visibility for the mclo.gs upload button based on egg tags, allowing the feature to be enabled only for servers using eggs with the appropriate tag for log uploading support.
Key Changes
- Modified the
hidden()callback inUploadLogsAction.phpto check for a specific tag on the server's egg - Added multiple fallback mechanisms to check for tags in different formats (relationship, property, meta, database)
- Button remains hidden for offline servers and now also hides for servers with eggs lacking the required tag
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php
Outdated
Show resolved
Hide resolved
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php
Outdated
Show resolved
Hide resolved
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php
Outdated
Show resolved
Hide resolved
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php
Outdated
Show resolved
Hide resolved
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php
Outdated
Show resolved
Hide resolved
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php
Outdated
Show resolved
Hide resolved
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php
Outdated
Show resolved
Hide resolved
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
README.mdmclogs-uploader/README.md
🔇 Additional comments (3)
README.md (1)
15-15: LGTM!The documentation addition clearly indicates the
mclogs-updatertag requirement for the MCLogs Uploader, helping users understand the feature's tag-based visibility.mclogs-uploader/README.md (2)
1-45: Comprehensive documentation of tag-based filtering feature.The README effectively documents the tag-based visibility feature with clear sections on configuration, usage, requirements, and installation. The explanation on line 24 about button visibility based on tag presence is particularly helpful for users.
1-45: Implementation meets all stated PR objectives.The
UploadLogsAction.phpfile implements complete multi-source detection for the "mclogs-updater" tag with all four sources present:
- Method detection (line 36):
method_exists()checks relationship availability- Properties detection (line 45): Direct
$egg->tagsproperty check with JSON decoding- Meta array detection (line 51):
$egg->meta['tags']array inspection- Database join detection (lines 58-62): Direct SQL query joining
egg_tagandtagstablesGraceful fallback behavior is properly implemented: each detection method is wrapped in try/catch blocks (lines 37-43 and 57-69), and if all sources are unavailable or fail, the action defaults to hidden (line 71), ensuring the button only appears when tag detection succeeds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php (1)
32-37: Consider adding strict type comparison to in_array() check.The tag name "mclogs-updater" is correct and consistently used throughout the codebase. However, you should add
trueas the third parameter toin_array()for strict type comparison:$egg = $server->egg; $mcTag = 'mclogs-updater'; - if (!in_array($mcTag, $egg->tags ?? [])) { + if (!in_array($mcTag, $egg->tags ?? [], true)) { return true; }Using strict comparison prevents unexpected type coercion when comparing array values.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php
🧰 Additional context used
🪛 GitHub Actions: Pint
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php
[error] 1-1: pint --test failed (exit code 1). Laravel Pint reported a style issue in mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php.
🔇 Additional comments (2)
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php (2)
28-30: LGTM! Offline check is preserved correctly.The early exit when the server is offline is appropriate and maintains the existing behavior as intended.
39-39: LGTM! Logic correctly shows button when tag is present.The return statement properly makes the button visible when the tag check passes.
|
Hey thanks for your contribution but
|
This PR adds the ability to show the mclo.gs upload button only for servers using eggs with the
mclogs-updatertag.Changes
UploadLogsAction.phpto check formclogs-updatertag on the server's eggUsage
mclogs-updatertag to eggs that support log uploadingTesting
mclogs-updatertag - button visible ✅Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.