[gnome-software] odrs: Allow showing review without a display name
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] odrs: Allow showing review without a display name
- Date: Wed, 14 Sep 2016 09:05:28 +0000 (UTC)
commit 40225d2243f59368f35d8f9f4fc555ca44d791d4
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 8cc2781..006a1d7 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 9b6452b..1afcfe3 100644
--- a/src/plugins/gs-plugin-odrs.c
+++ b/src/plugins/gs-plugin-odrs.c
@@ -639,8 +639,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]