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
e8d1aefe
Commit
e8d1aefe
authored
Aug 24, 2020
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add timezone information to the reviewer roulette
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
42b06da0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
37 deletions
+26
-37
danger/roulette/Dangerfile
danger/roulette/Dangerfile
+1
-1
lib/gitlab/danger/teammate.rb
lib/gitlab/danger/teammate.rb
+1
-3
spec/lib/gitlab/danger/teammate_spec.rb
spec/lib/gitlab/danger/teammate_spec.rb
+24
-33
No files found.
danger/roulette/Dangerfile
View file @
e8d1aefe
...
...
@@ -56,7 +56,7 @@ def note_for_spin_role(spin, role)
return
OPTIONAL_REVIEW_TEMPLATE
%
{
role:
role
.
capitalize
,
category:
helper
.
label_for_category
(
spin
.
category
)
}
end
spin
.
public_send
(
role
)
&
.
markdown_name
(
timezone_experiment:
spin
.
timezone_experiment
,
author:
roulette
.
team_mr_author
)
# rubocop:disable GitlabSecurity/PublicSend
spin
.
public_send
(
role
)
&
.
markdown_name
(
author:
roulette
.
team_mr_author
)
# rubocop:disable GitlabSecurity/PublicSend
end
def
markdown_row_for_spins
(
category
,
spins_array
)
...
...
lib/gitlab/danger/teammate.rb
View file @
e8d1aefe
...
...
@@ -45,9 +45,7 @@ module Gitlab
has_capability?
(
project
,
category
,
:maintainer
,
labels
)
end
def
markdown_name
(
timezone_experiment:
false
,
author:
nil
)
return
@markdown_name
unless
timezone_experiment
def
markdown_name
(
author:
nil
)
"
#{
@markdown_name
}
(
#{
utc_offset_text
(
author
)
}
)"
end
...
...
spec/lib/gitlab/danger/teammate_spec.rb
View file @
e8d1aefe
...
...
@@ -170,23 +170,15 @@ RSpec.describe Gitlab::Danger::Teammate do
end
describe
'#markdown_name'
do
context
'when timezone_experiment == false'
do
it
'returns markdown name as-is'
do
expect
(
subject
.
markdown_name
).
to
eq
(
options
[
'markdown_name'
])
expect
(
subject
.
markdown_name
(
timezone_experiment:
false
)).
to
eq
(
options
[
'markdown_name'
])
end
end
context
'when timezone_experiment == true'
do
it
'returns markdown name with timezone info'
do
expect
(
subject
.
markdown_name
(
timezone_experiment:
true
)
).
to
eq
(
"
#{
options
[
'markdown_name'
]
}
(UTC+2)"
)
expect
(
subject
.
markdown_name
).
to
eq
(
"
#{
options
[
'markdown_name'
]
}
(UTC+2)"
)
end
context
'when offset is 1.5'
do
let
(
:tz_offset_hours
)
{
1.5
}
it
'returns markdown name with timezone info, not truncated'
do
expect
(
subject
.
markdown_name
(
timezone_experiment:
true
)
).
to
eq
(
"
#{
options
[
'markdown_name'
]
}
(UTC+1.5)"
)
expect
(
subject
.
markdown_name
).
to
eq
(
"
#{
options
[
'markdown_name'
]
}
(UTC+1.5)"
)
end
end
...
...
@@ -209,8 +201,7 @@ RSpec.describe Gitlab::Danger::Teammate do
floored_offset_hours
=
subject
.
__send__
(
:floored_offset_hours
)
utc_offset
=
floored_offset_hours
>=
0
?
"+
#{
floored_offset_hours
}
"
:
floored_offset_hours
expect
(
subject
.
markdown_name
(
timezone_experiment:
true
,
author:
author
)).
to
eq
(
"
#{
options
[
'markdown_name'
]
}
(UTC
#{
utc_offset
}
,
#{
diff_text
}
)"
)
end
expect
(
subject
.
markdown_name
(
author:
author
)).
to
eq
(
"
#{
options
[
'markdown_name'
]
}
(UTC
#{
utc_offset
}
,
#{
diff_text
}
)"
)
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