Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
abf6c87e
Unverified
Commit
abf6c87e
authored
2 years ago
by
Eugen Rochko
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix remote account in contact account setting not being used (#19351)
parent
c60f9cb8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/presenters/instance_presenter.rb
+3
-1
3 additions, 1 deletion
app/presenters/instance_presenter.rb
app/validators/existing_username_validator.rb
+3
-3
3 additions, 3 deletions
app/validators/existing_username_validator.rb
with
6 additions
and
4 deletions
app/presenters/instance_presenter.rb
+
3
−
1
View file @
abf6c87e
...
...
@@ -12,7 +12,9 @@ class InstancePresenter < ActiveModelSerializers::Model
end
def
account
Account
.
find_local
(
Setting
.
site_contact_username
.
strip
.
gsub
(
/\A@/
,
''
))
username
,
domain
=
Setting
.
site_contact_username
.
strip
.
gsub
(
/\A@/
,
''
).
split
(
'@'
,
2
)
domain
=
nil
if
TagManager
.
instance
.
local_domain?
(
domain
)
Account
.
find_remote
(
username
,
domain
)
if
username
.
present?
end
end
...
...
This diff is collapsed.
Click to expand it.
app/validators/existing_username_validator.rb
+
3
−
3
View file @
abf6c87e
...
...
@@ -6,7 +6,7 @@ class ExistingUsernameValidator < ActiveModel::EachValidator
usernames_and_domains
=
begin
value
.
split
(
','
).
map
do
|
str
|
username
,
domain
=
str
.
strip
.
gsub
(
/\A@/
,
''
).
split
(
'@'
)
username
,
domain
=
str
.
strip
.
gsub
(
/\A@/
,
''
).
split
(
'@'
,
2
)
domain
=
nil
if
TagManager
.
instance
.
local_domain?
(
domain
)
next
if
username
.
blank?
...
...
@@ -21,8 +21,8 @@ class ExistingUsernameValidator < ActiveModel::EachValidator
if
options
[
:multiple
]
record
.
errors
.
add
(
attribute
,
I18n
.
t
(
'existing_username_validator.not_found_multiple'
,
usernames:
usernames_with_no_accounts
.
join
(
', '
)))
if
usernames_with_no_accounts
.
any?
els
e
record
.
errors
.
add
(
attribute
,
I18n
.
t
(
'existing_username_validator.not_found'
))
if
usernames_with_no_accounts
.
any?
||
usernames_and_domains
.
size
>
1
els
if
usernames_with_no_accounts
.
any?
||
usernames_and_domains
.
size
>
1
record
.
errors
.
add
(
attribute
,
I18n
.
t
(
'existing_username_validator.not_found'
))
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment