fu-util: Only show UpdateMessage when state is success

This will show it only when an update was sucessful.
Fixes: #2212
This commit is contained in:
Mario Limonciello 2020-06-25 09:42:12 -05:00 committed by Mario Limonciello
parent 28d51c036b
commit c2721c8695

View File

@ -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) {