Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
fd5f95e5
Commit
fd5f95e5
authored
Jan 27, 2016
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show hidden follow-on questions when answer hidden
Fixes various issues with showing/hiding/AJAX operations.
parent
a9b44054
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
11 deletions
+17
-11
show-comments.php
qa-include/ajax/show-comments.php
+3
-1
question-view.php
qa-include/pages/question-view.php
+14
-10
No files found.
qa-include/ajax/show-comments.php
View file @
fd5f95e5
...
@@ -48,7 +48,9 @@
...
@@ -48,7 +48,9 @@
foreach
(
$children
as
$key
=>
$child
)
foreach
(
$children
as
$key
=>
$child
)
$children
[
$key
]
=
$child
+
qa_page_q_post_rules
(
$child
,
$parent
,
$children
,
null
);
$children
[
$key
]
=
$child
+
qa_page_q_post_rules
(
$child
,
$parent
,
$children
,
null
);
$commentsfollows
=
qa_page_q_load_c_follows
(
$question
,
$children
,
array
(),
$duplicateposts
);
$commentsfollows
=
$questionid
==
$parentid
?
qa_page_q_load_c_follows
(
$question
,
$children
,
array
(),
$duplicateposts
)
:
qa_page_q_load_c_follows
(
$question
,
array
(),
$children
);
$usershtml
=
qa_userids_handles_html
(
$commentsfollows
,
true
);
$usershtml
=
qa_userids_handles_html
(
$commentsfollows
,
true
);
...
...
qa-include/pages/question-view.php
View file @
fd5f95e5
...
@@ -49,27 +49,24 @@
...
@@ -49,27 +49,24 @@
function
qa_page_q_load_c_follows
(
$question
,
$childposts
,
$achildposts
,
$duplicateposts
=
array
())
function
qa_page_q_load_c_follows
(
$question
,
$childposts
,
$achildposts
,
$duplicateposts
=
array
())
/*
/*
Given a $question, its $childposts and its answers $achildposts from the database,
Given a $question, its $childposts and its answers $achildposts from the database,
return a list of comments or follow-on questions for that question or its answers
return a list of comments or follow-on questions for that question or its answers.
Follow-on and duplicate questions are now returned, with their visibility determined in qa_page_q_comment_follow_list()
*/
*/
{
{
$commentsfollows
=
array
();
$commentsfollows
=
array
();
foreach
(
$childposts
as
$postid
=>
$post
)
foreach
(
$childposts
as
$postid
=>
$post
)
switch
(
$post
[
'type'
])
{
switch
(
$post
[
'
base
type'
])
{
case
'Q'
:
// never show follow-on Qs which have been hidden, even to admins
case
'Q'
:
case
'C'
:
case
'C'
:
case
'C_HIDDEN'
:
case
'C_QUEUED'
:
$commentsfollows
[
$postid
]
=
$post
;
$commentsfollows
[
$postid
]
=
$post
;
break
;
break
;
}
}
foreach
(
$achildposts
as
$postid
=>
$post
)
foreach
(
$achildposts
as
$postid
=>
$post
)
switch
(
$post
[
'type'
])
{
switch
(
$post
[
'
base
type'
])
{
case
'Q'
:
// never show follow-on Qs which have been hidden, even to admins
case
'Q'
:
case
'C'
:
case
'C'
:
case
'C_HIDDEN'
:
case
'C_QUEUED'
:
$commentsfollows
[
$postid
]
=
$post
;
$commentsfollows
[
$postid
]
=
$post
;
break
;
break
;
}
}
...
@@ -691,9 +688,16 @@
...
@@ -691,9 +688,16 @@
$showcomments
=
array
();
$showcomments
=
array
();
// $commentsfollows contains ALL comments on the question and all answers, so here we filter the comments viewable for this context
foreach
(
$commentsfollows
as
$commentfollowid
=>
$commentfollow
)
{
foreach
(
$commentsfollows
as
$commentfollowid
=>
$commentfollow
)
{
$showcomment
=
$commentfollow
[
'parentid'
]
==
$parentid
&&
$commentfollow
[
'viewable'
]
&&
$commentfollowid
!=
$formpostid
;
$showcomment
=
$commentfollow
[
'parentid'
]
==
$parentid
&&
$commentfollow
[
'viewable'
]
&&
$commentfollowid
!=
$formpostid
;
$showduplicate
=
$question
[
'hidden'
]
&&
$commentfollow
[
'closedbyid'
]
==
$question
[
'postid'
];
// show hidden follow-on questions only if the parent is hidden
if
(
$showcomment
&&
$commentfollow
[
'basetype'
]
==
'Q'
&&
$commentfollow
[
'hidden'
])
{
$showcomment
=
$parent
[
'hidden'
];
}
// show questions closed as duplicate of this one, only if this question is hidden
$showduplicate
=
$question
[
'hidden'
]
&&
$commentfollow
[
'closedbyid'
]
==
$parentid
;
if
(
$showcomment
||
$showduplicate
)
{
if
(
$showcomment
||
$showduplicate
)
{
$showcomments
[
$commentfollowid
]
=
$commentfollow
;
$showcomments
[
$commentfollowid
]
=
$commentfollow
;
}
}
...
...
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