Make nostr pubkey unique globally

This commit is contained in:
Râu Cao 2023-03-11 12:17:55 +07:00
parent 9cf309aaa8
commit beaafa5d7e
Signed by: raucao
GPG Key ID: 15E65F399D084BA9

View File

@ -36,7 +36,7 @@ class User < ApplicationRecord
validates_length_of :display_name, minimum: 3, maximum: 35, allow_blank: true, validates_length_of :display_name, minimum: 3, maximum: 35, allow_blank: true,
if: -> { defined?(@display_name) } if: -> { defined?(@display_name) }
validates_uniqueness_of :nostr_pubkey, scope: :ou, allow_blank: true validates_uniqueness_of :nostr_pubkey, allow_blank: true
scope :confirmed, -> { where.not(confirmed_at: nil) } scope :confirmed, -> { where.not(confirmed_at: nil) }
scope :pending, -> { where(confirmed_at: nil) } scope :pending, -> { where(confirmed_at: nil) }