]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/message.rb
Merge remote-tracking branch 'upstream/pull/4367'
[rails.git] / app / models / message.rb
index 49c11e900898923beb558d78d8d2b6e35845a158..7c12769d3a3e39f081caeb16dd0417a858a0ddc2 100644 (file)
@@ -59,13 +59,10 @@ class Message < ApplicationRecord
     RichText.new(self[:body_format], self[:body])
   end
 
-  def digest
-    md5 = Digest::MD5.new
-    md5 << from_user_id.to_s
-    md5 << to_user_id.to_s
-    md5 << sent_on.xmlschema
-    md5 << title
-    md5 << body
-    md5.hexdigest
+  def notification_token
+    sha256 = Digest::SHA256.new
+    sha256 << Rails.application.key_generator.generate_key("openstreetmap/message")
+    sha256 << id.to_s
+    Base64.urlsafe_encode64(sha256.digest)[0, 8]
   end
 end