Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4e7c0c92
Commit
4e7c0c92
authored
Dec 20, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove EE::GeoAwareAvatar
It was a very old decision when we didn’t have attachments sync.
parent
15bdf636
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
0 additions
and
91 deletions
+0
-91
app/models/group.rb
app/models/group.rb
+0
-1
app/models/user.rb
app/models/user.rb
+0
-1
ee/app/models/ee/geo_aware_avatar.rb
ee/app/models/ee/geo_aware_avatar.rb
+0
-15
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+0
-1
spec/helpers/groups_helper_spec.rb
spec/helpers/groups_helper_spec.rb
+0
-21
spec/models/group_spec.rb
spec/models/group_spec.rb
+0
-20
spec/models/project_spec.rb
spec/models/project_spec.rb
+0
-12
spec/models/user_spec.rb
spec/models/user_spec.rb
+0
-20
No files found.
app/models/group.rb
View file @
4e7c0c92
...
@@ -12,7 +12,6 @@ class Group < Namespace
...
@@ -12,7 +12,6 @@ class Group < Namespace
include
SelectForProjectAuthorization
include
SelectForProjectAuthorization
include
LoadedInGroupList
include
LoadedInGroupList
include
GroupDescendant
include
GroupDescendant
prepend
EE
::
GeoAwareAvatar
has_many
:group_members
,
->
{
where
(
requested_at:
nil
)
},
dependent: :destroy
,
as: :source
# rubocop:disable Cop/ActiveRecordDependent
has_many
:group_members
,
->
{
where
(
requested_at:
nil
)
},
dependent: :destroy
,
as: :source
# rubocop:disable Cop/ActiveRecordDependent
alias_method
:members
,
:group_members
alias_method
:members
,
:group_members
...
...
app/models/user.rb
View file @
4e7c0c92
...
@@ -20,7 +20,6 @@ class User < ActiveRecord::Base
...
@@ -20,7 +20,6 @@ class User < ActiveRecord::Base
include
BulkMemberAccessLoad
include
BulkMemberAccessLoad
include
BlocksJsonSerialization
include
BlocksJsonSerialization
prepend
EE
::
GeoAwareAvatar
prepend
EE
::
User
prepend
EE
::
User
DEFAULT_NOTIFICATION_LEVEL
=
:participating
DEFAULT_NOTIFICATION_LEVEL
=
:participating
...
...
ee/app/models/ee/geo_aware_avatar.rb
deleted
100644 → 0
View file @
15bdf636
module
EE
# Avatars in Geo mixin
#
# This module is intended to encapsulate Geo-specific logic
# and be **prepended** in the `Group`, `User`, `Project` models
module
GeoAwareAvatar
def
avatar_url
(
**
args
)
if
::
Gitlab
::
Geo
.
secondary?
&&
self
[
:avatar
].
present?
File
.
join
(
::
Gitlab
::
Geo
.
primary_node
.
url
,
avatar
.
url
)
else
super
end
end
end
end
ee/app/models/ee/project.rb
View file @
4e7c0c92
...
@@ -9,7 +9,6 @@ module EE
...
@@ -9,7 +9,6 @@ module EE
prepended
do
prepended
do
include
Elastic
::
ProjectsSearch
include
Elastic
::
ProjectsSearch
prepend
GeoAwareAvatar
prepend
ImportStatusStateMachine
prepend
ImportStatusStateMachine
before_validation
:mark_remote_mirrors_for_removal
before_validation
:mark_remote_mirrors_for_removal
...
...
spec/helpers/groups_helper_spec.rb
View file @
4e7c0c92
...
@@ -32,27 +32,6 @@ describe GroupsHelper do
...
@@ -32,27 +32,6 @@ describe GroupsHelper do
group
.
save!
group
.
save!
expect
(
group_icon_url
(
group
.
path
)).
to
match_asset_path
(
'group_avatar.png'
)
expect
(
group_icon_url
(
group
.
path
)).
to
match_asset_path
(
'group_avatar.png'
)
end
end
context
'in a geo secondary node'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:geo_url
)
{
'http://geo.example.com'
}
before
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
true
}
allow
(
Gitlab
::
Geo
).
to
receive_message_chain
(
:primary_node
,
:url
)
{
geo_url
}
end
it
'returns an url for the avatar pointing to the primary node base url'
do
group
.
avatar
=
fixture_file_upload
(
avatar_file_path
)
group
.
save!
expect
(
group_icon_url
(
group
.
path
)).
to
match
(
"
#{
geo_url
}
/uploads/-/system/group/avatar/
#{
group
.
id
}
/banana_sample.gif"
)
end
it
'gives default avatar_icon when no avatar is present'
do
group
.
save!
expect
(
group_icon_url
(
group
.
path
)).
to
match_asset_path
(
'no_group_avatar.png'
)
end
end
end
end
describe
'group_lfs_status'
do
describe
'group_lfs_status'
do
...
...
spec/models/group_spec.rb
View file @
4e7c0c92
...
@@ -258,26 +258,6 @@ describe Group do
...
@@ -258,26 +258,6 @@ describe Group do
expect
(
group
.
avatar_url
).
to
eq
(
group
.
avatar
.
url
)
expect
(
group
.
avatar_url
).
to
eq
(
group
.
avatar
.
url
)
expect
(
group
.
avatar_url
(
only_path:
false
)).
to
eq
([
Gitlab
.
config
.
gitlab
.
url
,
group
.
avatar
.
url
].
join
)
expect
(
group
.
avatar_url
(
only_path:
false
)).
to
eq
([
Gitlab
.
config
.
gitlab
.
url
,
group
.
avatar
.
url
].
join
)
end
end
context
'when in a geo secondary node'
do
let
(
:avatar_path
)
{
group
.
avatar_path
(
only_path:
true
)
}
let
(
:geo_host
)
{
'http://geo.example.com'
}
let
(
:geo_avatar_url
)
{
[
geo_host
,
avatar_path
].
join
}
before
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
true
}
allow
(
Gitlab
::
Geo
).
to
receive_message_chain
(
:primary_node
,
:url
)
{
geo_host
}
end
it
'shows correct avatar url'
do
expect
(
group
.
avatar_url
).
to
eq
(
geo_avatar_url
)
expect
(
group
.
avatar_url
(
only_path:
false
)).
to
eq
(
geo_avatar_url
)
allow
(
ActionController
::
Base
).
to
receive
(
:asset_host
).
and_return
(
geo_host
)
expect
(
group
.
avatar_url
).
to
eq
(
geo_avatar_url
)
end
end
end
end
end
end
...
...
spec/models/project_spec.rb
View file @
4e7c0c92
...
@@ -1047,18 +1047,6 @@ describe Project do
...
@@ -1047,18 +1047,6 @@ describe Project do
expect
(
project
.
avatar_url
).
to
eq
(
project
.
avatar
.
url
)
expect
(
project
.
avatar_url
).
to
eq
(
project
.
avatar
.
url
)
expect
(
project
.
avatar_url
(
only_path:
false
)).
to
eq
([
Gitlab
.
config
.
gitlab
.
url
,
project
.
avatar
.
url
].
join
)
expect
(
project
.
avatar_url
(
only_path:
false
)).
to
eq
([
Gitlab
.
config
.
gitlab
.
url
,
project
.
avatar
.
url
].
join
)
end
end
context
'When in a geo secondary node'
do
let
(
:geo_url
)
{
'http://geo.example.com'
}
let
(
:avatar_path
)
{
project
.
avatar_path
(
only_path:
true
)
}
before
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
true
}
allow
(
Gitlab
::
Geo
).
to
receive_message_chain
(
:primary_node
,
:url
)
{
geo_url
}
end
it
{
is_expected
.
to
eq
"
#{
geo_url
}#{
avatar_path
}
"
}
end
end
end
context
'when avatar file in git'
do
context
'when avatar file in git'
do
...
...
spec/models/user_spec.rb
View file @
4e7c0c92
...
@@ -1191,26 +1191,6 @@ describe User do
...
@@ -1191,26 +1191,6 @@ describe User do
expect
(
user
.
avatar_url
).
to
eq
(
user
.
avatar
.
url
)
expect
(
user
.
avatar_url
).
to
eq
(
user
.
avatar
.
url
)
expect
(
user
.
avatar_url
(
only_path:
false
)).
to
eq
([
Gitlab
.
config
.
gitlab
.
url
,
user
.
avatar
.
url
].
join
)
expect
(
user
.
avatar_url
(
only_path:
false
)).
to
eq
([
Gitlab
.
config
.
gitlab
.
url
,
user
.
avatar
.
url
].
join
)
end
end
context
'when in a geo secondary node'
do
let
(
:avatar_path
)
{
user
.
avatar_path
(
only_path:
true
)
}
let
(
:geo_host
)
{
'http://geo.example.com'
}
let
(
:geo_avatar_url
)
{
[
geo_host
,
avatar_path
].
join
}
before
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
true
}
allow
(
Gitlab
::
Geo
).
to
receive_message_chain
(
:primary_node
,
:url
)
{
geo_host
}
end
it
'shows correct avatar url'
do
expect
(
user
.
avatar_url
).
to
eq
(
geo_avatar_url
)
expect
(
user
.
avatar_url
(
only_path:
false
)).
to
eq
(
geo_avatar_url
)
allow
(
ActionController
::
Base
).
to
receive
(
:asset_host
).
and_return
(
geo_host
)
expect
(
user
.
avatar_url
).
to
eq
(
geo_avatar_url
)
end
end
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment