Refactor domain block checks (#11268)
This commit is contained in:
parent
1e7187f2a8
commit
4e92183227
11 changed files with 108 additions and 51 deletions
|
@ -24,13 +24,16 @@ class TagManager
|
|||
|
||||
def same_acct?(canonical, needle)
|
||||
return true if canonical.casecmp(needle).zero?
|
||||
|
||||
username, domain = needle.split('@')
|
||||
|
||||
local_domain?(domain) && canonical.casecmp(username).zero?
|
||||
end
|
||||
|
||||
def local_url?(url)
|
||||
uri = Addressable::URI.parse(url).normalize
|
||||
domain = uri.host + (uri.port ? ":#{uri.port}" : '')
|
||||
|
||||
TagManager.instance.web_domain?(domain)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue