Updates publicity if the item we delete is more public than the one we keep.
authorStéphane Jacob <sj@m4x.org>
Sun, 12 Dec 2010 20:20:49 +0000 (21:20 +0100)
committerStéphane Jacob <sj@m4x.org>
Mon, 13 Dec 2010 00:00:19 +0000 (01:00 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
upgrade/1.0.1/merge_issues.php

index cf6f3d6..55f3214 100755 (executable)
@@ -131,6 +131,10 @@ foreach ($pids as $pid) {
         for ($j = $i + 1; $j < $count; ++$j) {
             if (check($rawAddresses[$i], $rawAddresses[$j])) {
                 $duplicates[$j] = true;
+                $minPub = new ProfileVisibility($addresses[$j]->pub);
+                if ($minPub->isVisible($addresses[$i]->pub)) {
+                    $addresses[$i]->pub = $addresses[$j]->pub;
+                }
             }
         }
     }
@@ -211,7 +215,12 @@ foreach ($pids as $pid) {
     for ($i = 0; $i < $count; ++$i) {
         for ($j = $i + 1; $j < $count; ++$j) {
             if ($phones[$i]->search() == $phones[$j]->search()) {
-                $duplicates[$i] = true;
+                $duplicates[$j] = true;
+                $minPub = new ProfileVisibility($phones[$j]->pub);
+                if ($minPub->isVisible($phones[$i]->pub)) {
+                    $phones[$i]->pub = $phones[$j]->pub;
+                }
+
             }
         }
     }