From 7d111e2a6fc7cb5e2d70d8e6e2da1f4cadc51c7b Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Sat, 25 Apr 2020 07:29:02 +0000
Subject: [PATCH] Duplicated fields renamed

---
 src/Console/User.php           |  2 +-
 src/Module/Admin/Users.php     |  4 ++--
 src/Module/Profile/Profile.php |  8 ++++----
 src/Module/Profile/Status.php  | 10 +++++-----
 src/Protocol/Salmon.php        |  6 +++---
 static/dbview.config.php       |  5 +----
 6 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/src/Console/User.php b/src/Console/User.php
index b12a3a6ad3..d976620382 100644
--- a/src/Console/User.php
+++ b/src/Console/User.php
@@ -361,7 +361,7 @@ HELP;
 						$contact['email'],
 						Temporal::getRelativeDate($contact['created']),
 						Temporal::getRelativeDate($contact['login_date']),
-						Temporal::getRelativeDate($contact['lastitem_date']),
+						Temporal::getRelativeDate($contact['last-item']),
 					]);
 				}
 				$this->out($table->getTable());
diff --git a/src/Module/Admin/Users.php b/src/Module/Admin/Users.php
index 822ac0c013..002e6c5feb 100644
--- a/src/Module/Admin/Users.php
+++ b/src/Module/Admin/Users.php
@@ -161,7 +161,7 @@ class Users extends BaseAdmin
 			'email',
 			'register_date',
 			'login_date',
-			'lastitem_date',
+			'last-item',
 			'page-flags'
 		];
 
@@ -206,7 +206,7 @@ class Users extends BaseAdmin
 
 			$e['register_date'] = Temporal::getRelativeDate($e['register_date']);
 			$e['login_date'] = Temporal::getRelativeDate($e['login_date']);
-			$e['lastitem_date'] = Temporal::getRelativeDate($e['lastitem_date']);
+			$e['last-item'] = Temporal::getRelativeDate($e['last-item']);
 			$e['is_admin'] = in_array($e['email'], $adminlist);
 			$e['is_deletable'] = (intval($e['uid']) != local_user());
 			$e['deleted'] = ($e['account_removed'] ? Temporal::getRelativeDate($e['account_expires_on']) : False);
diff --git a/src/Module/Profile/Profile.php b/src/Module/Profile/Profile.php
index 6142648803..6c7f4f14e5 100644
--- a/src/Module/Profile/Profile.php
+++ b/src/Module/Profile/Profile.php
@@ -299,10 +299,10 @@ class Profile extends BaseProfile
 			$htmlhead .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
 		}
 
-		$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $baseUrl . '/dfrn_poll/' . $nickname . '" title="DFRN: ' . DI::l10n()->t('%s\'s timeline', $profile['username']) . '"/>' . "\n";
-		$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $baseUrl . '/feed/' . $nickname . '/" title="' . DI::l10n()->t('%s\'s posts', $profile['username']) . '"/>' . "\n";
-		$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $baseUrl . '/feed/' . $nickname . '/comments" title="' . DI::l10n()->t('%s\'s comments', $profile['username']) . '"/>' . "\n";
-		$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $baseUrl . '/feed/' . $nickname . '/activity" title="' . DI::l10n()->t('%s\'s timeline', $profile['username']) . '"/>' . "\n";
+		$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $baseUrl . '/dfrn_poll/' . $nickname . '" title="DFRN: ' . DI::l10n()->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
+		$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $baseUrl . '/feed/' . $nickname . '/" title="' . DI::l10n()->t('%s\'s posts', $profile['name']) . '"/>' . "\n";
+		$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $baseUrl . '/feed/' . $nickname . '/comments" title="' . DI::l10n()->t('%s\'s comments', $profile['name']) . '"/>' . "\n";
+		$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $baseUrl . '/feed/' . $nickname . '/activity" title="' . DI::l10n()->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
 		$uri = urlencode('acct:' . $profile['nickname'] . '@' . $baseUrl->getHostname() . ($baseUrl->getUrlPath() ? '/' . $baseUrl->getUrlPath() : ''));
 		$htmlhead .= '<link rel="lrdd" type="application/xrd+xml" href="' . $baseUrl . '/xrd/?uri=' . $uri . '" />' . "\n";
 		header('Link: <' . $baseUrl . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
diff --git a/src/Module/Profile/Status.php b/src/Module/Profile/Status.php
index bb19be2b9c..8b6734e5cd 100644
--- a/src/Module/Profile/Status.php
+++ b/src/Module/Profile/Status.php
@@ -53,10 +53,10 @@ class Status extends BaseProfile
 			DI::page()['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
 		}
 
-		DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/dfrn_poll/' . $parameters['nickname'] . '" title="DFRN: ' . DI::l10n()->t('%s\'s timeline', $a->profile['username']) . '"/>' . "\n";
-		DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . $parameters['nickname'] . '/" title="' . DI::l10n()->t('%s\'s posts', $a->profile['username']) . '"/>' . "\n";
-		DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . $parameters['nickname'] . '/comments" title="' . DI::l10n()->t('%s\'s comments', $a->profile['username']) . '"/>' . "\n";
-		DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . $parameters['nickname'] . '/activity" title="' . DI::l10n()->t('%s\'s timeline', $a->profile['username']) . '"/>' . "\n";
+		DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/dfrn_poll/' . $parameters['nickname'] . '" title="DFRN: ' . DI::l10n()->t('%s\'s timeline', $a->profile['name']) . '"/>' . "\n";
+		DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . $parameters['nickname'] . '/" title="' . DI::l10n()->t('%s\'s posts', $a->profile['name']) . '"/>' . "\n";
+		DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . $parameters['nickname'] . '/comments" title="' . DI::l10n()->t('%s\'s comments', $a->profile['name']) . '"/>' . "\n";
+		DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . $parameters['nickname'] . '/activity" title="' . DI::l10n()->t('%s\'s timeline', $a->profile['name']) . '"/>' . "\n";
 
 		$category = $datequery = $datequery2 = '';
 
@@ -162,7 +162,7 @@ class Status extends BaseProfile
 		// If not then we can improve the performance with an additional condition
 		$condition = ['uid' => $a->profile['uid'], 'page-flags' => [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_PRVGROUP]];
 		if (!DBA::exists('user', $condition)) {
-			$sql_extra3 = sprintf(" AND `thread`.`contact-id` = %d ", intval(intval($a->profile['contact_id'])));
+			$sql_extra3 = sprintf(" AND `thread`.`contact-id` = %d ", intval(intval($a->profile['id'])));
 		} else {
 			$sql_extra3 = "";
 		}
diff --git a/src/Protocol/Salmon.php b/src/Protocol/Salmon.php
index 0d234b53f0..d082909ae5 100644
--- a/src/Protocol/Salmon.php
+++ b/src/Protocol/Salmon.php
@@ -111,13 +111,13 @@ class Salmon
 	{
 		// does contact have a salmon endpoint?
 
-		if (! strlen($url)) {
+		if (!strlen($url)) {
 			return;
 		}
 
-		if (! $owner['sprvkey']) {
+		if (!$owner['sprvkey']) {
 			Logger::log(sprintf("user '%s' (%d) does not have a salmon private key. Send failed.",
-			$owner['username'], $owner['uid']));
+			$owner['name'], $owner['uid']));
 			return;
 		}
 
diff --git a/static/dbview.config.php b/static/dbview.config.php
index 20da1b2d4d..1d95261a25 100755
--- a/static/dbview.config.php
+++ b/static/dbview.config.php
@@ -103,11 +103,9 @@ return [
 			"name-date" => ["contact", "name-date"],
 			"uri-date" => ["contact", "uri-date"],
 			"avatar-date" => ["contact", "avatar-date"],
-			"contact_id" => ["contact", "id"], /// @todo Replaces all uses of "contact_id" with "id"
 			"picdate" => ["contact", "avatar-date"], /// @todo Replaces all uses of "picdate" with "avatar-date"
 			"term-date" => ["contact", "term-date"],
-			"last-item" => ["contact", "last-item"],			
-			"lastitem_date" => ["contact", "last-item"], /// @todo Replaces all uses of "lastitem_date" with "last-item"
+			"last-item" => ["contact", "last-item"],
 			"priority" => ["contact", "priority"],
 			"blocked" => ["contact", "blocked"], /// @todo Check if "blocked" from contact or from the users table
 			"block_reason" => ["contact", "block_reason"],
@@ -135,7 +133,6 @@ return [
 			"ffi_keyword_blacklist" => ["ffi_keyword_blacklist"],
 			"parent-uid" => ["user", "parent-uid"],
 			"guid" => ["user", "guid"],
-			"username" => ["user", "username"], /// @todo Replaces all uses of "username" with "name"
 			"nickname" => ["user", "nickname"], /// @todo Replaces all uses of "nickname" with "nick"
 			"email" => ["user", "email"],
 			"openid" => ["user", "openid"],
-- 
2.39.5