Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
6eb559b9b241
Commit
6eb559b9
authored
Aug 26, 2016
by
Alejandro Rodríguez
Browse files
Fix "Wiki" link not appearing in navigation for projects with external wiki
parent
c276ea878f7d
Changes
5
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
6eb559b9
...
...
@@ -37,6 +37,7 @@
- Allow system info page to handle case where info is unavailable
- Label list shows all issues (opened or closed) with that label
- Don't show resolve conflicts link before MR status is updated
- Fix "Wiki" link not appearing in navigation for projects with external wiki
- Fix IE11 fork button bug !598
- Don't prevent viewing the MR when git refs for conflicts can't be found on disk
- Fix external issue tracker "Issues" link leading to 404s
...
...
app/models/ability.rb
View file @
6eb559b9
...
...
@@ -355,7 +355,7 @@
rules
+=
named_abilities
(
'project_snippet'
)
end
unless
project
.
wiki_enabled
unless
project
.
has_wiki?
rules
+=
named_abilities
(
'wiki'
)
end
...
...
app/models/project.rb
View file @
6eb559b9
...
...
@@ -680,6 +680,10 @@
update_column
(
:has_external_issue_tracker
,
services
.
external_issue_trackers
.
any?
)
end
def
has_wiki?
wiki_enabled?
||
has_external_wiki?
end
def
external_wiki
if
has_external_wiki
.
nil?
cache_has_external_wiki
# Populate
...
...
spec/models/ability_spec.rb
View file @
6eb559b9
...
...
@@ -282,4 +282,17 @@
end
end
end
describe
'.project_disabled_features_rules'
do
let
(
:project
)
{
build
(
:project
)
}
subject
{
described_class
.
project_disabled_features_rules
(
project
)
}
context
'wiki named abilities'
do
it
'disables wiki abilities if the project has no wiki'
do
expect
(
project
).
to
receive
(
:has_wiki?
).
and_return
(
false
)
expect
(
subject
).
to
include
(
:read_wiki
,
:create_wiki
,
:update_wiki
,
:admin_wiki
)
end
end
end
end
spec/models/project_spec.rb
View file @
6eb559b9
...
...
@@ -506,6 +506,18 @@
end
end
describe
'#has_wiki?'
do
let
(
:no_wiki_project
)
{
build
(
:project
,
wiki_enabled:
false
,
has_external_wiki:
false
)
}
let
(
:wiki_enabled_project
)
{
build
(
:project
,
wiki_enabled:
true
)
}
let
(
:external_wiki_project
)
{
build
(
:project
,
has_external_wiki:
true
)
}
it
'returns true if project is wiki enabled or has external wiki'
do
expect
(
wiki_enabled_project
).
to
have_wiki
expect
(
external_wiki_project
).
to
have_wiki
expect
(
no_wiki_project
).
not_to
have_wiki
end
end
describe
'#external_wiki'
do
let
(
:project
)
{
create
(
:project
)
}
...
...
Write
Preview
Supports
Markdown
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