Fix [object Object] in Variables button + allow preview of system templates
Some checks failed
Validate / Hassfest (push) Has been cancelled
Some checks failed
Validate / Hassfest (push) Has been cancelled
- Escape {{ }} in Svelte template (use {'{{ }}'} string expression)
- Allow _get() to access system templates (user_id=0) for preview
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -133,7 +133,7 @@
|
|||||||
<label class="text-xs text-[var(--color-muted-foreground)]">{t(`templateConfig.${slot.label}`)}</label>
|
<label class="text-xs text-[var(--color-muted-foreground)]">{t(`templateConfig.${slot.label}`)}</label>
|
||||||
{#if varsRef[slot.key]}
|
{#if varsRef[slot.key]}
|
||||||
<button type="button" onclick={() => showVarsFor = slot.key}
|
<button type="button" onclick={() => showVarsFor = slot.key}
|
||||||
class="text-xs text-[var(--color-muted-foreground)] hover:underline">{{ }} Variables</button>
|
class="text-xs text-[var(--color-muted-foreground)] hover:underline">{'{{ }}'} Variables</button>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if (slot.rows || 2) > 2}
|
{#if (slot.rows || 2) > 2}
|
||||||
|
|||||||
@@ -165,6 +165,6 @@ def _response(c: TemplateConfig) -> dict:
|
|||||||
|
|
||||||
async def _get(session: AsyncSession, config_id: int, user_id: int) -> TemplateConfig:
|
async def _get(session: AsyncSession, config_id: int, user_id: int) -> TemplateConfig:
|
||||||
config = await session.get(TemplateConfig, config_id)
|
config = await session.get(TemplateConfig, config_id)
|
||||||
if not config or config.user_id != user_id:
|
if not config or (config.user_id != user_id and config.user_id != 0):
|
||||||
raise HTTPException(status_code=404, detail="Template config not found")
|
raise HTTPException(status_code=404, detail="Template config not found")
|
||||||
return config
|
return config
|
||||||
|
|||||||
Reference in New Issue
Block a user