Clear postEdit cookie on server-side
[lhc/web/wiklou.git] / resources / src / mediawiki.action / mediawiki.action.view.postEdit.js
index 87572ec..e25c96a 100644 (file)
         * @member mw.hook
         */
 
-       var cookieVal,
-               config = mw.config.get( [ 'wgAction', 'wgCurRevisionId' ] ),
-               // This should match EditPage::POST_EDIT_COOKIE_KEY_PREFIX:
-               cookieKey = 'PostEditRevision' + config.wgCurRevisionId;
+       var postEdit = mw.config.get( 'wgPostEdit' );
 
        function showConfirmation( data ) {
                var $container, $popup, $content, timeoutId;
 
        mw.hook( 'postEdit' ).add( showConfirmation );
 
-       // Only when viewing wiki pages, that exist
-       // (E.g. not on special pages or non-view actions)
-       if ( config.wgCurRevisionId && config.wgAction === 'view' ) {
-               cookieVal = mw.cookie.get( cookieKey );
-               if ( cookieVal ) {
-                       mw.config.set( 'wgPostEdit', true );
-
-                       mw.hook( 'postEdit' ).fire( {
-                               // The following messages can be used here:
-                               // postedit-confirmation-saved
-                               // postedit-confirmation-created
-                               // postedit-confirmation-restored
-                               message: mw.msg(
-                                       'postedit-confirmation-' + cookieVal,
-                                       mw.user
-                               )
-                       } );
-
-                       mw.cookie.set( cookieKey, null );
-               }
+       if ( postEdit ) {
+               mw.hook( 'postEdit' ).fire( {
+                       // The following messages can be used here:
+                       // postedit-confirmation-saved
+                       // postedit-confirmation-created
+                       // postedit-confirmation-restored
+                       message: mw.msg(
+                               'postedit-confirmation-' + postEdit,
+                               mw.user
+                       )
+               } );
        }
 
 }( mediaWiki, jQuery ) );