[aur-dev] [PATCH] Write "Anonymous comment" if commenter is deleted

Marcel Korpel marcel.korpel at gmail.com
Fri Jul 10 23:06:39 UTC 2015


Due to the use of html_format_username() the username was set to "None"
if the user was deleted, causing the condition of an empty username
never being met. Fixed with an extra variable that stores the formatted
username.

Signed-off-by: Marcel Korpel <marcel.korpel at gmail.com>
---
 web/template/pkg_comments.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/web/template/pkg_comments.php b/web/template/pkg_comments.php
index e86db3b..3c2db72 100644
--- a/web/template/pkg_comments.php
+++ b/web/template/pkg_comments.php
@@ -17,13 +17,13 @@ $count = pkgbase_comments_count($base_id, $include_deleted);
 
 	<?php while (list($indx, $row) = each($comments)): ?>
 		<?php
-		$row['UserName'] = html_format_username($row['UserName']);
+		$formatted_username = html_format_username($row['UserName']);
 		$row['DelUserName'] = html_format_username($row['DelUserName']);
 		$row['EditUserName'] = html_format_username($row['EditUserName']);
 		?>
 		<h4 id="comment-<?= $row['ID'] ?>"<?php if ($row['DelUsersID']): ?> class="comment-deleted"<?php endif; ?>>
 			<?php if ($row['UserName']): ?>
-			<?= __('%s commented', $row['UserName']) ?>
+			<?= __('%s commented', $formatted_username) ?>
 			<?php else: ?>
 			<?= __('Anonymous comment') ?>
 			<?php endif; ?>
-- 
2.4.5


More information about the aur-dev mailing list