Skip to content

Add configurable sharable preview#4463

Merged
ildyria merged 4 commits into
masterfrom
add-landing-url-setting
Jun 25, 2026
Merged

Add configurable sharable preview#4463
ildyria merged 4 commits into
masterfrom
add-landing-url-setting

Conversation

@ildyria

@ildyria ildyria commented Jun 24, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features
    • Added social sharing (Open Graph) settings to choose album cover vs header imagery.
    • Added configurable OG image fallback (URL or Photo ID) with automatic selection of the best available photo size.
    • Improved OG card image generation to use the album-selected image when an album is present.
  • Documentation
    • Added/updated settings descriptions for the new options and fallback behavior across supported languages.
  • Tests
    • Added unit coverage for OG image selection and fallback behavior in both album source modes.

@ildyria ildyria requested a review from a team as a code owner June 24, 2026 21:52
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 999a084e-9980-4c43-8abc-c677bfc62bf7

📥 Commits

Reviewing files that changed from the base of the PR and between 6d3eed4 and e9f7743.

📒 Files selected for processing (1)
  • tests/Unit/View/Components/MetaTest.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/Unit/View/Components/MetaTest.php

📝 Walkthrough

Walkthrough

Adds a backed enum and config migration for new social-card image settings, updates Meta to resolve fallback OG image URLs and choose album header or cover imagery, and adds matching setting descriptions and tests.

Changes

Open Graph image settings

Layer / File(s) Summary
Setting contract and localization
app/Enum/OgImageAlbumSourceType.php, database/migrations/2026_06_24_200000_add_og_image_settings.php, lang/*/all_settings.php
Adds the new album-source enum, registers the sm_card_album_source and sm_card_image_url config entries, and adds matching documentation/details strings across the locale files.
Meta image resolution
app/View/Components/Meta.php
Resolves sm_card_image_url from a URL or photo ID, then uses sm_card_album_source to choose album header or cover imagery when an album exists.
Core Meta test coverage
tests/Unit/View/Components/MetaTest.php
Adds unit coverage for default values, session behavior, image selection, custom asset URLs, and render output.
Album source selection tests
tests/Unit/View/Components/MetaTest.php
Covers the header/cover album-source branches, default-image fallbacks, and explicit image URL generation for both album image sources.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A bunny hopped by, ears all perked up,
New OG cards filled the sharing cup. 🐇
Header or cover, the choice now sings,
With fallback paths and photo things.
Thump-thump—soft shares now sparkle bright!

🚥 Pre-merge checks | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.36% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
app/View/Components/Meta.php (1)

161-177: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Prefer the already eager-loaded cover relationship over a fresh query.

Album eager-loads cover.size_variants and min_privilege_cover.size_variants (see app/Models/Album.php $with). getCoverUrl issues an additional SizeVariant::query() for $cover_id, adding a DB round-trip per render. You could read from the loaded relationship (e.g. $album->cover?->size_variants->getMedium2x()?->url ?? ...) to mirror the priority logic in resolveSmCardImageUrl without an extra query.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8288f0e2-3b33-47e4-b270-d30be7004919

📥 Commits

Reviewing files that changed from the base of the PR and between dcef326 and e8c40c4.

📒 Files selected for processing (26)
  • app/Enum/OgImageAlbumSourceType.php
  • app/View/Components/Meta.php
  • database/migrations/2026_06_24_200000_add_og_image_settings.php
  • lang/ar/all_settings.php
  • lang/bg/all_settings.php
  • lang/cz/all_settings.php
  • lang/de/all_settings.php
  • lang/el/all_settings.php
  • lang/en/all_settings.php
  • lang/es/all_settings.php
  • lang/fa/all_settings.php
  • lang/fr/all_settings.php
  • lang/hu/all_settings.php
  • lang/it/all_settings.php
  • lang/ja/all_settings.php
  • lang/nl/all_settings.php
  • lang/no/all_settings.php
  • lang/pl/all_settings.php
  • lang/pt/all_settings.php
  • lang/ru/all_settings.php
  • lang/sk/all_settings.php
  • lang/sv/all_settings.php
  • lang/tr/all_settings.php
  • lang/vi/all_settings.php
  • lang/zh_CN/all_settings.php
  • lang/zh_TW/all_settings.php

Comment thread app/View/Components/Meta.php
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.45%. Comparing base (dcef326) to head (e9f7743).
⚠️ Report is 1 commits behind head on master.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eeae6ed8-d695-42b7-94e7-e868395ccf25

📥 Commits

Reviewing files that changed from the base of the PR and between e8c40c4 and 2b4a735.

📒 Files selected for processing (1)
  • tests/Unit/View/Components/MetaTest.php

Comment thread tests/Unit/View/Components/MetaTest.php Outdated
Comment thread tests/Unit/View/Components/MetaTest.php
@ildyria ildyria merged commit 51be8c6 into master Jun 25, 2026
48 checks passed
@ildyria ildyria deleted the add-landing-url-setting branch June 25, 2026 07:53
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.

1 participant