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
85a3357a
Commit
85a3357a
authored
May 26, 2021
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Gitpod url in user preferences
Changelog: fixed
parent
4696e416
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
1 deletion
+42
-1
app/helpers/preferences_helper.rb
app/helpers/preferences_helper.rb
+5
-1
spec/helpers/preferences_helper_spec.rb
spec/helpers/preferences_helper_spec.rb
+37
-0
No files found.
app/helpers/preferences_helper.rb
View file @
85a3357a
...
...
@@ -83,13 +83,17 @@ module PreferencesHelper
def
integration_views
[].
tap
do
|
views
|
views
<<
{
name:
'gitpod'
,
message:
gitpod_enable_description
,
message_url:
'https://gitpod.io/'
,
help_link:
help_page_path
(
'integration/gitpod.md'
)
}
if
Gitlab
::
CurrentSettings
.
gitpod_enabled
views
<<
{
name:
'gitpod'
,
message:
gitpod_enable_description
,
message_url:
gitpod_url_placeholder
,
help_link:
help_page_path
(
'integration/gitpod.md'
)
}
if
Gitlab
::
CurrentSettings
.
gitpod_enabled
views
<<
{
name:
'sourcegraph'
,
message:
sourcegraph_url_message
,
message_url:
Gitlab
::
CurrentSettings
.
sourcegraph_url
,
help_link:
help_page_path
(
'user/profile/preferences.md'
,
anchor:
'sourcegraph'
)
}
if
Gitlab
::
Sourcegraph
.
feature_available?
&&
Gitlab
::
CurrentSettings
.
sourcegraph_enabled
end
end
private
def
gitpod_url_placeholder
Gitlab
::
CurrentSettings
.
gitpod_url
.
presence
||
'https://gitpod.io/'
end
# Ensure that anyone adding new options updates `DASHBOARD_CHOICES` too
def
validate_dashboard_choices!
(
user_dashboards
)
if
user_dashboards
.
size
!=
localized_dashboard_choices
.
size
...
...
spec/helpers/preferences_helper_spec.rb
View file @
85a3357a
...
...
@@ -143,4 +143,41 @@ RSpec.describe PreferencesHelper do
.
and_return
(
double
(
'user'
,
messages
))
end
end
describe
'#integration_views'
do
let
(
:gitpod_url
)
{
'http://gitpod.test'
}
before
do
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:gitpod_enabled
).
and_return
(
gitpod_enabled
)
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:gitpod_url
).
and_return
(
gitpod_url
)
end
context
'when Gitpod is not enabled'
do
let
(
:gitpod_enabled
)
{
false
}
it
'does not include Gitpod integration'
do
expect
(
helper
.
integration_views
).
to
be_empty
end
end
context
'when Gitpod is enabled'
do
let
(
:gitpod_enabled
)
{
true
}
it
'includes Gitpod integration'
do
expect
(
helper
.
integration_views
[
0
][
:name
]).
to
eq
'gitpod'
end
it
'returns the Gitpod url configured in settings'
do
expect
(
helper
.
integration_views
[
0
][
:message_url
]).
to
eq
gitpod_url
end
context
'when Gitpod url is not set'
do
let
(
:gitpod_url
)
{
''
}
it
'returns the Gitpod default url'
do
expect
(
helper
.
integration_views
[
0
][
:message_url
]).
to
eq
'https://gitpod.io/'
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