Skip to content

Commit

Permalink
相談部屋のコメントを省いたコメント数を出力するようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryooo-k committed Nov 28, 2024
1 parent a34722a commit 15e74d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class User < ApplicationRecord
accepts_nested_attributes_for :discord_profile, allow_destroy: true
has_many :request_retirements, dependent: :destroy
has_one :targeted_request_retirement, class_name: 'RequestRetirement', foreign_key: 'target_user_id', dependent: :destroy, inverse_of: :target_user
has_many :filtered_comments, -> { where.not(commentable_type: 'Talk') }, class_name: 'Comment', dependent: :destroy, inverse_of: :user

has_many :participate_events,
through: :participations,
Expand Down
4 changes: 2 additions & 2 deletions app/views/users/_activity_counts.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ dl.card-counts__items
dt.card-counts__item-label
| コメント
dd.card-counts__item-value
= link_to_if !user.comments.empty?,
user.comments.size, user_comments_path(user)
= link_to_if !user.filtered_comments.empty?,
user.filtered_comments.size, user_comments_path(user)
.card-counts__item
.card-counts__item-inner
dt.card-counts__item-label
Expand Down

0 comments on commit 15e74d3

Please sign in to comment.