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
a1b819eb
Commit
a1b819eb
authored
Jan 12, 2022
by
Justin Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix lint issue and rename helper method
parent
73ed4b9a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
ee/app/helpers/ee/integrations_helper.rb
ee/app/helpers/ee/integrations_helper.rb
+1
-1
ee/app/views/profiles/slacks/edit.html.haml
ee/app/views/profiles/slacks/edit.html.haml
+1
-1
ee/spec/helpers/ee/integrations_helper_spec.rb
ee/spec/helpers/ee/integrations_helper_spec.rb
+5
-5
No files found.
ee/app/helpers/ee/integrations_helper.rb
View file @
a1b819eb
...
@@ -34,7 +34,7 @@ module EE
...
@@ -34,7 +34,7 @@ module EE
"https://slack.com/oauth/authorize?scope=commands&client_id=
#{
slack_app_id
}
&redirect_uri=
#{
slack_auth_project_settings_slack_url
(
project
)
}
&state=
#{
escaped_form_authenticity_token
}
"
"https://slack.com/oauth/authorize?scope=commands&client_id=
#{
slack_app_id
}
&redirect_uri=
#{
slack_auth_project_settings_slack_url
(
project
)
}
&state=
#{
escaped_form_authenticity_token
}
"
end
end
def
add_to_slack
_data
(
projects
)
def
gitlab_slack_application
_data
(
projects
)
{
{
projects:
(
projects
||
[]).
map
{
|
p
|
serialize_project
(
p
)
}.
to_json
,
projects:
(
projects
||
[]).
map
{
|
p
|
serialize_project
(
p
)
}.
to_json
,
sign_in_path:
new_session_path
(
:user
,
redirect_to_referer:
'yes'
),
sign_in_path:
new_session_path
(
:user
,
redirect_to_referer:
'yes'
),
...
...
ee/app/views/profiles/slacks/edit.html.haml
View file @
a1b819eb
...
@@ -3,4 +3,4 @@
...
@@ -3,4 +3,4 @@
-
@content_class
=
'limit-container-width'
-
@content_class
=
'limit-container-width'
-
page_title
s_
(
'SlackIntegration|GitLab for Slack'
)
-
page_title
s_
(
'SlackIntegration|GitLab for Slack'
)
.js-gitlab-slack-application
{
data:
add_to_slack_data
(
@projects
)
}
.js-gitlab-slack-application
{
data:
gitlab_slack_application_data
(
@projects
)
}
ee/spec/helpers/ee/integrations_helper_spec.rb
View file @
a1b819eb
...
@@ -108,7 +108,7 @@ RSpec.describe EE::IntegrationsHelper do
...
@@ -108,7 +108,7 @@ RSpec.describe EE::IntegrationsHelper do
end
end
end
end
describe
'#
add_to_slack
_data'
do
describe
'#
gitlab_slack_application
_data'
do
let_it_be
(
:projects
)
{
create_list
(
:project
,
3
)
}
let_it_be
(
:projects
)
{
create_list
(
:project
,
3
)
}
def
relation
def
relation
...
@@ -132,7 +132,7 @@ RSpec.describe EE::IntegrationsHelper do
...
@@ -132,7 +132,7 @@ RSpec.describe EE::IntegrationsHelper do
end
end
it
'includes the required keys'
do
it
'includes the required keys'
do
additions
=
Gitlab
::
Json
.
parse
(
subject
.
add_to_slack_data
(
relation
)
)
additions
=
subject
.
gitlab_slack_application_data
(
relation
)
expect
(
additions
.
keys
).
to
match_array
%w[
expect
(
additions
.
keys
).
to
match_array
%w[
projects
projects
sign_in_path
sign_in_path
...
@@ -146,15 +146,15 @@ RSpec.describe EE::IntegrationsHelper do
...
@@ -146,15 +146,15 @@ RSpec.describe EE::IntegrationsHelper do
end
end
it
'does not suffer from N+1 performance issues'
do
it
'does not suffer from N+1 performance issues'
do
baseline
=
ActiveRecord
::
QueryRecorder
.
new
{
subject
.
add_to_slack
_data
(
relation
.
limit
(
1
))
}
baseline
=
ActiveRecord
::
QueryRecorder
.
new
{
subject
.
gitlab_slack_application
_data
(
relation
.
limit
(
1
))
}
expect
do
expect
do
subject
.
add_to_slack
_data
(
relation
)
subject
.
gitlab_slack_application
_data
(
relation
)
end
.
not_to
exceed_query_limit
(
baseline
)
end
.
not_to
exceed_query_limit
(
baseline
)
end
end
it
'serializes nil projects without error'
do
it
'serializes nil projects without error'
do
expect
(
subject
.
add_to_slack
_data
(
nil
)).
to
include
(
'"projects":null'
)
expect
(
subject
.
gitlab_slack_application
_data
(
nil
)).
to
include
(
'"projects":null'
)
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