X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/45487e1ff8e7d334792440a2b5b3b1067269bfaf..3e69a4512f2d1b39f48719882a0d112d042da73a:/app/models/message.rb diff --git a/app/models/message.rb b/app/models/message.rb index 49c11e900..7c12769d3 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -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