diff options
author | Takeshi Umeda <noel.yoshiba@gmail.com> | 2019-09-21 16:11:21 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2019-09-21 09:11:21 +0200 |
commit | f497d14b19ce150ee19e6478c9018833e28c7d52 (patch) | |
tree | 7c15a47c7a9ae346784a8fffa04f1ee30600d583 /app/models | |
parent | e35636a0d16f3154970d71a305574e59fa2ad393 (diff) |
Addition of update activity distribution by alias, minor correction (#11905)
* Addition of update activity distribution by alias, minor correction * Distribute Update activity after adding alias * Add uniqueness verification to alias uri * accept acct starting with @ * fix double-quoted to single-quoted
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/account_alias.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/account_alias.rb b/app/models/account_alias.rb index e9a0dd79e..66f8ce409 100644 --- a/app/models/account_alias.rb +++ b/app/models/account_alias.rb @@ -17,11 +17,17 @@ class AccountAlias < ApplicationRecord validates :acct, presence: true, domain: { acct: true } validates :uri, presence: true + validates :uri, uniqueness: { scope: :account_id } before_validation :set_uri after_create :add_to_account after_destroy :remove_from_account + def acct=(val) + val = val.to_s.strip + super(val.start_with?('@') ? val[1..-1] : val) + end + private def set_uri |