jenkins-bot has submitted this change and it was merged.

Change subject: Add author and preview text to table in special page
......................................................................


Add author and preview text to table in special page

Special:SmiteSpam now also displays the author of the first revision
(linked to user's contributions) as well as a 50 character preview of
the page's content.

Change-Id: I073cc7104cda98ad0955af058b6400ba1af6e6a0
---
M SpecialSmiteSpam.php
M i18n/en.json
M i18n/qqq.json
3 files changed, 34 insertions(+), 2 deletions(-)

Approvals:
  Polybuildr: Looks good to me, approved
  Yaron Koren: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/SpecialSmiteSpam.php b/SpecialSmiteSpam.php
index fe7b115..b0b20d9 100644
--- a/SpecialSmiteSpam.php
+++ b/SpecialSmiteSpam.php
@@ -51,14 +51,19 @@
                                )
                        )
                );
-               $out->addHTML( Html::openElement( 'table' ) );
+               $out->addHTML( Html::openElement( 'table', array( 'class' => 
'wikitable' ) ) );
                $out->addHTML( '<tr><th>'
                        . $this->msg( 'smitespam-page' )->text()
                        . '</th><th>'
                        . $this->msg( 'smitespam-probability' )->text()
                        . '</th><th>'
+                       . $this->msg( 'smitespam-created-by' )->text()
+                       . '</th><th>'
+                       . $this->msg( 'smitespam-preview-text' )->text()
+                       . '</th><th>'
                        . $this->msg( 'smitespam-delete' )->text()
-                       . '</th></tr>' );
+                       . '</th></tr>'
+               );
                foreach ( $spamPages as $page ) {
                        $title = $page->getTitle();
                        $out->addHTML( '<tr>' );
@@ -90,6 +95,29 @@
                        }
                        $out->addHTML( '</td>' );
                        $out->addHTML( '<td>' );
+                       $oldestRevision = $page->getOldestRevision();
+                       if ( $oldestRevision ) {
+                               $creator = $oldestRevision->getUserText( 
Revision::RAW );
+                               $out->addHTML(
+                                       Linker::link(
+                                               SpecialPage::getTitleFor( 
'Contributions', $creator ),
+                                               
Sanitizer::escapeHtmlAllowEntities( $creator ),
+                                               array( 'target' => '_blank' )
+                                       )
+                               );
+                       }
+                       else {
+                               $out->addHTML( '-' );
+                       }
+                       $out->addHTML( '</td>' );
+                       $out->addHTML( '<td>' );
+                       $previewText = substr( $page->getMetadata( 'content' ), 
0, 50 );
+                       $out->addHTML( Sanitizer::escapeHtmlAllowEntities( 
$previewText ) );
+                       if ( strlen( $page->getMetadata( 'content' ) ) > 50  ) {
+                               $out->addHTML( '...' );
+                       }
+                       $out->addHTML( '</td>' );
+                       $out->addHTML( '<td>' );
                        $out->addHTML( Html::check(
                                'delete[]', false, array(
                                        'value' => $page->getID(),
diff --git a/i18n/en.json b/i18n/en.json
index d5b53ba..3d9a35f 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -12,6 +12,8 @@
        "smitespam-page": "Page",
        "smitespam-delete": "Delete",
        "smitespam-probability": "Probability",
+       "smitespam-created-by": "Created by",
+       "smitespam-preview-text": "Preview text",
        "smitespam-delete-selected": "Delete selected",
        "smitespam-deleted-reason": "Identified as spam by 
Extension:SmiteSpam.",
        "action-smitespam": "smite spam"
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 3b8b4be..6bd09eb 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -12,6 +12,8 @@
        "smitespam-page": "A wiki page",
        "smitespam-delete": "The verb 'delete'.",
        "smitespam-probability": "The word for 'probability'.",
+       "smitespam-created-by": "The author of the first revision of a page.",
+       "smitespam-preview-text": "Preview text of a page's content.",
        "smitespam-delete-selected": "The phrase for 'delete selected'",
        "smitespam-deleted-reason": "Reason to give for deletion of a page",
        "action-smitespam": "Action for work done by Extesions:SmiteSpam"

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I073cc7104cda98ad0955af058b6400ba1af6e6a0
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/SmiteSpam
Gerrit-Branch: master
Gerrit-Owner: Polybuildr <[email protected]>
Gerrit-Reviewer: Polybuildr <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: Yaron Koren <[email protected]>
Gerrit-Reviewer: jan <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to