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
e81b2ccf
Commit
e81b2ccf
authored
Jan 26, 2016
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fetch duplicate posts, add to question when hidden
parent
b7cb0a56
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
9 deletions
+26
-9
question-view.php
qa-include/pages/question-view.php
+22
-6
question.php
qa-include/pages/question.php
+4
-3
No files found.
qa-include/pages/question-view.php
View file @
e81b2ccf
...
...
@@ -46,7 +46,7 @@
}
function
qa_page_q_load_c_follows
(
$question
,
$childposts
,
$achildposts
)
function
qa_page_q_load_c_follows
(
$question
,
$childposts
,
$achildposts
,
$duplicateposts
=
array
()
)
/*
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
...
...
@@ -74,6 +74,10 @@
break
;
}
foreach
(
$duplicateposts
as
$postid
=>
$post
)
{
$commentsfollows
[
$postid
]
=
$post
;
}
return
$commentsfollows
;
}
...
...
@@ -185,9 +189,10 @@
// Now make any changes based on the child posts
if
(
isset
(
$childposts
))
foreach
(
$childposts
as
$childpost
)
if
(
isset
(
$childposts
))
{
foreach
(
$childposts
as
$childpost
)
{
if
(
$childpost
[
'parentid'
]
==
$post
[
'postid'
])
{
// this post has comments
$rules
[
'deleteable'
]
=
false
;
if
((
$childpost
[
'basetype'
]
==
'A'
)
&&
qa_post_is_by_user
(
$childpost
,
$userid
,
$cookieid
))
{
...
...
@@ -199,6 +204,13 @@
}
}
if
(
$childpost
[
'closedbyid'
]
==
$post
[
'postid'
])
{
// other questions are closed as duplicates of this one
$rules
[
'deleteable'
]
=
false
;
}
}
}
// Return the resulting rules
return
$rules
;
...
...
@@ -679,9 +691,13 @@
$showcomments
=
array
();
foreach
(
$commentsfollows
as
$commentfollowid
=>
$commentfollow
)
if
((
$commentfollow
[
'parentid'
]
==
$parentid
)
&&
$commentfollow
[
'viewable'
]
&&
(
$commentfollowid
!=
$formpostid
)
)
$showcomments
[
$commentfollowid
]
=
$commentfollow
;
foreach
(
$commentsfollows
as
$commentfollowid
=>
$commentfollow
)
{
$showcomment
=
$commentfollow
[
'parentid'
]
==
$parentid
&&
$commentfollow
[
'viewable'
]
&&
$commentfollowid
!=
$formpostid
;
$showduplicate
=
$question
[
'hidden'
]
&&
$commentfollow
[
'closedbyid'
]
==
$question
[
'postid'
];
if
(
$showcomment
||
$showduplicate
)
{
$showcomments
[
$commentfollowid
]
=
$commentfollow
;
}
}
$countshowcomments
=
count
(
$showcomments
);
...
...
qa-include/pages/question.php
View file @
e81b2ccf
...
...
@@ -41,12 +41,13 @@
// Get information about this question
list
(
$question
,
$childposts
,
$achildposts
,
$parentquestion
,
$closepost
,
$
extravalue
,
$categories
,
$favorite
)
=
qa_db_select_with_pending
(
list
(
$question
,
$childposts
,
$achildposts
,
$parentquestion
,
$closepost
,
$
duplicateposts
,
$extravalue
,
$categories
,
$favorite
)
=
qa_db_select_with_pending
(
qa_db_full_post_selectspec
(
$userid
,
$questionid
),
qa_db_full_child_posts_selectspec
(
$userid
,
$questionid
),
qa_db_full_a_child_posts_selectspec
(
$userid
,
$questionid
),
qa_db_post_parent_q_selectspec
(
$questionid
),
qa_db_post_close_post_selectspec
(
$questionid
),
qa_db_post_duplicates_selectspec
(
$questionid
),
qa_db_post_meta_selectspec
(
$questionid
,
'qa_q_extra'
),
qa_db_category_nav_selectspec
(
$questionid
,
true
,
true
,
true
),
isset
(
$userid
)
?
qa_db_is_favorite_selectspec
(
$userid
,
QA_ENTITY_QUESTION
,
$questionid
)
:
null
...
...
@@ -66,9 +67,9 @@
$question
[
'extra'
]
=
$extravalue
;
$answers
=
qa_page_q_load_as
(
$question
,
$childposts
);
$commentsfollows
=
qa_page_q_load_c_follows
(
$question
,
$childposts
,
$achildposts
);
$commentsfollows
=
qa_page_q_load_c_follows
(
$question
,
$childposts
,
$achildposts
,
$duplicateposts
);
$question
=
$question
+
qa_page_q_post_rules
(
$question
,
null
,
null
,
$childposts
);
// array union
$question
=
$question
+
qa_page_q_post_rules
(
$question
,
null
,
null
,
$childposts
+
$duplicateposts
);
// array union
if
(
$question
[
'selchildid'
]
&&
(
@
$answers
[
$question
[
'selchildid'
]][
'type'
]
!=
'A'
))
$question
[
'selchildid'
]
=
null
;
// if selected answer is hidden or somehow not there, consider it not selected
...
...
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