Pwirth has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/282339

Change subject: SaferEdit: Fixed interval and param handling
......................................................................

SaferEdit: Fixed interval and param handling

* Fixed interval again
* Added "do not change" doc
* bUnsavedChanges is not a string anymore

Change-Id: I6992107cf0a1a0805bee76fb1de1ff02f36f5d71
---
M SaferEdit/SaferEdit.class.php
1 file changed, 17 insertions(+), 4 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/39/282339/1

diff --git a/SaferEdit/SaferEdit.class.php b/SaferEdit/SaferEdit.class.php
index eafe9c5..c2fc410 100644
--- a/SaferEdit/SaferEdit.class.php
+++ b/SaferEdit/SaferEdit.class.php
@@ -179,7 +179,12 @@
                }
 
                foreach ( $aIntermediateEdits as $oEdit ) {
-                       $iTime = wfTimestamp( TS_MW, time() - BsConfig::get( 
'MW::SaferEdit::Interval' ) * 10 );
+                       //Please do not edit this agian! This is well 
calculated!
+                       //DO NOT WRITE RANDOM NUMBERS IN HERE
+                       $iInterval = BsConfig::get( 'MW::SaferEdit::Interval' )
+                               + BsConfig::get( 'MW::PingInterval' )
+                               + 1; //+1 secound response time is enought
+                       $iTime = wfTimestamp( TS_MW, time() - $iInterval );
                        if ( $oEdit->se_user_name != $oUser->getName() && 
$oEdit->se_timestamp > $iTime ) {
                                $aTopViews['statebartopsafereditediting'] = 
$this->makeStateBarTopSomeoneEditing( $oEdit->se_user_name );
                        }
@@ -385,7 +390,12 @@
                                $aSingleResult['someoneEditingView'] = 
$aSingleResult['safereditView'] = '';
 
                                foreach ( $aIntermediateEdits as $oEdit ) {
-                                       $iDate = wfTimestamp( TS_MW, time() - 
BsConfig::get( 'MW::SaferEdit::Interval' ) * 10 );
+                                       //Please do not edit this agian! This 
is well calculated!
+                                       //DO NOT WRITE RANDOM NUMBERS IN HERE
+                                       $iInterval = BsConfig::get( 
'MW::SaferEdit::Interval' )
+                                               + BsConfig::get( 
'MW::PingInterval' )
+                                               + 1; //+1 secound response time 
is enought
+                                       $iDate = wfTimestamp( TS_MW, time() - 
$iInterval );
                                        if ( $oEdit->se_user_name != 
$oUser->getName() && $oEdit->se_timestamp > $iDate ) {
                                                
$aSingleResult['someoneEditingView'] = $this->makeStateBarTopSomeoneEditing( 
$oEdit->se_user_name )->execute();
                                        }
@@ -393,10 +403,13 @@
 
                                break;
                        case 'SaferEditSave':
-                               $bHasUnsavedChanges = empty( 
$aData[0]['bUnsavedChanges'] ) || $aData[0]['bUnsavedChanges'] == "false" ? 
false : true;
-                               if ( !$bHasUnsavedChanges ) {
+                               if( !isset($aData[0]['bUnsavedChanges']) ) {
                                        return true;
                                }
+                               if( $aData[0]['bUnsavedChanges'] !== true ) {
+                                       return true;
+                               }
+
                                $iSection = empty( $aData[0]['section'] ) ? -1 
: $aData[0]['section'];
 
                                $aSingleResult['success'] = 
$this->saveUserEditing(

-- 
To view, visit https://gerrit.wikimedia.org/r/282339
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6992107cf0a1a0805bee76fb1de1ff02f36f5d71
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Pwirth <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to