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
0a74ee3f
Commit
0a74ee3f
authored
Nov 22, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch Project, Group and User to display correct avatar from Primary node
parent
c07b2c04
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
55 additions
and
10 deletions
+55
-10
app/helpers/groups_helper.rb
app/helpers/groups_helper.rb
+1
-5
app/models/ee/group.rb
app/models/ee/group.rb
+16
-4
app/models/ee/project.rb
app/models/ee/project.rb
+16
-0
app/models/ee/user.rb
app/models/ee/user.rb
+15
-0
app/models/project.rb
app/models/project.rb
+1
-0
app/models/user.rb
app/models/user.rb
+1
-0
changelogs/unreleased-ee/geo-display-custom-avatars.yml
changelogs/unreleased-ee/geo-display-custom-avatars.yml
+4
-0
lib/ee/workers/project_cache_worker.rb
lib/ee/workers/project_cache_worker.rb
+1
-1
No files found.
app/helpers/groups_helper.rb
View file @
0a74ee3f
...
...
@@ -8,11 +8,7 @@ module GroupsHelper
group
=
Group
.
find_by
(
path:
group
)
end
if
group
&&
group
.
avatar
.
present?
group
.
avatar
.
url
else
image_path
(
'no_group_avatar.png'
)
end
group
.
try
(
:avatar_url
)
||
image_path
(
'no_group_avatar.png'
)
end
def
group_title
(
group
,
name
=
nil
,
url
=
nil
)
...
...
app/models/ee/group.rb
View file @
0a74ee3f
# Group EE mixin
#
# This module is intended to encapsulate EE-specific model logic
# and be included in the `Group` model
module
EE
# Group EE mixin
#
# This module is intended to encapsulate EE-specific model logic
# and be included in the `Group` model
module
Group
extend
ActiveSupport
::
Concern
included
do
prepend
GeoFeatures
state_machine
:ldap_sync_status
,
namespace: :ldap_sync
,
initial: :ready
do
state
:ready
state
:started
...
...
@@ -55,5 +57,15 @@ module EE
fail_ldap_sync
update_column
(
:ldap_sync_error
,
::
Gitlab
::
UrlSanitizer
.
sanitize
(
error_message
))
end
module
GeoFeatures
def
avatar_url
(
size
=
nil
)
if
self
[
:avatar
].
present?
&&
::
Gitlab
::
Geo
.
secondary?
File
.
join
(
::
Gitlab
::
Geo
.
primary_node
.
url
,
avatar
.
url
)
else
super
end
end
end
end
end
app/models/ee/project.rb
0 → 100644
View file @
0a74ee3f
module
EE
# Project EE mixin
#
# This module is intended to encapsulate EE-specific model logic
# and be **prepended** in the `Project` model
module
Project
# Display correct avatar in a secondary Geo node
def
avatar_url
if
self
[
:avatar
].
present?
&&
::
Gitlab
::
Geo
.
secondary?
File
.
join
(
::
Gitlab
::
Geo
.
primary_node
.
url
,
avatar
.
url
)
else
super
end
end
end
end
app/models/ee/user.rb
0 → 100644
View file @
0a74ee3f
module
EE
# User EE mixin
#
# This module is intended to encapsulate EE-specific model logic
# and be **prepended** in the `User` model
module
User
def
avatar_url
(
size
=
nil
,
scale
=
2
)
if
self
[
:avatar
].
present?
&&
::
Gitlab
::
Geo
.
secondary?
File
.
join
(
::
Gitlab
::
Geo
.
primary_node
.
url
,
avatar
.
url
)
else
super
end
end
end
end
app/models/project.rb
View file @
0a74ee3f
...
...
@@ -15,6 +15,7 @@ class Project < ActiveRecord::Base
include
Elastic
::
ProjectsSearch
include
ProjectFeaturesCompatibility
include
SelectForProjectAuthorization
prepend
EE
::
Project
extend
Gitlab
::
ConfigHelper
...
...
app/models/user.rb
View file @
0a74ee3f
...
...
@@ -9,6 +9,7 @@ class User < ActiveRecord::Base
include
Sortable
include
CaseSensitivity
include
TokenAuthenticatable
prepend
EE
::
User
DEFAULT_NOTIFICATION_LEVEL
=
:participating
...
...
changelogs/unreleased-ee/geo-display-custom-avatars.yml
0 → 100644
View file @
0a74ee3f
---
title
:
Geo
:
Display Custom Avatars in secondary nodes
merge_request
:
904
author
:
lib/ee/workers/project_cache_worker.rb
View file @
0a74ee3f
...
...
@@ -18,7 +18,7 @@ module EE
# Geo should only update Redis based cache, as data store in the database
# will be updated on primary and replicated to the secondaries.
def
perform_geo_secondary
(
project_id
,
refresh
=
[])
project
=
Project
.
find_by
(
id:
project_id
)
project
=
::
Project
.
find_by
(
id:
project_id
)
return
unless
project
&&
project
.
repository
.
exists?
...
...
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