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
df3a42cc
Commit
df3a42cc
authored
Jul 09, 2020
by
Manoj M J
Committed by
Fabio Pitino
Jul 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add custom avatars for Alert and Support Bot
This change adds custom avatars for Alert and Support Bot.
parent
1f256b6c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
0 deletions
+25
-0
app/assets/images/bot_avatars/alert-bot.png
app/assets/images/bot_avatars/alert-bot.png
+0
-0
app/assets/images/bot_avatars/security-bot.png
app/assets/images/bot_avatars/security-bot.png
+0
-0
app/assets/images/bot_avatars/support-bot.png
app/assets/images/bot_avatars/support-bot.png
+0
-0
app/models/concerns/avatarable.rb
app/models/concerns/avatarable.rb
+6
-0
app/models/user.rb
app/models/user.rb
+2
-0
changelogs/unreleased/210523-visually-align-system-bots-alert-support-and-security.yml
...visually-align-system-bots-alert-support-and-security.yml
+5
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+12
-0
No files found.
app/assets/images/bot_avatars/alert-bot.png
0 → 100644
View file @
df3a42cc
9.14 KB
app/assets/images/bot_avatars/security-bot.png
0 → 100644
View file @
df3a42cc
9.34 KB
app/assets/images/bot_avatars/support-bot.png
0 → 100644
View file @
df3a42cc
9.58 KB
app/models/concerns/avatarable.rb
View file @
df3a42cc
...
...
@@ -36,6 +36,12 @@ module Avatarable
end
end
class_methods
do
def
bot_avatar
(
image
:)
Rails
.
root
.
join
(
'app'
,
'assets'
,
'images'
,
'bot_avatars'
,
image
).
open
end
end
def
avatar_type
unless
self
.
avatar
.
image?
errors
.
add
:avatar
,
"file format is not supported. Please try one of the following supported formats:
#{
AvatarUploader
::
SAFE_IMAGE_EXT
.
join
(
', '
)
}
"
...
...
app/models/user.rb
View file @
df3a42cc
...
...
@@ -642,6 +642,7 @@ class User < ApplicationRecord
unique_internal
(
where
(
user_type: :alert_bot
),
'alert-bot'
,
email_pattern
)
do
|
u
|
u
.
bio
=
'The GitLab alert bot'
u
.
name
=
'GitLab Alert Bot'
u
.
avatar
=
bot_avatar
(
image:
'alert-bot.png'
)
end
end
...
...
@@ -661,6 +662,7 @@ class User < ApplicationRecord
unique_internal
(
where
(
user_type: :support_bot
),
'support-bot'
,
email_pattern
)
do
|
u
|
u
.
bio
=
'The GitLab support bot used for Service Desk'
u
.
name
=
'GitLab Support Bot'
u
.
avatar
=
bot_avatar
(
image:
'support-bot.png'
)
end
end
...
...
changelogs/unreleased/210523-visually-align-system-bots-alert-support-and-security.yml
0 → 100644
View file @
df3a42cc
---
title
:
Add custom avatars for Alert and Support Bot
merge_request
:
36269
author
:
type
:
added
spec/models/user_spec.rb
View file @
df3a42cc
...
...
@@ -4781,9 +4781,21 @@ RSpec.describe User do
end
end
shared_examples
'bot user avatars'
do
|
bot_type
,
avatar_filename
|
it
'sets the custom avatar for the created bot'
do
bot_user
=
described_class
.
public_send
(
bot_type
)
expect
(
bot_user
.
avatar
.
url
).
to
be_present
expect
(
bot_user
.
avatar
.
filename
).
to
eq
(
avatar_filename
)
end
end
it_behaves_like
'bot users'
,
:alert_bot
it_behaves_like
'bot users'
,
:support_bot
it_behaves_like
'bot users'
,
:migration_bot
it_behaves_like
'bot users'
,
:ghost
it_behaves_like
'bot user avatars'
,
:alert_bot
,
'alert-bot.png'
it_behaves_like
'bot user avatars'
,
:support_bot
,
'support-bot.png'
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