svn: /web/doc-editor/trunk/php/ RepositoryFetcher.php
[email protected] (Yannick Torres)
| Newsgroups | php.doc.web |
|---|---|
| Message-ID | <[email protected]> |
yannick Thu, 17 Nov 2011 10:52:12 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=319397
Log:
If a patch don't contains any file, and isn't own by the current user, we don't display it
Changed paths:
U web/doc-editor/trunk/php/RepositoryFetcher.php
Modified: web/doc-editor/trunk/php/RepositoryFetcher.php
===================================================================
--- web/doc-editor/trunk/php/RepositoryFetcher.php 2011-11-17 10:20:08 UTC (rev 319396)
+++ web/doc-editor/trunk/php/RepositoryFetcher.php 2011-11-17 10:52:12 UTC (rev 319397)
@@ -740,6 +740,28 @@
}
/**
+ * Check is a patch don't contain any files
+ *
+ *
+ * @return TRUE if this patch is empty, FALSE either.
+ * @see RepositoryFetcher::getWork
+ */
+ private function _isEmptyPatch($patchs)
+ {
+ $isEmpty = true;
+
+ while( list($patch, $dataPatch) = each($patchs))
+ {
+ while( list($folder, $dataFiles) = each($dataPatch['folders']))
+ {
+ $isEmpty = false;
+ }
+ }
+ return $isEmpty;
+ }
+
+
+ /**
* Get all files in Work module (progress work or patches for review).
*
* @return An associated array containing informations about files in work
@@ -850,6 +872,9 @@
// $userInfo[0] => login
// $userInfo[1] => anonymousIdent
$userInfo = explode('@|@',$user);
+
+ // If the current user is not me and if all of his patch are empty, we don't send it - feature request ##60299
+ if( $this->_isEmptyPatch($patchs) && !( $userInfo[0] == $vcsLogin && $userInfo[1] == $anonymousIdent ) ) { continue; }
// Get authService from anonymousIdent
$tmp = explode('-', $userInfo[1]);
@@ -878,6 +903,9 @@
// We now walk into patches for this users.
while( list($patch, $dataPatch) = each($patchs)) {
+
+ // If the current user is not me and if all of his patch are empty, we don't send it - feature request ##60299
+ if( empty($dataPatch['folders']) && !( $userInfo[0] == $vcsLogin && $userInfo[1] == $anonymousIdent )) { continue; }
$result .= "{task:'".$patch."',type:'patch',iconCls:'iconPatch',patchDescription:'".((isset($patches[$dataPatch["idDB"]]["patchDescription"])) ? $patches[$dataPatch["idDB"]]["patchDescription"] : '' )."',patchEmail:'".((isset($patches[$dataPatch["idDB"]]["patchEmail"])) ? $patches[$dataPatch["idDB"]]["patchEmail"] : '' )."',expanded:true,creationDate:'".( (isset($dataPatch["date"])) ? $dataPatch["date"] : '' )."',draggable: false, idDB:".$dataPatch["idDB"].", children:[";