]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/diary_comment.rb
Merge remote-tracking branch 'upstream/pull/4913'
[rails.git] / app / models / diary_comment.rb
index 8663212ebeef93a38dbd0ce7399f09e975ebfb04..a88c69f12ee3b3d8db208fa6405569e7dee5af15 100644 (file)
@@ -23,7 +23,7 @@
 #
 
 class DiaryComment < ApplicationRecord
-  belongs_to :user
+  belongs_to :user, :counter_cache => true
   belongs_to :diary_entry
 
   scope :visible, -> { where(:visible => true) }
@@ -42,7 +42,7 @@ class DiaryComment < ApplicationRecord
     sha256 << Rails.application.key_generator.generate_key("openstreetmap/diary_comment")
     sha256 << id.to_s
     sha256 << subscriber.to_s
-    sha256.base64digest[0, 8]
+    Base64.urlsafe_encode64(sha256.digest)[0, 8]
   end
 
   private