From e69fbc12d23e87f6c90ebdef7e99b4818483821b Mon Sep 17 00:00:00 2001
From: Frog23 <code@frog23.net>
Date: Wed, 22 Jul 2020 14:56:41 +0200
Subject: [PATCH] fixed issue T258594 : [QuickStatements] allow removal of alias

---
 public_html/quickstatements.php | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/public_html/quickstatements.php b/public_html/quickstatements.php
index 2872edb..77322cb 100644
--- a/public_html/quickstatements.php
+++ b/public_html/quickstatements.php
@@ -926,6 +926,24 @@ exit ( 1 ) ; // Force bot restart
 		return $command ;
 	}
 	
+	protected function commandRemoveAlias ( $command , $i ) {
+        // Paranoia TODO
+
+        // Execute!
+        $this->runAction ( array (
+            'action' => 'wbsetaliases' ,
+            //replaced with the line below because of https://phabricator.wikimedia.org/T258593
+            //'id' => $this->getPrefixedID ( $command->item ) ,
+            'id' => $command->item ,
+            'language' => $command->language ,
+            'remove' => $command->value ,
+            'summary' => '' ,
+            'baserevid' => $i->j->lastrevid
+        ) , $command ) ;
+        if ( !$this->isBatchRun() ) $this->wd->updateItem ( $command->item ) ;
+        return $command ;
+    }
+	
 	protected function commandSetDescription ( $command , $i ) {
 		// Paranoia
 		if ( $i->getDesc ( $command->language , true ) == $command->value ) return $this->commandDone ( $command , 'Already has that description for {$command->language}' ) ;
@@ -1077,7 +1095,9 @@ exit ( 1 ) ; // Force bot restart
 					return $this->commandRemoveStatement ( $command ) ;
 				} else if ( $command->what == 'sitelink' ) {
 					return $this->commandRemoveSitelink ( $command, $i ) ;
-				}
+				}else if ( $command->what == 'alias' ) {
+                    return $this->commandRemoveAlias ( $command, $i ) ;
+                }
 			
 			}
 			
-- 
2.11.0

