- if ( config.wgAction === 'view' && 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 );
+ // 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 );
+ }