Commit 451a2c6d by Scott Vivian

Moved complex logic out of if clause

parent 28b53c8c
...@@ -944,25 +944,25 @@ ...@@ -944,25 +944,25 @@
$laterquestion = @$keepquestions[$question['postid']]; $laterquestion = @$keepquestions[$question['postid']];
if (isset($laterquestion)) { if (isset($laterquestion)) {
if ( // the two events were within 5 minutes of each other
(abs($laterquestion['_time'] - $question['_time']) < 300) // the two events were within 5 minutes of each other $close_events = abs($laterquestion['_time'] - $question['_time']) < 300;
&&
( $later_edit =
(@$laterquestion['oupdatetype']) && // the more recent reference was an edit @$laterquestion['oupdatetype'] && // the more recent reference was an edit
(!@$question['oupdatetype']) && // this is not an edit !@$question['oupdatetype'] && // this is not an edit
($laterquestion['_type'] == $question['_type']) && // the same part (Q/A/C) is referenced here $laterquestion['_type'] == $question['_type'] && // the same part (Q/A/C) is referenced here
($laterquestion['_userid'] == $question['_userid']) // the same user made the later edit $laterquestion['_userid'] == $question['_userid']; // the same user made the later edit
)
|| // or ... // this question (in an update list) is personal to the user, but the other one was not
( $this_personal = @$question['opersonal'] && !@$laterquestion['opersonal'];
(@$question['opersonal']) && // this question (in an update list) is personal to the user
(!@$laterquestion['opersonal']) // the other one was not personal if ($close_events && ($later_edit || $this_personal)) {
) // Remove any previous instance of the post to force a new position
) { unset($keepquestions[$question['postid']]);
unset($keepquestions[$question['postid']]); // Remove any previous instance of the post to force a new position
$keepquestions[$question['postid']] = $question; $keepquestions[$question['postid']] = $question;
} }
} else // keep this reference if there is no more recent one }
else // keep this reference if there is no more recent one
$keepquestions[$question['postid']] = $question; $keepquestions[$question['postid']] = $question;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment