From 2bad626be6a17423565a7aa69f001b8997da3efd Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Sat, 15 Jul 2017 04:03:50 +0000
Subject: [PATCH] Bugfix: Signatures for likes hadn't been stored

---
 boot.php                | 2 +-
 database.sql            | 4 ++--
 include/dbstructure.php | 2 +-
 include/diaspora.php    | 2 +-
 update.php              | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/boot.php b/boot.php
index b69fd91c45..977112c7b5 100644
--- a/boot.php
+++ b/boot.php
@@ -42,7 +42,7 @@ define ( 'FRIENDICA_PLATFORM',     'Friendica');
 define ( 'FRIENDICA_CODENAME',     'Asparagus');
 define ( 'FRIENDICA_VERSION',      '3.5.3-dev' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
-define ( 'DB_UPDATE_VERSION',      1232      );
+define ( 'DB_UPDATE_VERSION',      1233      );
 
 /**
  * @brief Constant with a HTML line break.
diff --git a/database.sql b/database.sql
index a3f937587c..604e7c7a88 100644
--- a/database.sql
+++ b/database.sql
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 3.5.3-dev (Asparagus)
--- DB_UPDATE_VERSION 1231
+-- DB_UPDATE_VERSION 1233
 -- ------------------------------------------
 
 
@@ -944,7 +944,7 @@ CREATE TABLE IF NOT EXISTS `sign` (
 	`signature` text,
 	`signer` varchar(255) NOT NULL DEFAULT '',
 	 PRIMARY KEY(`id`),
-	 INDEX `iid` (`iid`)
+	 UNIQUE INDEX `iid` (`iid`)
 ) DEFAULT COLLATE utf8mb4_general_ci;
 
 --
diff --git a/include/dbstructure.php b/include/dbstructure.php
index 32fd304f4b..e455ee3333 100644
--- a/include/dbstructure.php
+++ b/include/dbstructure.php
@@ -1572,7 +1572,7 @@ function db_definition() {
 					),
 			"indexes" => array(
 					"PRIMARY" => array("id"),
-					"iid" => array("iid"),
+					"iid" => array("UNIQUE", "iid"),
 					)
 			);
 	$database["spam"] = array(
diff --git a/include/diaspora.php b/include/diaspora.php
index 58a77dca86..77c459e649 100644
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -3729,7 +3729,7 @@ class Diaspora {
 		 * This will break Diaspora compatibility with Friendica versions prior to 3.5.
 		 */
 		q("INSERT INTO `sign` (`iid`,`signed_text`) VALUES (%d,'%s')",
-			intval($message_id),
+			intval($post_id),
 			dbesc(json_encode($message))
 		);
 
diff --git a/update.php b/update.php
index d89e9ca06d..2b4ff76b16 100644
--- a/update.php
+++ b/update.php
@@ -1,6 +1,6 @@
 <?php
 
-define('UPDATE_VERSION' , 1232);
+define('UPDATE_VERSION' , 1233);
 
 /**
  *
-- 
2.39.5