[gnome-software/gnome-3-22] odrs: Allow showing review without a display name
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-22] odrs: Allow showing review without a display name
- Date: Mon, 19 Sep 2016 15:59:27 +0000 (UTC)
commit 36be71230dd5b62614ec33776e246a5b4d3cd7d6
Author: Richard Hughes <richard hughsie com>
Date: Wed Sep 14 09:50:23 2016 +0100
odrs: Allow showing review without a display name
Recent versions of the ODRS are not saving invalid usernames like 'root' and
so don't set a reviewer_name property in the returned JSON.
Also, not a string freeze break, the 'Unknown' text is already translated.
src/gs-review-row.c | 6 +++++-
src/plugins/gs-plugin-odrs.c | 2 --
2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/gs-review-row.c b/src/gs-review-row.c
index c85c71a..4d4fde4 100644
--- a/src/gs-review-row.c
+++ b/src/gs-review-row.c
@@ -66,7 +66,11 @@ gs_review_row_refresh (GsReviewRow *row)
gs_star_widget_set_rating (GS_STAR_WIDGET (priv->stars),
as_review_get_rating (priv->review));
reviewer = as_review_get_reviewer_name (priv->review);
- gtk_label_set_text (GTK_LABEL (priv->author_label), reviewer ? reviewer : "");
+ if (reviewer == NULL) {
+ /* TRANSLATORS: this is when a user doesn't specify a name */
+ reviewer = _("Unknown");
+ }
+ gtk_label_set_text (GTK_LABEL (priv->author_label), reviewer);
date = as_review_get_date (priv->review);
if (date != NULL)
text = g_date_time_format (date, "%e %B %Y");
diff --git a/src/plugins/gs-plugin-odrs.c b/src/plugins/gs-plugin-odrs.c
index 85093d2..098a3de 100644
--- a/src/plugins/gs-plugin-odrs.c
+++ b/src/plugins/gs-plugin-odrs.c
@@ -616,8 +616,6 @@ gs_plugin_refine_reviews (GsPlugin *plugin,
/* ignore invalid reviews */
if (as_review_get_rating (review) == 0)
continue;
- if (as_review_get_reviewer_name (review) == NULL)
- continue;
/* the user_hash matches, so mark this as our own review */
if (g_strcmp0 (as_review_get_reviewer_id (review),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]