Mercurial > libervia-backend
changeset 3530:fad3b3ffa8fe
plugin XEP-0050: show notes when there is a data form on completed command:
Notes are now added on completed command, as text widgets.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 05 May 2021 15:37:33 +0200 |
parents | 698579bedd6f |
children | a8259a1f89b2 |
files | sat/plugins/plugin_xep_0050.py |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0050.py Wed May 05 15:37:33 2021 +0200 +++ b/sat/plugins/plugin_xep_0050.py Wed May 05 15:37:33 2021 +0200 @@ -483,7 +483,14 @@ ) if session_id is None: - return xml_tools.dataFormEltResult2XMLUI(data_elt) + xmlui = xml_tools.dataFormEltResult2XMLUI(data_elt) + if notes: + for level, note in notes: + if level != "info": + note = f"[{level}] {note}" + xmlui.addWidget("text", note) + return xmlui + form = data_form.Form.fromElement(data_elt) # we add any present note to the instructions form.instructions.extend(self._mergeNotes(notes))