From 3581cc1437ab2b9033b10b84e896d829f0234985 Mon Sep 17 00:00:00 2001
From: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
Date: Tue, 3 Jul 2018 12:28:01 +0100
Subject: [PATCH] Handle reversions in recent changes - for #78

---
 build/index.php                    | 9 +++++++--
 module_index.json                  | 2 +-
 modules/feature-recent-changes.php | 8 ++++++--
 theme_default.css                  | 1 +
 4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/build/index.php b/build/index.php
index 36291a1..5410b34 100644
--- a/build/index.php
+++ b/build/index.php
@@ -368,6 +368,7 @@ summary { cursor: pointer; }
 .move::before { content: "\\1f69a"; font-size: 1.25em; margin: 0 0.1em 0 -1.1em; }
 .upload::before { content: "\\1f845"; margin: 0 0.1em 0 -1.1em; }
 .new-comment::before { content: "\\1f4ac"; margin: 0 0.1em 0 -1.1em; }
+.reversion::before { content: "\\23f2"; margin: 0 0.1em 0 -1.1em; }
 
 .comments { padding: 1em 2em; background: hsl(31, 64%, 85%); box-shadow: 0 0.1rem 1rem 0.3rem rgba(50, 50, 50, 0.5); }
 .comments textarea { background: hsl(270, 60%, 86%); }
@@ -404,7 +405,7 @@ if($settings->sessionprefix == "auto")
 /////////////////////////////////////////////////////////////////////////////
 /** The version of Pepperminty Wiki currently running. */
 $version = "v0.17-dev";
-$commit = "819489a7fb17f8e57fe6af7e01c34e9260d4e9ea";
+$commit = "1cb72f3a4968fa7311c496c608b217730ed44ce1";
 /// Environment ///
 /** Holds information about the current request environment. */
 $env = new stdClass();
@@ -3715,8 +3716,10 @@ function render_recent_change($rchange)
 	
 	$result = "";
 	$resultClasses = [];
-	switch(isset($rchange->type) ? $rchange->type : "edit")
+	$rchange_type = isset($rchange->type) ? $rchange->type : "edit";
+	switch($rchange_type)
 	{
+		case "revert":
 		case "edit":
 			// The number (and the sign) of the size difference to display
 			$size_display = ($rchange->sizediff > 0 ? "+" : "") . $rchange->sizediff;
@@ -3729,6 +3732,8 @@ function render_recent_change($rchange)
 			
 			if(!empty($rchange->newpage))
 				$resultClasses[] = "newpage";
+			if($rchange_type === "revert")
+				$resultClasses[] = "reversion";
 			
 			$result .= "<a href='?page=" . rawurlencode($rchange->page) . ($revisionId !== false ? "&revision=$revisionId" : "") . "'>$pageDisplayHtml</a> $editorDisplayHtml $timeDisplayHtml <span class='$size_display_class' title='$size_title_display'>($size_display)</span>";
 			break;
diff --git a/module_index.json b/module_index.json
index 3bf562f..c1281f8 100755
--- a/module_index.json
+++ b/module_index.json
@@ -86,7 +86,7 @@
         "author": "Starbeamrainbowlabs",
         "description": "Adds recent changes. Access through the 'recent-changes' action.",
         "id": "feature-recent-changes",
-        "lastupdate": 1523988221,
+        "lastupdate": 1530617138,
         "optional": false
     },
     {
diff --git a/modules/feature-recent-changes.php b/modules/feature-recent-changes.php
index a6b2aa0..ae24bcc 100644
--- a/modules/feature-recent-changes.php
+++ b/modules/feature-recent-changes.php
@@ -1,7 +1,7 @@
 <?php
 register_module([
 	"name" => "Recent Changes",
-	"version" => "0.3.4",
+	"version" => "0.3.5",
 	"author" => "Starbeamrainbowlabs",
 	"description" => "Adds recent changes. Access through the 'recent-changes' action.",
 	"id" => "feature-recent-changes",
@@ -238,8 +238,10 @@ function render_recent_change($rchange)
 	
 	$result = "";
 	$resultClasses = [];
-	switch(isset($rchange->type) ? $rchange->type : "edit")
+	$rchange_type = isset($rchange->type) ? $rchange->type : "edit";
+	switch($rchange_type)
 	{
+		case "revert":
 		case "edit":
 			// The number (and the sign) of the size difference to display
 			$size_display = ($rchange->sizediff > 0 ? "+" : "") . $rchange->sizediff;
@@ -252,6 +254,8 @@ function render_recent_change($rchange)
 			
 			if(!empty($rchange->newpage))
 				$resultClasses[] = "newpage";
+			if($rchange_type === "revert")
+				$resultClasses[] = "reversion";
 			
 			$result .= "<a href='?page=" . rawurlencode($rchange->page) . ($revisionId !== false ? "&revision=$revisionId" : "") . "'>$pageDisplayHtml</a> $editorDisplayHtml $timeDisplayHtml <span class='$size_display_class' title='$size_title_display'>($size_display)</span>";
 			break;
diff --git a/theme_default.css b/theme_default.css
index 1a41a26..635148c 100644
--- a/theme_default.css
+++ b/theme_default.css
@@ -130,6 +130,7 @@ summary { cursor: pointer; }
 .move::before { content: "\\1f69a"; font-size: 1.25em; margin: 0 0.1em 0 -1.1em; }
 .upload::before { content: "\\1f845"; margin: 0 0.1em 0 -1.1em; }
 .new-comment::before { content: "\\1f4ac"; margin: 0 0.1em 0 -1.1em; }
+.reversion::before { content: "\\23f2"; margin: 0 0.1em 0 -1.1em; }
 
 .comments { padding: 1em 2em; background: hsl(31, 64%, 85%); box-shadow: 0 0.1rem 1rem 0.3rem rgba(50, 50, 50, 0.5); }
 .comments textarea { background: hsl(270, 60%, 86%); }
