Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call, Contact, Image items: Don't create command descr from state descr #4097

Merged

Conversation

florian-h05
Copy link
Contributor

If a state description is set on a contact item, currently a command description is automatically created as well.
This is wrong as contact items do not accept commands (except refresh) and caused the UI to display a control for the default (list) widget for these contacts.

…are not accepted

If a state description is set on a contact item, currently a command description is automatically created as well.
This is wrong as contact items do not accept commands (except refresh) and caused the UI to display a control for the default (list) widget for these contacts.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
@florian-h05 florian-h05 requested a review from a team as a code owner February 17, 2024 19:18
@J-N-K
Copy link
Member

J-N-K commented Feb 19, 2024

Doesn't that apply to ImageItem and CallItem, too?

@J-N-K J-N-K added the bug An unexpected problem or unintended behavior of the Core label Feb 19, 2024
@florian-h05
Copy link
Contributor Author

True, I can fix them too.

One thing that however needs to be thought of, is that it then won't be possible to set a command description anymore.
What if I would like to add a command description to send the REFRESH command?

We could create a protected method GenericItem::getCommandOptions which onyl returns the command options, and does not fallback to state description. This method could then be used internally by GenericItem::getCommandDescription and by the overrides in ContactItem, ImageItem and CallItem. WDYT?

…ription

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
@florian-h05
Copy link
Contributor Author

@J-N-K FYI I went ahead and implemented my proposal, easy to revert in case you don't like it.

@florian-h05 florian-h05 changed the title Contact item: Do not create command descr from state descr Call, Contact, Image items: Do not create command descr from state descr Feb 19, 2024
@florian-h05 florian-h05 changed the title Call, Contact, Image items: Do not create command descr from state descr Call, Contact, Image items: Don't create command descr from state descr Feb 19, 2024
@florian-h05
Copy link
Contributor Author

It would be nice if we could squeeze that one into the milestone as well 👍

Copy link
Member

@kaikreuzer kaikreuzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go with that, thanks!

@kaikreuzer kaikreuzer merged commit f4d6089 into openhab:main Mar 3, 2024
3 checks passed
@kaikreuzer kaikreuzer added this to the 4.2 milestone Mar 3, 2024
@florian-h05 florian-h05 deleted the contact-item-command-description branch March 3, 2024 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of the Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants