Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
97857063
Commit
97857063
authored
Dec 16, 2019
by
John Yao
Browse files
MDL-67524 book: fixing view hidden chapter issue
* Users who has permission should be able to view after turning editing off
parent
7850f76a
Changes
2
Hide whitespace changes
Inline
Side-by-side
mod/book/tests/behat/show_hide_chapters.feature
View file @
97857063
...
...
@@ -58,11 +58,6 @@ Feature: Book activity chapter visibility management
And
I follow
"Test book"
Then
the
"class"
attribute of
"a[title='Second chapter']"
"css_element"
should contain
"dimmed_text"
And
the
"class"
attribute of
"a[title='Third chapter']"
"css_element"
should contain
"dimmed_text"
And
I follow
"Next"
And
I should see
"Fourth chapter"
in the
".book_content"
"css_element"
And
I follow
"Exit book"
And
I follow
"Test book"
And
I should see
"First chapter"
in the
".book_content"
"css_element"
And
I turn editing mode on
And
I follow
"Next"
And
I should see
"Second chapter"
in the
".book_content"
"css_element"
...
...
@@ -80,3 +75,8 @@ Feature: Book activity chapter visibility management
And
I follow
"Test book"
And
I should not see
"Second chapter"
in the
"Table of contents"
"block"
And
I should not see
"Third chapter"
in the
"Table of contents"
"block"
And
I follow
"Next"
And
I should see
"Fourth chapter"
in the
".book_content"
"css_element"
And
I follow
"Exit book"
And
I follow
"Test book"
And
I should see
"First chapter"
in the
".book_content"
"css_element"
mod/book/view.php
View file @
97857063
...
...
@@ -80,7 +80,7 @@ if ($chapterid == '0') { // Go to first chapter if no given.
book_view
(
$book
,
null
,
false
,
$course
,
$cm
,
$context
);
foreach
(
$chapters
as
$ch
)
{
if
(
$edit
)
{
if
(
$edit
||
(
$ch
->
hidden
&&
$viewhidden
)
)
{
$chapterid
=
$ch
->
id
;
break
;
}
...
...
@@ -132,7 +132,7 @@ $nexttitle = null;
$navnexttitle
=
null
;
$last
=
null
;
foreach
(
$chapters
as
$ch
)
{
if
(
!
$edit
and
$ch
->
hidden
)
{
if
(
!
$edit
and
(
$ch
->
hidden
&&
!
$viewhidden
)
)
{
continue
;
}
if
(
$last
==
$chapter
->
id
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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