Skip to content

プラクティスのOGPサイズを1200 x 630に設定#8569

Merged
komagata merged 5 commits intomainfrom
chore/constantize-size-of-ogp-image-in-practice
Aug 25, 2025
Merged

プラクティスのOGPサイズを1200 x 630に設定#8569
komagata merged 5 commits intomainfrom
chore/constantize-size-of-ogp-image-in-practice

Conversation

@reckyy
Copy link
Copy Markdown
Contributor

@reckyy reckyy commented Apr 21, 2025

Issue

概要

別の方が以下のPRでOGP画像のリサイズを実装されていましたが、新たにメソッドを定義せず、直接OGP画像を表示する方針に変更となったため、新しくPRを作成しました。

※ X(旧Twitter)、FacebookでのOGP画像の表示に関する詳細も、上記PRの概要に記載されています。

変更確認方法

  1. chore/constantize-size-of-ogp-image-in-practiceをローカルに取り込む

以降、上記PRと同様の手順をそれぞれ実施してください。

Screenshot

プラクティス編集ページ

変更前 変更後
スクリーンショット 2025-04-22 12 25 15 スクリーンショット 2025-04-22 12 26 21

プラクティス個別ページ

変更前 変更後
スクリーンショット 2025-04-21 22 44 50 スクリーンショット 2025-04-21 23 09 05

プラクティス個別ページ(ログアウト状態)

変更前 変更後
スクリーンショット 2025-04-22 12 05 12 スクリーンショット 2025-04-22 11 45 51

Facebookで投稿時

変更前 変更後
スクリーンショット 2025-04-21 23 04 11 スクリーンショット 2025-04-21 23 16 52

Twitterで投稿時

変更前 変更後
スクリーンショット 2025-04-21 22 58 25 スクリーンショット 2025-04-21 23 20 26

Twitterで投稿時(プラクティス修了時)

変更前 変更後
スクリーンショット 2025-04-22 12 05 57 スクリーンショット 2025-04-22 11 48 37

Summary by CodeRabbit

  • 新機能

    • OGP画像の標準サイズを定義し、リサイズ・URL生成・表示・OGP/Twitterメタタグ設定を行うヘルパーを追加しました。
  • ドキュメント

    • OGP画像アップロード説明を、指定サイズへ自動でリサイズおよび中央クロップされる旨に更新しました。
  • リファクタ

    • ビュー内のOGP画像表示とメタタグ設定をヘルパーへ統一して簡素化しました。

@reckyy reckyy self-assigned this Apr 22, 2025
@reckyy reckyy force-pushed the chore/constantize-size-of-ogp-image-in-practice branch 2 times, most recently from 1b7567d to 06606fa Compare April 22, 2025 06:16
@reckyy
Copy link
Copy Markdown
Contributor Author

reckyy commented Apr 22, 2025

@hagiya0121
お疲れ様です!
こちらのPRのレビューをお願いしたく、ご連絡いたしました。
お手隙の際にご対応いただけると嬉しいです。全く急ぎではないです。
もし、ご都合悪ければ仰ってください!
よろしくお願いいたします。

@reckyy reckyy marked this pull request as ready for review April 22, 2025 13:51
@reckyy reckyy requested a review from hagiya0121 April 22, 2025 13:51
@hagiya0121
Copy link
Copy Markdown
Contributor

@reckyy
了解です!
3日以内には終わります。

Copy link
Copy Markdown
Contributor

@hagiya0121 hagiya0121 left a comment

Choose a reason for hiding this comment

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

@reckyy
動作に問題はありませんでした。
気になったところをコメントしたので確認お願いします🙏

.card-body.is-practice
- if practice.ogp_image.attached?
= image_tag practice.ogp_image
= image_tag practice.ogp_image.variant(resize_to_fill: [1200, 630]).processed.url
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.

今の実装でも問題はないと思うのですが、同じメソッドや定数が複数箇所に登場している点が少し気になりました。
個人的には、これをヘルパーにまとめるかモデルのインスタンスメソッドとして定義するのを考えたのですが、どうでしょうか?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

コメントありがとうございます!

自分としても悩んだのですが、このPRの前身であるPRにて、komagataさんから以下のようなコメントがありました。

#7775 (comment)

この「直接表示する」という方針に従い、今回はモデルではなくView側で variant を直接記述する形にしています。

ただご指摘の通り、同じサイズの指定が複数箇所に散らばっている点は保守性の観点から気になります。
View寄りの処理でもあるため、ヘルパーに定数とvariant処理をまとめる案は良いと感じました。

今後の対応としては、komagataさんにも確認のうえ、以下のどちらの方針で進めるか決め、必要があれば修正しようと思います。

  • 現状のように variant を直接Viewに書く形を維持
  • 定数と処理をヘルパーに切り出して共通化する形に変更

ご確認よろしくお願いいたします!

Copy link
Copy Markdown
Contributor Author

@reckyy reckyy Apr 25, 2025

Choose a reason for hiding this comment

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

@komagata
現在、PracticeのOGP画像サイズを1200 x 630に統一する修正を行ったのですが、複数箇所に同じサイズ指定が散らばっており、「保守性の観点からヘルパーに共通化してみてはどうか」とメンバーからご提案をいただきました。

ただ、以前の以下のPRで「直接表示する(= Viewでそのままvariantを書く)」というコメントを拝見したのでモデルへの切り出しは避けています。

#7775 (comment)

この場合、以下のどちらの方針が望ましいか、komagataさんのご意見を伺えればと思います。

  1. 現状のように View に直接 variant(resize_to_fill: [1200, 630])を書く
  2. resize_to_fillの定数と処理をヘルパーにまとめる

お手すきの際にご確認いただけますと幸いです。

Copy link
Copy Markdown
Member

@komagata komagata May 4, 2025

Choose a reason for hiding this comment

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

@reckyy 2のように共通化して下さい。ただしhelperが最適かどうか実装されたものを見てみないとわからないです。decoratorなども向いているかもしれません。

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@reckyy こちらの件、いかがでしょうか

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@komagata
返信が遅くなり、申し訳ございません。
現在共通化を進めていますので、もうしばらくお待ちいただければと思います。 🙇

@hagiya0121
Copy link
Copy Markdown
Contributor

@reckyy
すいません🙏別PRのコメントを見落としてて修正意図を理解せずに指摘してました。

@reckyy reckyy force-pushed the chore/constantize-size-of-ogp-image-in-practice branch 5 times, most recently from 82cac7b to 2522ccc Compare May 27, 2025 07:18
@reckyy reckyy force-pushed the chore/constantize-size-of-ogp-image-in-practice branch from 2522ccc to 1b755e6 Compare August 4, 2025 11:46
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Aug 4, 2025

Walkthrough

PracticesHelper に OGP 用の定数 OGP_SIZE と画像バリアント生成・画像タグ出力・画像 URL 生成・OGP/Twitter メタタグ設定のヘルパーメソッドが追加され、関連ビューでこれらヘルパー呼び出しへ置換およびフォームの説明文が OGP_SIZE を参照する表現に更新されました。

Changes

Cohort / File(s) Change Summary
PracticesHelper 拡張
app/helpers/practices_helper.rb
定数 OGP_SIZE を追加。OGP 用の画像バリアント生成、画像タグ出力、画像 URL 生成、OGP/Twitter メタタグ設定のヘルパーメソッドを追加。
フォーム説明文更新
app/views/mentor/practices/_form.html.slim
OGP 画像アップロードの説明文を PracticesHelper::OGP_SIZE を参照する動的表現に変更。サイズ不一致時はリサイズ・中央クロップする旨を明記。
サマリ表示の画像出力置換
app/views/practices/_summary.html.slim
image_tag(practice.ogp_image)practice_ogp_image_tag(practice.ogp_image) に置換。
完了ページのメタタグ置換
app/views/practices/completion/show.html.slim
直接の set_meta_tags 呼び出しを practice_ogp_meta_tags(practice_ogp_image_url(...)) に置換。
未認可表示の画像・メタタグ置換
app/views/practices/unauthorized_show.slim
画像表示とメタタグ設定をヘルパー (practice_ogp_image_tag, practice_ogp_image_url, practice_ogp_meta_tags) に集約。

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant View
    participant Helper
    participant ActiveStorage
    participant Router
    participant MetaTags

    View->>Helper: practice_ogp_image_tag(image)
    Helper->>ActiveStorage: variant processing (resize/crop to OGP_SIZE)
    ActiveStorage-->>Helper: variant blob
    Helper-->>View: rendered image_tag(variant)

    View->>Helper: practice_ogp_image_url(image)
    Helper->>ActiveStorage: ensure variant (OGP_SIZE)
    ActiveStorage-->>Helper: variant blob
    Helper->>Router: polymorphic_url(variant)
    Router-->>Helper: image_url

    View->>Helper: practice_ogp_meta_tags(image_url)
    Helper->>MetaTags: set Open Graph & Twitter meta tags (image, url)
    MetaTags-->>View: meta tags applied
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🥕
OGPを背負って跳ねるよ
画像はぴったり、端っこはクロップ
ヘルパーひとつでタグが整う
コード畑ににんじんの列
うさぎは満足、さあデプロイ!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 RuboCop (1.76.1)
app/helpers/practices_helper.rb

rubocop-minitest extension supports plugin, specify plugins: rubocop-minitest instead of require: rubocop-minitest in /.rubocop.yml.
For more information, see https://docs.rubocop.org/rubocop/plugin_migration_guide.html.
rubocop-capybara extension supports plugin, specify plugins: rubocop-capybara instead of require: rubocop-capybara in /.rubocop.yml.
For more information, see https://docs.rubocop.org/rubocop/plugin_migration_guide.html.
Unable to find gem rubocop-fjord; is the gem installed? Gem::MissingSpecError
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:309:in rescue in gem_config_path' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:293:in gem_config_path'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:84:in block (2 levels) in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:82:in reverse_each'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:82:in block in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:76:in each_pair'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader_resolver.rb:76:in resolve_inheritance_from_gems' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_loader.rb:58:in load_file'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/config_store.rb:29:in options_config=' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:162:in act_on_options'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:47:in block in run' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:82:in profile_if_needed'
/var/lib/gems/3.1.0/gems/rubocop-1.79.2/lib/rubocop/cli.rb:43:in run' /var/lib/gems/3.1.0/gems/rubocop-1.79.2/exe/rubocop:19:in <top (required)>'
/usr/local/bin/rubocop:25:in load' /usr/local/bin/rubocop:25:in

'

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 728a145 and f3bd4ad.

📒 Files selected for processing (5)
  • app/helpers/practices_helper.rb (1 hunks)
  • app/views/mentor/practices/_form.html.slim (1 hunks)
  • app/views/practices/_summary.html.slim (1 hunks)
  • app/views/practices/completion/show.html.slim (1 hunks)
  • app/views/practices/unauthorized_show.slim (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • app/views/practices/completion/show.html.slim
  • app/views/practices/_summary.html.slim
  • app/views/mentor/practices/_form.html.slim
  • app/views/practices/unauthorized_show.slim
  • app/helpers/practices_helper.rb
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/constantize-size-of-ogp-image-in-practice

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@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

♻️ Duplicate comments (1)
app/views/practices/unauthorized_show.slim (1)

7-7: 引数の不整合があります

ヘルパーメソッドの引数定義と呼び出し方に不整合があります。practice_ogp_meta_tagsメソッドがキーワード引数を期待するように修正される必要があります。

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f48d441 and 1b755e6.

📒 Files selected for processing (5)
  • app/helpers/practices_helper.rb (1 hunks)
  • app/views/mentor/practices/_form.html.slim (1 hunks)
  • app/views/practices/_summary.html.slim (1 hunks)
  • app/views/practices/completion/show.html.slim (1 hunks)
  • app/views/practices/unauthorized_show.slim (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rb

⚙️ CodeRabbit Configuration File

**/*.rb: # refactoring

  • まずFat Controllerを避け、次にFat Modelを避ける。
  • Serviceクラスの乱用を避ける。
  • controller concernを作ろうとしたらPORO(Plain Old Ruby Object)やActiveRecordモデルでの実装で代替できないか検討する。

Rails Patterns

  • ViewHelperにメソッドを実装する時にはまずDecoratorパターンを使うことを検討する。(active_decorator gemを導入しているのでそれを使う)
  • 複雑なActiveRecordクエリがあり、再利用できそうな場合はQueryObjectパターンを検討する。(rails-patterns gemを導入しているのでそれのQuery機能を使う)
  • Viewにpartialを作る場合はViewComponentを使うことを検討する。
  • 複数のActiveRecordモデルを操作する1つの責務がある時や外部APIとやりとりする処理がある場合にはInteractorオブジェクトパターンを検討する。(interactor gemを導入しているのでそれを使う)
  • 複数のInteractorを実行するような処理がある場合Organizerオブジェクトパターンを検討する。(interactor gemを導入しており、その中にOrganizerの機能があるので使う)

Files:

  • app/helpers/practices_helper.rb
🧠 Learnings (8)
📓 Common learnings
Learnt from: ryufuta
PR: fjordllc/bootcamp#8992
File: app/models/correct_answer_notifier.rb:23-23
Timestamp: 2025-07-30T07:26:36.599Z
Learning: PRのスコープを維持することが重要であり、バグ修正PRにおいて、修正対象以外の機能(例:ルーティングテスト)の追加提案は適切ではない。そのような改善が必要な場合は別PRで対応すべきである。
Learnt from: tyrrell-IH
PR: fjordllc/bootcamp#8807
File: app/views/welcome/job_support.html.slim:391-392
Timestamp: 2025-06-21T22:30:20.116Z
Learning: このプロジェクトにはRailsの組み込みmarkdownヘルパが利用できないため、markdownのHTML変換には自前でヘルパを実装する必要がある。
Learnt from: jun-kondo
PR: fjordllc/bootcamp#0
File: :0-0
Timestamp: 2025-07-23T20:42:19.974Z
Learning: fjordllc/bootcampプロジェクトでは、hタグ(見出し)の文言は日本語でハードコーディングする方針が確立されており、I18n対応は行わない。例:app/views/welcome/logo.html.slimでh2、h3タグが日本語でハードコーディングされている。
📚 Learning: モデルテストにおいて、1つのクラスメソッドの複数の挙動を検証する場合、機能の異なる側面を同じテストメソッドでテストすることは、包括的なテストとして適切である。特に`only_me`のような機能では、異...
Learnt from: kitarou888
PR: fjordllc/bootcamp#8277
File: test/models/searcher_test.rb:326-331
Timestamp: 2025-07-10T12:59:27.807Z
Learning: モデルテストにおいて、1つのクラスメソッドの複数の挙動を検証する場合、機能の異なる側面を同じテストメソッドでテストすることは、包括的なテストとして適切である。特に`only_me`のような機能では、異なる検索条件(空文字と具体的な検索語)を使い分けることで、より広範囲な動作保証が可能となる。

Applied to files:

  • app/views/practices/_summary.html.slim
📚 Learning: fjordllc/bootcampプロジェクトでは、hタグ(見出し)の文言は日本語でハードコーディングする方針が確立されており、i18n対応は行わない。例:app/views/welcome/logo...
Learnt from: jun-kondo
PR: fjordllc/bootcamp#0
File: :0-0
Timestamp: 2025-07-23T20:42:19.974Z
Learning: fjordllc/bootcampプロジェクトでは、hタグ(見出し)の文言は日本語でハードコーディングする方針が確立されており、I18n対応は行わない。例:app/views/welcome/logo.html.slimでh2、h3タグが日本語でハードコーディングされている。

Applied to files:

  • app/views/practices/_summary.html.slim
📚 Learning: fjordllc/bootcampプロジェクトでは、fixtureファイル内のerb構文で改行制御文字(-)は使用せず、標準的な<% %>と<%= %>のみを使用する方針が統一されている。<% -%>...
Learnt from: su-su-su-su
PR: fjordllc/bootcamp#0
File: :0-0
Timestamp: 2025-07-07T05:28:03.676Z
Learning: fjordllc/bootcampプロジェクトでは、fixtureファイル内のERB構文で改行制御文字(-)は使用せず、標準的な<% %>と<%= %>のみを使用する方針が統一されている。<% -%>や<%- %>を使用するとSyntaxErrorが発生する。

Applied to files:

  • app/views/practices/_summary.html.slim
📚 Learning: このプロジェクト(fjordllc/bootcamp)では、ja.ymlファイルで一部の単語や文章のみi18n対応されているが、多くのテキストは日本語でハードコーディングされており、完全な国際化対応は...
Learnt from: hirokiej
PR: fjordllc/bootcamp#8740
File: app/helpers/reports_helper.rb:56-64
Timestamp: 2025-06-29T03:44:15.179Z
Learning: このプロジェクト(fjordllc/bootcamp)では、ja.ymlファイルで一部の単語や文章のみI18n対応されているが、多くのテキストは日本語でハードコーディングされており、完全な国際化対応は行われていない。新しい機能でもI18n対応は不要と判断される。

Applied to files:

  • app/views/practices/_summary.html.slim
📚 Learning: fjordllc/bootcampプロジェクトでは、rubyの述語メソッドには?を付ける命名規則(例: can_be_checker?)を徹底している。...
Learnt from: su-su-su-su
PR: fjordllc/bootcamp#0
File: :0-0
Timestamp: 2025-07-26T15:24:14.799Z
Learning: fjordllc/bootcampプロジェクトでは、Rubyの述語メソッドには?を付ける命名規則(例: can_be_checker?)を徹底している。

Applied to files:

  • app/views/practices/_summary.html.slim
📚 Learning: prのスコープを維持することが重要であり、バグ修正prにおいて、修正対象以外の機能(例:ルーティングテスト)の追加提案は適切ではない。そのような改善が必要な場合は別prで対応すべきである。...
Learnt from: ryufuta
PR: fjordllc/bootcamp#8992
File: app/models/correct_answer_notifier.rb:23-23
Timestamp: 2025-07-30T07:26:36.599Z
Learning: PRのスコープを維持することが重要であり、バグ修正PRにおいて、修正対象以外の機能(例:ルーティングテスト)の追加提案は適切ではない。そのような改善が必要な場合は別PRで対応すべきである。

Applied to files:

  • app/views/practices/_summary.html.slim
📚 Learning: このプロジェクトにはrailsの組み込みmarkdownヘルパが利用できないため、markdownのhtml変換には自前でヘルパを実装する必要がある。...
Learnt from: tyrrell-IH
PR: fjordllc/bootcamp#8807
File: app/views/welcome/job_support.html.slim:391-392
Timestamp: 2025-06-21T22:30:20.116Z
Learning: このプロジェクトにはRailsの組み込みmarkdownヘルパが利用できないため、markdownのHTML変換には自前でヘルパを実装する必要がある。

Applied to files:

  • app/views/practices/_summary.html.slim
  • app/views/mentor/practices/_form.html.slim
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build_and_test
🔇 Additional comments (3)
app/helpers/practices_helper.rb (1)

4-4: 定数定義が適切です

OGP画像サイズの定数化により、複数箇所での値の重複を解消し、保守性が向上しています。freezeによる不変性の確保も適切です。

app/views/practices/_summary.html.slim (1)

8-8: ヘルパーメソッドへのリファクタリングが適切です

直接的なimage_tagの呼び出しをpractice_ogp_image_tagヘルパーメソッドに置き換えることで、OGP画像処理のロジックが一元化され、保守性が向上しています。

app/views/practices/unauthorized_show.slim (1)

20-20: ヘルパーメソッドへのリファクタリングが適切です

直接的な画像表示処理をpractice_ogp_image_tagヘルパーメソッドに置き換えることで、OGP画像処理のロジックが一元化され、保守性が向上しています。

reckyy added a commit that referenced this pull request Aug 10, 2025
reckyy added a commit that referenced this pull request Aug 10, 2025
reckyy added a commit that referenced this pull request Aug 13, 2025
reckyy added a commit that referenced this pull request Aug 13, 2025
@reckyy reckyy force-pushed the chore/constantize-size-of-ogp-image-in-practice branch from 67d0ebd to 728a145 Compare August 13, 2025 13:34
@reckyy reckyy force-pushed the chore/constantize-size-of-ogp-image-in-practice branch from 728a145 to f3bd4ad Compare August 20, 2025 11:30
@reckyy
Copy link
Copy Markdown
Contributor Author

reckyy commented Aug 25, 2025

@komagata
お待たせしております。
対応に時間を要してしまい、申し訳ございません。
#8569 (comment) の件、共通化が完了しましたので再度ご確認いただけますと幸いです。

Copy link
Copy Markdown
Member

@komagata komagata left a comment

Choose a reason for hiding this comment

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

確認させて頂きました。OKです〜🙆‍♂️

p
| ここにアップロードした画像が、X(Twitter)、Facebook で投稿した際に表示される画像として使われます。
| 画像サイズは必ず 1200px × 630xp でお願いします
| 画像サイズが #{PracticesHelper::OGP_SIZE[0]}px x #{PracticesHelper::OGP_SIZE[1]}px でない場合は、アスペクト比を維持してリサイズし、必要に応じて中央部分を切り取って #{PracticesHelper::OGP_SIZE[0]}px x #{PracticesHelper::OGP_SIZE[1]}px に調整します
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@komagata komagata merged commit 8eecbee into main Aug 25, 2025
30 checks passed
@komagata komagata deleted the chore/constantize-size-of-ogp-image-in-practice branch August 25, 2025 20:15
@github-actions github-actions bot mentioned this pull request Aug 25, 2025
24 tasks
@reckyy
Copy link
Copy Markdown
Contributor Author

reckyy commented Aug 29, 2025

@komagata @machida

お疲れさまです。
以下の内容をステージング環境で確認しました。

  • ログイン状態で、プラクティスページに設定したOGP画像が1200×630にリサイズされて表示されていること
  • 非ログイン状態も同様にリサイズ後の画像が表示されることを確認

ただ、Twitter, Facebook上での見栄えについては、ステージングが外部公開されていないため現時点では確認できていません。
本番リリース後に改めて確認する予定です。

この内容でチェックを付けても問題ないか、ご確認いただけますでしょうか。

@machida
Copy link
Copy Markdown
Member

machida commented Aug 29, 2025

@reckyy 質問ありがとうございます!!こちら、僕の方で本番で試したいと思います。本番で確認したら連絡しますー

sharoa119 pushed a commit that referenced this pull request Sep 8, 2025
sharoa119 pushed a commit that referenced this pull request Sep 8, 2025
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.

4 participants