jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/336008 )

Change subject: Implemented flagging reason.
......................................................................


Implemented flagging reason.

+ Fixed flag link showing to unlogged users.

Bug: T155451
Change-Id: If98f901cd3d090e9a1fd2450ad9957582b3da455
---
M PictureGameHome.body.php
M PictureGameHooks.class.php
M extension.json
M i18n/en.json
M i18n/qqq.json
M picturegame/PictureGame.js
A sql/picturegame-add-comment.sql
R sql/picturegame.sql
8 files changed, 162 insertions(+), 95 deletions(-)

Approvals:
  SamanthaNguyen: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/PictureGameHome.body.php b/PictureGameHome.body.php
index 9978497..9cdd4a2 100644
--- a/PictureGameHome.body.php
+++ b/PictureGameHome.body.php
@@ -235,7 +235,7 @@
                $dbw = wfGetDB( DB_MASTER );
                $dbw->update(
                        'picturegame_images',
-                       array( 'flag' => PictureGameHome::$FLAG_NONE ),
+                       array( 'flag' => PictureGameHome::$FLAG_NONE, 'comment' 
=> '' ),
                        array( 'id' => $id ),
                        __METHOD__
                );
@@ -419,7 +419,7 @@
                                                <h1>" . $this->msg( 
'picturegame-createeditfirstimage' )->plain() . "</h1>
                                                <p><input 
name=\"imgOneCaption\" id=\"imgOneCaption\" type=\"text\" 
value=\"{$img1_caption_text}\" /></p>
                                                <p 
id=\"image-one-tag\">{$imgOne}</p>
-                                               <p><a 
class=\"picgame-upload-link-1\" href=\"javascript:void(0);\" 
data-img-one-name=\"{$imgOneName}\">" .
+                                               <p><a 
class=\"picgame-upload-link-1\" href=\"#\" 
data-img-one-name=\"{$imgOneName}\">" .
                                                        $this->msg( 
'picturegame-editgameuploadtext' )->plain() . '</a></p>
                                        </div>
 
@@ -427,7 +427,7 @@
                                                <h1>' . $this->msg( 
'picturegame-createeditsecondimage' )->plain() . "</h1>
                                                <p><input 
name=\"imgTwoCaption\" id=\"imgTwoCaption\" type=\"text\" 
value=\"{$img2_caption_text}\" /></p>
                                                <p 
id=\"image-two-tag\">{$imgTwo}</p>
-                                               <p><a 
class=\"picgame-upload-link-2\" href=\"javascript:void(0);\" 
data-img-two-name=\"{$imgTwoName}\">" .
+                                               <p><a 
class=\"picgame-upload-link-2\" href=\"#\" 
data-img-two-name=\"{$imgTwoName}\">" .
                                                        $this->msg( 
'picturegame-editgameuploadtext' )->plain() . "</a></p>
                                        </div>
 
@@ -455,7 +455,7 @@
                                <input type="button" 
onclick="document.picGameVote.submit()" value="' . $this->msg( 
'picturegame-buttonsubmit' )->plain() . "\"/>
                                <input type=\"button\" 
onclick=\"window.location='" .
                                        htmlspecialchars( 
$this->getPageTitle()->getFullURL( "picGameAction=renderPermalink&id={$imgID}" 
) ) . "'\" value=\"" .
-                                       $this->msg( 'picturegame-buttoncancel' 
)->plain() . "\"/>
+                                       $this->msg( 'cancel' )->plain() . "\"/>
                        </div>
                </form>
                </div>";
@@ -495,7 +495,7 @@
                $dbw = wfGetDB( DB_MASTER );
                $res = $dbw->select(
                        'picturegame_images',
-                       array( 'id', 'img1', 'img2' ),
+                       array( 'id', 'img1', 'img2', 'comment' ),
                        array(
                                'flag' => PictureGameHome::$FLAG_FLAGGED,
                                "img1 <> ''",
@@ -527,8 +527,14 @@
                        $img_one_description = $lang->truncate( $row->img1, 12 
);
                        $img_two_description = $lang->truncate( $row->img2, 12 
);
 
-                       $output .= '<div id="' . $row->id . "\" 
class=\"admin-row\">
+                       $reason = '';
+                       if( !empty( $row->comment ) ) {
+                               $reason .= "<div 
class=\"picturegame-adminpanelflag\" 
id=\"picturegame-adminpanelflagreason-{$row->id}\">
+                               <b>" . $this->msg( 
'picturegame-adminpanelreason' )->escaped() . "</b>: {$row->comment}
+                               </div><p>";
+                       }
 
+                       $output .= '<div id="' . $row->id . "\" 
class=\"admin-row\">
                                <div class=\"admin-image\">
                                        <p>{$img_one_tag}</p>
                                        <p><b>{$img_one_description}</b></p>
@@ -538,16 +544,16 @@
                                        <p><b>{$img_two_description}</b></p>
                                </div>
                                <div class=\"admin-controls\">
-                                       <a class=\"picgame-unflag-link\" 
href=\"javascript:void(0)\">" .
+                                       <a class=\"picgame-unflag-link\" 
href=\"#\">" .
                                                $this->msg( 
'picturegame-adminpanelunflag' )->text() .
                                        "</a> |
-                                       <a class=\"picgame-delete-link\" 
href=\"javascript:void(0);\" data-row-img1=\"{$row->img1}\" 
data-row-img2=\"{$row->img2}\">"
+                                       <a class=\"picgame-delete-link\" 
href=\"#\" data-row-img1=\"{$row->img1}\" data-row-img2=\"{$row->img2}\">"
                                                . $this->msg( 
'picturegame-adminpaneldelete' )->text() .
-                                       '</a>
+                                       "</a>
+                                       {$reason}
                                </div>
-                               <div class="visualClear"></div>
-
-                       </div>';
+                               <div class=\"visualClear\"></div>
+                       </div>";
                }
 
                $output .= '</div>
@@ -598,16 +604,15 @@
                                        <p><b>{$img_two_description}</b></p>
                                </div>
                                <div class=\"admin-controls\">
-                                       <a class=\"picgame-unprotect-link\" 
href=\"javascript:void(0)\">" .
+                                       <a class=\"picgame-unprotect-link\" 
href=\"#\">" .
                                                $this->msg( 
'picturegame-adminpanelunprotect' )->text() .
                                        "</a> |
-                                       <a class=\"picgame-delete-link\" 
href=\"javascript:void(0);\" data-row-img1=\"{$row->img1}\" 
data-row-img2=\"{$row->img2}\">"
+                                       <a class=\"picgame-delete-link\" 
href=\"#\" data-row-img1=\"{$row->img1}\" data-row-img2=\"{$row->img2}\">"
                                                . $this->msg( 
'picturegame-adminpaneldelete' )->text() .
-                                       '</a>
-                               </div>
-                               <div class="visualClear"></div>
-
-                       </div>';
+                                               '</a>
+                                       </div>
+                                       <div class="visualClear"></div>
+                               </div>';
                }
 
                $output .= '</div>';
@@ -626,7 +631,7 @@
 
                $id = $request->getInt( 'id' );
                $key = $request->getVal( 'key' );
-
+               $comment = $request->getVal( 'comment' ) ? $request->getVal( 
'comment' ) : ''; // reason for flagging
                if( $key != md5( $id . $this->SALT ) ) {
                        echo $this->msg( 'picturegame-sysmsg-badkey' )->plain();
                        return;
@@ -635,7 +640,7 @@
                $dbw = wfGetDB( DB_MASTER );
                $dbw->update(
                        'picturegame_images',
-                       array( 'flag' => PictureGameHome::$FLAG_FLAGGED ),
+                       array( 'flag' => PictureGameHome::$FLAG_FLAGGED, 
'comment' => $comment ),
                        array( 'id' => $id, 'flag' => 
PictureGameHome::$FLAG_NONE ),
                        __METHOD__
                );
@@ -1415,15 +1420,18 @@
                                '</a>
                        </div>';
                }
-
-               $editLink = '';
-               if( $user->isLoggedIn() && $user->isAllowed( 'picturegameadmin' 
) && $wgUseEditButtonFloat == true ) {
-                       $editLink .= '<div class="edit-menu-pic-game">
-                               <div class="edit-button-pic-game">
-                                       <img src="' . $wgExtensionAssetsPath . 
'/SocialProfile/images/editIcon.gif" alt="" />
-                                       <a class="picgame-edit-link" 
href="javascript:void(0)">' . $this->msg( 'edit' )->text() . '</a>
-                               </div>
-                       </div>';
+               $editLink = $flagLink = '';
+               if( $user->isLoggedIn() ) {
+                       if ( $user->isAllowed( 'picturegameadmin' ) && 
$wgUseEditButtonFloat == true ) {
+                               $editLink .= '<div class="edit-menu-pic-game">
+                                       <div class="edit-button-pic-game">
+                                               <img src="' . 
$wgExtensionAssetsPath . '/SocialProfile/images/editIcon.gif" alt="" />
+                                               <a class="picgame-edit-link" 
href="#">' . $this->msg( 'edit' )->text() . '</a>
+                                       </div>
+                               </div>';
+                       }
+                       $flagLink .= "<a class=\"picgame-flag-link\" 
href=\"#\">"
+                               . $this->msg( 'picturegame-reportimages' 
)->text() . " </a> - ";
                }
 
                $id = User::idFromName( $user_title->getText() );
@@ -1538,12 +1546,8 @@
                                                </span>
                                        </div>
                                </div>
-
-                               <div class=\"utilityButtons\" 
id=\"utilityButtons\">
-                                       <a class=\"picgame-flag-link\" 
href=\"javascript:void(0);\">"
-                                               . $this->msg( 
'picturegame-reportimages' )->text() .
-                                       " </a> -
-                                       <a 
href=\"javascript:window.parent.document.location='" . htmlspecialchars( 
$this->getPageTitle()->getFullURL( 'picGameAction=renderPermalink' ) ) . "&id=' 
+ document.getElementById('id').value\">"
+                               <div class=\"utilityButtons\" 
id=\"utilityButtons\">" . $flagLink .
+                                       "<a class=\"picgame-permalink\" 
href=\"#\">"
                                                . $this->msg( 
'picturegame-permalink' )->text() .
                                        '</a>'
                                . $editlinks . "
diff --git a/PictureGameHooks.class.php b/PictureGameHooks.class.php
index 26c1df1..166fe60 100644
--- a/PictureGameHooks.class.php
+++ b/PictureGameHooks.class.php
@@ -64,9 +64,10 @@
         * @return Boolean
         */
        public static function onLoadExtensionSchemaUpdates( $updater ) {
-               $updater->addExtensionUpdate( array( 'addTable', 
'picturegame_images', __DIR__ . '/picturegame.sql', true ) );
-               $updater->addExtensionUpdate( array( 'addTable', 
'picturegame_votes', __DIR__ . '/picturegame.sql', true ) );
+               $updater->addExtensionUpdate( array( 'addTable', 
'picturegame_images', __DIR__ . '/sql/picturegame.sql', true ) );
+               $updater->addExtensionUpdate( array( 'addTable', 
'picturegame_votes', __DIR__ . '/sql/picturegame.sql', true ) );
+               $updater->addExtensionField( 'picturegame_images', 'comment', 
__DIR__ . '/sql/picturegame-add-comment.sql' );
 
                return true;
        }
-}
\ No newline at end of file
+}
diff --git a/extension.json b/extension.json
index fb8cdd7..ff25bce 100644
--- a/extension.json
+++ b/extension.json
@@ -1,6 +1,6 @@
 {
        "name": "PictureGame",
-       "version": "3.7",
+       "version": "3.8",
        "author": [
                "Aaron Wright",
                "Ashish Datta",
@@ -56,16 +56,17 @@
                                "picturegame-js-error-upload-imgone",
                                "picturegame-js-error-upload-imgtwo", 
"picturegame-js-editing-imgone",
                                "picturegame-js-editing-imgtwo", 
"picturegame-protectimgconfirm",
-                               "picturegame-flagimgconfirm", 
"picturegame-confirm-cancel",
-                               "picturegame-adminpaneldelete-confirm", 
"picturegame-adminpanelunflag-confirm",
-                               "picturegame-adminpaneldelete", 
"picturegame-adminpanelunflag",
-                               "picturegame-adminpaneldelete-confirm", 
"picturegame-confirm-cancel"
+                               "picturegame-flagimgconfirm", 
"picturegame-adminpaneldelete-confirm",
+                               "picturegame-adminpanelunflag-confirm", 
"picturegame-adminpaneldelete",
+                               "picturegame-adminpanelunflag", 
"picturegame-adminpaneldelete-confirm",
+                               "picturegame-adminpanelreason", "cancel", 
"picturegame-reportimages"
                        ],
                        "dependencies": [
                                "ext.socialprofile.flash",
                                "ext.socialprofile.LightBox",
                                "oojs-ui-core",
-                               "oojs-ui-windows"
+                               "oojs-ui-windows",
+                               "oojs-ui-widgets"
                        ],
                        "position": "bottom"
                },
diff --git a/i18n/en.json b/i18n/en.json
index 4caca6c..42f1cf2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -20,13 +20,13 @@
        "picturegame-backbutton": "Go Back",
        "picturegame-previousgame": "Previous Game",
        "picturegame-adminpaneltitle": "Picture Game Admin Panel",
+       "picturegame-adminpanelreason": "Reason",
        "picturegame-adminpanelflagged": "Flagged Images:",
        "picturegame-adminpanelprotected": "Protected Images:",
        "picturegame-adminpanelunflag": "Un-flag",
        "picturegame-adminpanelunflag-confirm": "Are you sure you want to 
un-flag this picture game?",
        "picturegame-adminpaneldelete": "Delete",
        "picturegame-adminpaneldelete-confirm": "Are you sure you want to 
delete this picture game?",
-       "picturegame-confirm-cancel": "Cancel",
        "picturegame-adminpanelunprotect": "Unprotect",
        "picturegame-adminpanelbacktogame": "&lt; Back to the Picture Game",
        "picturegame-creategametitle": "Create a Picture Game",
@@ -43,11 +43,10 @@
        "picturegame-editgame-editing-title": "Editing $1",
        "picturegame-editgamegametitle": "Title",
        "picturegame-editgameuploadtext": "Upload New Image",
-       "picturegame-flagimgconfirm": "Are you sure you want to report these 
images?",
+       "picturegame-flagimgconfirm": "Explain why you're reporting these 
images.",
        "picturegame-protectimgconfirm": "Are you sure you want to protect 
these images?",
        "picturegame-buttonupload": "Upload",
        "picturegame-buttonsubmit": "Submit",
-       "picturegame-buttoncancel": "Cancel",
        "picturegame-buttonplaygame": "Play the Picture Game",
        "picturegame-permalinkflagged": "These pictures have been flagged 
because of inappropriate content or copyrighted material. To play the picture 
game, click the button below.",
        "picturegame-sysmsg-unauthorized": "You aren't authorized to do that.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 80bd9db..6643f32 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -1,10 +1,10 @@
 {
-    "@metadata": {
-        "authors": []
-    },
-    "picturegame-adminpanelunflag-confirm": "Confirmation message shown in the 
un-flag dialog.",
-    "picturegame-confirm-cancel": "Cancel button message shown in dialogs",
-    "picturegame-adminpaneldelete-confirm": "Confirmation message shown in the 
delete dialog.",
-    "picturegame-error-socialprofile": "Error message shown when SocialProfle 
extension is not installed.",
-       "picturegame-error-socialprofile-title": "Title for 
<code>quizgame-error-socialprofile</code>."
+       "@metadata": {
+               "authors": []
+       },
+       "picturegame-adminpanelunflag-confirm": "Confirmation message shown in 
the un-flag dialog.",
+       "picturegame-adminpanelunflag-confirm": "Confirmation message shown in 
the delete dialog.",
+       "picturegame-flagimgconfirm": "Confirmation message shown in the report 
dialog.",
+       "picturegame-error-socialprofile": "Error message shown when 
SocialProfle extension is not installed.",
+       "picturegame-error-socialprofile-title": "Title for 
<code>quizgame-error-socialprofile</code>."
 }
diff --git a/picturegame/PictureGame.js b/picturegame/PictureGame.js
index 920af11..82b3a8a 100644
--- a/picturegame/PictureGame.js
+++ b/picturegame/PictureGame.js
@@ -5,6 +5,39 @@
  * @ingroup Extensions
  * @author Jack Phoenix <[email protected]>
  */
+
+ /*
+       * That needs to be removed, when we drop support to MW 1.28. Modified 
copy pasta from OOjsUI windows.js
+       * @see https://gerrit.wikimedia.org/r/#/c/336008/
+       */
+reasonPrompt = function ( text, options ) {
+       manager = new OO.ui.WindowManager();
+       textInput = new OO.ui.TextInputWidget( ( options && options.textInput ) 
|| {} );
+       textField = new OO.ui.FieldLayout( textInput, {
+               align: 'top',
+               label: text
+       } );
+       $( 'body' ).append( manager.$element );
+       manager.addWindows( [ new OO.ui.MessageDialog() ] );
+
+       // TODO: This is a little hacky, and could be done by extending 
MessageDialog instead.
+
+       return manager.openWindow( 'message', $.extend( {
+               message: textField.$element
+       }, options ) ).then( function ( opened ) {
+               // After ready
+               textInput.on( 'enter', function () {
+                       manager.getCurrentWindow().close( { action: 'accept' } 
);
+               } );
+               textInput.focus();
+               return opened.then( function ( closing ) {
+                       return closing.then( function ( data ) {
+                               return $.Deferred().resolve( data && 
data.action === 'accept' ? textInput.getValue() : null );
+                       } );
+               } );
+       } );
+};
+
 var PictureGame = window.PictureGame = {
        currImg: 0, // from editpanel.js
 
@@ -25,7 +58,7 @@
                                id: id
                        },
                        function( data ) {
-                               alert( data );
+                               OO.ui.alert( data );
                        }
                );
        },
@@ -51,7 +84,7 @@
                                img2: imageName2
                        },
                        function( data ) {
-                               alert( data );
+                               OO.ui.alert( data );
                        }
                );
        },
@@ -140,26 +173,35 @@
 
        /**
         * Flags an image set
-        *
-        * @param msg String
+        * @see https://phabricator.wikimedia.org/T156304
+        * @see https://phabricator.wikimedia.org/T155451
         */
-       flagImg: function( msg ) {
-               var ask = confirm( msg );
-               if( ask ) {
-                       jQuery.get(
-                               mw.config.get( 'wgScript' ),
-                               {
-                                       title: 'Special:PictureGameHome',
-                                       picGameAction: 'flagImage',
-                                       key: document.getElementById( 'key' 
).value,
-                                       id: document.getElementById( 'id' 
).value
-                               },
-                               function( data ) {
-                                       document.getElementById( 
'serverMessages' ).innerHTML =
+       flagImg: function() {
+               var options = {
+                       actions: [
+                               { label: mw.msg( 'cancel' ) },
+                               { label: mw.msg( 'picturegame-reportimages' ), 
action: 'accept', flags: ['destructive', 'primary'] },
+                       ],
+                       textInput: { placeholder: mw.msg( 
'picturegame-adminpanelreason' ) }
+               };
+               reasonPrompt( mw.msg( 'picturegame-flagimgconfirm' ), options 
).then( function ( reason ) {
+                       if ( reason !== null ) {
+                               jQuery.get(
+                                       mw.config.get( 'wgScript' ),
+                                       {
+                                               title: 
'Special:PictureGameHome',
+                                               picGameAction: 'flagImage',
+                                               key: document.getElementById( 
'key' ).value,
+                                               id: document.getElementById( 
'id' ).value,
+                                               comment: reason
+                                       },
+                                       function( data ) {
+                                               document.getElementById( 
'serverMessages' ).innerHTML =
                                                '<strong>' + data + '</strong>';
-                               }
-                       );
-               }
+                                       }
+                               );
+                       }
+               } );
        },
 
        doHover: function( divID ) {
@@ -448,32 +490,34 @@
 
 jQuery( function() {
        // Handle clicks on "Un-flag" links on the admin panel
-       jQuery( 'div.admin-controls a.picgame-unflag-link' ).on( 'click', 
function() {
+       jQuery( 'div.admin-controls a.picgame-unflag-link' ).on( 'click', 
function( event ) {
+               event.preventDefault();
                var options = {
                        actions: [
-                               { label: mw.msg( 'picturegame-confirm-cancel' ) 
},
+                               { label: mw.msg( 'cancel' ) },
                                { label: mw.msg( 'picturegame-adminpanelunflag' 
), action: 'accept', flags: ['constructive'] }
                        ]
-               };
+               }, id = jQuery( this ).parent().parent().attr( 'id' );
                OO.ui.confirm( mw.msg( 'picturegame-adminpanelunflag-confirm' 
), options ).done( function ( confirmed ) {
                        if ( confirmed ) {
-                               PictureGame.unflag( jQuery( this 
).parent().parent().attr( 'id' ) );
+                               PictureGame.unflag( id );
                        }
                } );
        } );
 
        // Handle clicks on "Delete" links on the admin panel
-       jQuery( 'div.admin-controls a.picgame-delete-link' ).on( 'click', 
function() {
+       jQuery( 'div.admin-controls a.picgame-delete-link' ).on( 'click', 
function( event ) {
+               event.preventDefault();
                var options = {
                        actions: [
-                               { label: mw.msg( 'picturegame-confirm-cancel' ) 
},
+                               { label: mw.msg( 'cancel' ) },
                                { label: mw.msg( 'picturegame-adminpaneldelete' 
), action: 'accept', flags: ['destructive'] }
                        ]
-               };
+               }, id = jQuery( this ).parent().parent().attr( 'id' );
                OO.ui.confirm( mw.msg( 'picturegame-adminpaneldelete-confirm' 
), options ).done( function ( confirmed ) {
                        if ( confirmed ) {
                                PictureGame.deleteimg(
-                                       jQuery( this ).parent().parent().attr( 
'id' ),
+                                       id,
                                        jQuery( this ).data( 'row-img1' ),
                                        jQuery( this ).data( 'row-img2' )
                                );
@@ -482,39 +526,53 @@
        } );
 
        // Handle clicks on "Unprotect" links on the admin panel
-       jQuery( 'div.admin-controls a.picgame-unprotect-link' ).on( 'click', 
function() {
+       jQuery( 'div.admin-controls a.picgame-unprotect-link' ).on( 'click', 
function( event ) {
+               event.preventDefault();
                PictureGame.unprotect( jQuery( this ).parent().parent().attr( 
'id' ) );
        } );
 
        // Handle clicks on "Protect" links on the admin panel
-       jQuery( 'a.picgame-protect-link' ).on( 'click', function() {
+       jQuery( 'a.picgame-protect-link' ).on( 'click', function( event ) {
+               event.preventDefault();
                PictureGame.protectImages( mw.msg( 
'picturegame-protectimgconfirm' ) );
        } );
 
-       jQuery( 'div.edit-button-pic-game a.picgame-edit-link' ).on( 'click', 
function() {
+       jQuery( 'div.edit-button-pic-game a.picgame-edit-link' ).on( 'click', 
function( event ) {
+               event.preventDefault();
                PictureGame.editPanel();
        } );
 
+       // Permalink
+       jQuery( 'div#utilityButtons a.picgame-permalink' ).on( 'click', 
function( event ) {
+               event.preventDefault();
+               window.parent.document.location = window.location.href.replace( 
'startGame', 'renderPermalink' );
+       } );
+
        // "Flag" link
-       jQuery( 'div#utilityButtons a.picgame-flag-link' ).on( 'click', 
function() {
-               PictureGame.flagImg( mw.msg( 'picturegame-flagimgconfirm' ) );
+       jQuery( 'div#utilityButtons a.picgame-flag-link' ).on( 'click', 
function( event ) {
+               event.preventDefault();
+               PictureGame.flagImg();
        } );
 
        // "Skip to game" button
-       jQuery( 'input#skip-button' ).on( 'click', function() {
+       jQuery( 'input#skip-button' ).on( 'click', function( event ) {
+               event.preventDefault();
                PictureGame.skipToGame();
        } );
 
-       jQuery( 'div#edit-image-one p a.picgame-upload-link-1' ).on( 'click', 
function() {
+       jQuery( 'div#edit-image-one p a.picgame-upload-link-1' ).on( 'click', 
function( event ) {
+               event.preventDefault();
                PictureGame.loadUploadFrame( jQuery( this ).data( 
'img-one-name' ), 1 );
        } );
 
-       jQuery( 'div#edit-image-two p a.picgame-upload-link-2' ).on( 'click', 
function() {
+       jQuery( 'div#edit-image-two p a.picgame-upload-link-2' ).on( 'click', 
function( event ) {
+               event.preventDefault();
                PictureGame.loadUploadFrame( jQuery( this ).data( 
'img-two-name' ), 2 );
        } );
 
        // "Create and Play!" button on picture game creation form
-       jQuery( 'div#startButton input' ).on( 'click', function() {
+       jQuery( 'div#startButton input' ).on( 'click', function( event ) {
+               event.preventDefault();
                PictureGame.startGame();
        } );
 
diff --git a/sql/picturegame-add-comment.sql b/sql/picturegame-add-comment.sql
new file mode 100644
index 0000000..b173823
--- /dev/null
+++ b/sql/picturegame-add-comment.sql
@@ -0,0 +1,3 @@
+-- Creates row in table `picturegame_images` which keep reasons of flagging
+ALTER TABLE /*_*/picturegame_images
+  ADD COLUMN comment VARCHAR(255) DEFAULT '';
diff --git a/picturegame.sql b/sql/picturegame.sql
similarity index 94%
rename from picturegame.sql
rename to sql/picturegame.sql
index 39e8313..bca3265 100644
--- a/picturegame.sql
+++ b/sql/picturegame.sql
@@ -17,7 +17,8 @@
   `img0_votes` int(10) unsigned NOT NULL default '0',
   `img1_votes` int(10) unsigned NOT NULL default '0',
   `heat` double NOT NULL default '0',
-  `pg_date` datetime default NULL
+  `pg_date` datetime default NULL,
+  `comment` varchar(255) default ''
 ) /*$wgDBTableOptions*/;
 
 CREATE INDEX /*i*/userid ON /*_*/picturegame_images (userid);
@@ -32,4 +33,4 @@
 ) /*$wgDBTableOptions*/;
 
 CREATE INDEX /*i*/picturegame_username ON /*_*/picturegame_votes (username);
-CREATE INDEX /*i*/picturegame_pic_id ON /*_*/picturegame_votes (picid);
\ No newline at end of file
+CREATE INDEX /*i*/picturegame_pic_id ON /*_*/picturegame_votes (picid);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If98f901cd3d090e9a1fd2450ad9957582b3da455
Gerrit-PatchSet: 23
Gerrit-Project: mediawiki/extensions/PictureGame
Gerrit-Branch: master
Gerrit-Owner: Filip <[email protected]>
Gerrit-Reviewer: Filip <[email protected]>
Gerrit-Reviewer: Jack Phoenix <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: SamanthaNguyen <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to