Skip to content

Conversation

@zfelyx
Copy link
Contributor

@zfelyx zfelyx commented Dec 28, 2025

This PR adds the ability to show the mclo.gs upload button only for servers using eggs with the mclogs-updater tag.

Changes

  • Modified UploadLogsAction.php to check for mclogs-updater tag on the server's egg
  • Button is now hidden by default and only shows for eggs with the appropriate tag
  • Added graceful fallback if tag functionality is not available

Usage

  1. Add the mclogs-updater tag to eggs that support log uploading
  2. The upload button will automatically appear only on servers using tagged eggs
  3. Servers with untagged eggs will not show the upload button

Testing

Summary by CodeRabbit

  • New Features

    • Added tag-based visibility for MCLogs Uploader — the upload button now appears only for eggs tagged with "mclogs-updater".
  • Documentation

    • Expanded README: installation, configuration (Tag-Based Filtering), usage, requirements, and support section with repo link.
    • Minor install-path text adjustment in main README.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings December 28, 2025 03:34
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 28, 2025

Note

Other AI code review bot(s) detected

CodeRabbit 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.

📝 Walkthrough

Walkthrough

Added tag-based visibility to UploadLogsAction::setUp: after preserving the offline-server early exit, the action now checks for an egg-level mclogs-updater tag and hides/shows accordingly. README files were updated to document the tag requirement and installation/configuration.

Changes

Cohort / File(s) Summary
UploadLogsAction visibility logic
mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php
Extended setUp() hidden logic to require the mclogs-updater tag on the egg (multi-source checks), added guards (try/catch), and retained the offline-server early exit. No changes to execution/HTTP flow or public signatures.
Documentation — main README
README.md
Minor text tweak in install path display and appended "(add mclogs-updater tag to eggs to enable)" to the MCLogs Uploader entry.
Documentation — plugin README
mclogs-uploader/README.md
Replaced brief note with expanded documentation: Tag-based visibility, Configuration (Tag-Based Filtering), Installation, Usage, Requirements, and Support; clarifies upload button shows only for eggs with mclogs-updater.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • lajczi

Poem

🐰 I hopped through tags and metadata bright,
Peeked in methods, JSON, and DB light.
With gentle try/catch I kept things neat,
The upload button shows where tags meet.
A little rabbit cheers — logs tidy and right!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding egg tag filtering to control visibility of the mclo.gs upload button.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between a3f26b9 and abe6bcc.

📒 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.

Copy link

Copilot AI left a 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 in UploadLogsAction.php to 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

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between abe6bcc and febc6ad.

📒 Files selected for processing (2)
  • README.md
  • mclogs-uploader/README.md
🔇 Additional comments (3)
README.md (1)

15-15: LGTM!

The documentation addition clearly indicates the mclogs-updater tag 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.php file implements complete multi-source detection for the "mclogs-updater" tag with all four sources present:

  1. Method detection (line 36): method_exists() checks relationship availability
  2. Properties detection (line 45): Direct $egg->tags property check with JSON decoding
  3. Meta array detection (line 51): $egg->meta['tags'] array inspection
  4. Database join detection (lines 58-62): Direct SQL query joining egg_tag and tags tables

Graceful 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 true as the third parameter to in_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

📥 Commits

Reviewing files that changed from the base of the PR and between febc6ad and 5febd36.

📒 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.

@rmartinoscar
Copy link
Member

Hey thanks for your contribution but

Yes, that's intentional! While the name "mclogs" might be a bit misleading, it's basically just a normal paste site. And thus works on every egg.
We should probably rename it to reflect that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants