From 3bfd03128a50e3a7fba7fafcd44fa94a67f47063 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 29 Dec 2008 18:49:50 +0000 Subject: [PATCH] * (bug 16209) Deleted images are not watched * Add watchlist check to filedelete form * Fix XHTML on filedelete form --- includes/FileDeleteForm.php | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php index ebab673827..b7c544c6a2 100644 --- a/includes/FileDeleteForm.php +++ b/includes/FileDeleteForm.php @@ -109,8 +109,15 @@ class FileDeleteForm { // Need to delete the associated article $article = new Article( $title ); if( wfRunHooks('ArticleDelete', array(&$article, &$wgUser, &$reason)) ) { - if( $article->doDeleteArticle( $reason, $suppress, $id ) ) + if( $article->doDeleteArticle( $reason, $suppress, $id ) ) { + global $wgRequest; + if( $wgRequest->getCheck( 'wpWatch' ) ) { + $article->doWatch(); + } elseif( $this->mTitle->userIsWatching() ) { + $article->doUnwatch(); + } wfRunHooks('ArticleDeleteComplete', array(&$article, &$wgUser, $reason, $id)); + } } } } @@ -127,7 +134,7 @@ class FileDeleteForm { global $wgOut, $wgUser, $wgRequest; if( $wgUser->isAllowed( 'suppressrevision' ) ) { - $suppress = " + $suppress = " " . Xml::checkLabel( wfMsg( 'revdelete-suppress' ), @@ -138,7 +145,9 @@ class FileDeleteForm { $suppress = ''; } - $form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getAction(), 'id' => 'mw-img-deleteconfirm' ) ) . + $checkWatch = $wgUser->getBoolOption( 'watchdeletion' ) || $this->title->userIsWatching(); + $form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getAction(), + 'id' => 'mw-img-deleteconfirm' ) ) . Xml::openElement( 'fieldset' ) . Xml::element( 'legend', null, wfMsg( 'filedelete-legend' ) ) . Xml::hidden( 'wpEditToken', $wgUser->editToken( $this->oldimage ) ) . @@ -164,6 +173,13 @@ class FileDeleteForm { " {$suppress} + + + " . + Xml::checkLabel( wfMsg( 'watchthis' ), + 'wpWatch', 'wpWatch', $checkWatch, array( 'tabindex' => '3' ) ) . + " + " . -- 2.20.1