Rename description field to notes in Habitica action (#139271)

This commit is contained in:
Manu 2025-02-25 17:03:31 +01:00 committed by GitHub
parent 433c2cb43e
commit 9ec9110e1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 13 deletions

View File

@ -39,6 +39,7 @@ ATTR_REMOVE_TAG = "remove_tag"
ATTR_ALIAS = "alias"
ATTR_PRIORITY = "priority"
ATTR_COST = "cost"
ATTR_NOTES = "notes"
SERVICE_CAST_SKILL = "cast_skill"
SERVICE_START_QUEST = "start_quest"

View File

@ -22,7 +22,7 @@ from habiticalib import (
)
import voluptuous as vol
from homeassistant.components.todo import ATTR_DESCRIPTION, ATTR_RENAME
from homeassistant.components.todo import ATTR_RENAME
from homeassistant.config_entries import ConfigEntryState
from homeassistant.const import ATTR_NAME, CONF_NAME
from homeassistant.core import (
@ -45,6 +45,7 @@ from .const import (
ATTR_DIRECTION,
ATTR_ITEM,
ATTR_KEYWORD,
ATTR_NOTES,
ATTR_PATH,
ATTR_PRIORITY,
ATTR_REMOVE_TAG,
@ -116,7 +117,7 @@ SERVICE_UPDATE_TASK_SCHEMA = vol.Schema(
vol.Required(ATTR_CONFIG_ENTRY): ConfigEntrySelector(),
vol.Required(ATTR_TASK): cv.string,
vol.Optional(ATTR_RENAME): cv.string,
vol.Optional(ATTR_DESCRIPTION): cv.string,
vol.Optional(ATTR_NOTES): cv.string,
vol.Optional(ATTR_TAG): vol.All(cv.ensure_list, [str]),
vol.Optional(ATTR_REMOVE_TAG): vol.All(cv.ensure_list, [str]),
vol.Optional(ATTR_ALIAS): vol.All(
@ -566,8 +567,8 @@ def async_setup_services(hass: HomeAssistant) -> None: # noqa: C901
if rename := call.data.get(ATTR_RENAME):
data["text"] = rename
if (description := call.data.get(ATTR_DESCRIPTION)) is not None:
data["notes"] = description
if (notes := call.data.get(ATTR_NOTES)) is not None:
data["notes"] = notes
tags = cast(list[str], call.data.get(ATTR_TAG))
remove_tags = cast(list[str], call.data.get(ATTR_REMOVE_TAG))

View File

@ -147,7 +147,7 @@ update_reward:
rename:
selector:
text:
description:
notes:
required: false
selector:
text:

View File

@ -12,8 +12,8 @@
"task_description": "The name (or task ID) of the task you want to update.",
"rename_name": "Rename",
"rename_description": "The new title for the Habitica task.",
"description_name": "Update description",
"description_description": "The new description for the Habitica task.",
"notes_name": "Update notes",
"notes_description": "The new notes for the Habitica task.",
"tag_name": "Add tags",
"tag_description": "Add tags to the Habitica task. If a tag does not already exist, a new one will be created.",
"remove_tag_name": "Remove tags",
@ -690,9 +690,9 @@
"name": "[%key:component::habitica::common::rename_name%]",
"description": "[%key:component::habitica::common::rename_description%]"
},
"description": {
"name": "[%key:component::habitica::common::description_name%]",
"description": "[%key:component::habitica::common::description_description%]"
"notes": {
"name": "[%key:component::habitica::common::notes_name%]",
"description": "[%key:component::habitica::common::notes_description%]"
},
"tag": {
"name": "[%key:component::habitica::common::tag_name%]",

View File

@ -17,6 +17,7 @@ from homeassistant.components.habitica.const import (
ATTR_DIRECTION,
ATTR_ITEM,
ATTR_KEYWORD,
ATTR_NOTES,
ATTR_PRIORITY,
ATTR_REMOVE_TAG,
ATTR_SKILL,
@ -38,7 +39,7 @@ from homeassistant.components.habitica.const import (
SERVICE_TRANSFORMATION,
SERVICE_UPDATE_REWARD,
)
from homeassistant.components.todo import ATTR_DESCRIPTION, ATTR_RENAME
from homeassistant.components.todo import ATTR_RENAME
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError, ServiceValidationError
@ -984,9 +985,9 @@ async def test_task_not_found(
),
(
{
ATTR_DESCRIPTION: "DESCRIPTION",
ATTR_NOTES: "NOTES",
},
Task(notes="DESCRIPTION"),
Task(notes="NOTES"),
),
(
{