From c2721c8695ddb4bfe9d0dd9844d453528a4fbe39 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Thu, 25 Jun 2020 09:42:12 -0500 Subject: [PATCH] fu-util: Only show UpdateMessage when state is success This will show it only when an update was sucessful. Fixes: #2212 --- src/fu-util-common.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/fu-util-common.c b/src/fu-util-common.c index aec814efd..c0f2b243f 100644 --- a/src/fu-util-common.c +++ b/src/fu-util-common.c @@ -1210,17 +1210,20 @@ fu_util_device_to_string (FwupdDevice *dev, guint idt) /* TRANSLATORS: hardware state, e.g. "pending" */ fu_common_string_append_kv (str, idt + 1, _("Update State"), fwupd_update_state_to_string (state)); + + if (state == FWUPD_UPDATE_STATE_SUCCESS) { + tmp = fwupd_device_get_update_message (dev); + if (tmp != NULL) { + /* TRANSLATORS: helpful messages from last update */ + fu_common_string_append_kv (str, idt + 1, _("Update Message"), tmp); + } + } } tmp = fwupd_device_get_update_error (dev); if (tmp != NULL) { /* TRANSLATORS: error message from last update attempt */ fu_common_string_append_kv (str, idt + 1, _("Update Error"), tmp); } - tmp = fwupd_device_get_update_message (dev); - if (tmp != NULL) { - /* TRANSLATORS: helpful messages from last update */ - fu_common_string_append_kv (str, idt + 1, _("Update Message"), tmp); - } /* modified date: for history devices */ if (modified > 0) {