Browse Source

Fix comments not expiring cache

pull/48/head
Stephen 4 months ago
parent
commit
7fffef8a14
3 changed files with 8 additions and 4 deletions
  1. +3
    -1
      Gemfile
  2. +3
    -1
      Gemfile.lock
  3. +2
    -2
      app/models/comment.rb

+ 3
- 1
Gemfile View File

@ -78,4 +78,6 @@ gem 'rails-controller-testing'
gem 'simple_captcha2', require: 'simple_captcha'
gem 'uglifier'
gem 'uglifier'
gem 'dalli'

+ 3
- 1
Gemfile.lock View File

@ -86,6 +86,7 @@ GEM
ruby-enum (~> 0.5)
concurrent-ruby (1.1.5)
crass (1.0.4)
dalli (2.7.11)
docile (1.3.2)
email_validator (2.0.1)
activemodel
@ -257,6 +258,7 @@ DEPENDENCIES
carrierwave
coderay
commonmarker
dalli
email_validator
github-markup
irb
@ -284,7 +286,7 @@ DEPENDENCIES
webpacker (~> 4.0)
RUBY VERSION
ruby 2.6.3p62
ruby 2.6.4p104
BUNDLED WITH
2.0.2

+ 2
- 2
app/models/comment.rb View File

@ -4,11 +4,11 @@ require 'github/markup'
class Comment < ApplicationRecord
belongs_to :user
belongs_to :parent, class_name: "Comment", optional: true
belongs_to :post
belongs_to :post, touch: true
has_many :replies, class_name: "Comment", foreign_key: :parent_id
def editable_by?(user)
# Will need to consider how this should work when/if comment editing is supported
return self.user_id == user.id || user.admin? || self.post.blog.user_id == user.id
self.user_id == user.id || user.admin? || self.post.blog.user_id == user.id
end
end

Loading…
Cancel
Save