Skip to content

Add Telegram as a configurable social link#258

Open
Himura2la wants to merge 1 commit into
fabiodalez-dev:mainfrom
hackerembassy:add-telegram-to-social-links
Open

Add Telegram as a configurable social link#258
Himura2la wants to merge 1 commit into
fabiodalez-dev:mainfrom
hackerembassy:add-telegram-to-social-links

Conversation

@Himura2la

@Himura2la Himura2la commented Jul 17, 2026

Copy link
Copy Markdown

Implements #257

AI Description

This PR adds social_telegram across the same paths currently used by other app social links, so Telegram can be configured in admin settings and rendered in public/user footers. It also adds DB coverage for both fresh installs (seed data) and upgrades (migration).

  • Config + persistence wiring

    • Added social_telegram to app defaults and DB-loaded social key set in ConfigStore.
    • Added social_telegram to general settings save/load flow in SettingsController.
  • Admin settings UI

    • Added Telegram URL input in General → Social Links (social_telegram), with Font Awesome brand icon and Telegram placeholder URL.
    • Uses project-consistent icon class style: fa-brands fa-telegram.
  • Frontend rendering

    • Added app.social_telegram read in both layout templates:
      • app/Views/frontend/layout.php
      • app/Views/user_layout.php
    • Renders Telegram icon/link only when configured (same conditional pattern as existing social links).
  • Database install/upgrade coverage

    • Added app.social_telegram seed row to:
      • installer/database/data_en_US.sql
      • installer/database/data_de_DE.sql
      • installer/database/data_fr_FR.sql
      • installer/database/data_it_IT.sql
    • Added idempotent migration installer/database/migrations/migrate_0.7.35.sql inserting the new setting for existing installations.
  • Docs + focused regression guard

    • Updated social links list in docs/settings.MD.
    • Added focused static unit check: tests/issue-257-telegram-social-links.unit.php.
// app/Support/ConfigStore.php
$socialKeys = [
    'social_facebook',
    'social_twitter',
    'social_instagram',
    'social_linkedin',
    'social_bluesky',
    'social_telegram',
];

Summary by CodeRabbit

  • Nuove funzionalità

    • Aggiunto il supporto per configurare il link al profilo Telegram nelle impostazioni generali.
    • Il link Telegram viene visualizzato nel footer pubblico quando configurato.
    • Inclusa l’inizializzazione dell’impostazione nelle nuove installazioni e negli aggiornamenti.
  • Documentazione

    • Aggiornate le informazioni sulle impostazioni del footer per includere Telegram.
  • Test

    • Aggiunti controlli automatici per verificare la configurazione e visualizzazione del link Telegram.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Himura2la, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d3f56f47-ccb7-4987-be41-5f5320bbce1c

📥 Commits

Reviewing files that changed from the base of the PR and between db64bb4 and 735762b.

📒 Files selected for processing (12)
  • app/Controllers/SettingsController.php
  • app/Support/ConfigStore.php
  • app/Views/frontend/layout.php
  • app/Views/settings/index.php
  • app/Views/user_layout.php
  • docs/settings.MD
  • installer/database/data_de_DE.sql
  • installer/database/data_en_US.sql
  • installer/database/data_fr_FR.sql
  • installer/database/data_it_IT.sql
  • installer/database/migrations/migrate_0.7.35.sql
  • tests/issue-257-telegram-social-links.unit.php
📝 Walkthrough

Walkthrough

Aggiunge social_telegram alla configurazione applicativa, alla persistenza SQL, al pannello impostazioni e ai footer frontend. Il valore viene salvato tramite SettingsController, caricato da ConfigStore e verificato da un test statico.

Changes

Link social Telegram

Layer / File(s) Summary
Configurazione e persistenza
app/Support/ConfigStore.php, installer/database/migrations/..., installer/database/data_*.sql
Aggiunge il valore predefinito, il caricamento da database, i seed localizzati e la migrazione 0.7.35 per social_telegram.
Gestione nel pannello impostazioni
app/Controllers/SettingsController.php, app/Views/settings/index.php, docs/settings.MD
Espone il campo URL Telegram, salva il valore nelle impostazioni generali e lo risolve con fallback su ConfigStore; aggiorna la documentazione della tab generale.
Rendering nei footer e validazione
app/Views/frontend/layout.php, app/Views/user_layout.php, tests/issue-257-telegram-social-links.unit.php
Mostra il link Telegram nei footer quando valorizzato e verifica staticamente i riferimenti alla nuova impostazione.

Estimated code review effort: 2 (Simple) | ~10 minuti

Sequence Diagram(s)

sequenceDiagram
  participant Admin
  participant SettingsController
  participant SettingsRepository
  participant ConfigStore
  participant Footer
  Admin->>SettingsController: invia social_telegram
  SettingsController->>SettingsRepository: salva impostazione
  SettingsController->>ConfigStore: sincronizza configurazione
  Footer->>ConfigStore: legge app.social_telegram
  ConfigStore-->>Footer: restituisce URL Telegram
  Footer-->>Admin: renderizza link se valorizzato
Loading

Suggested reviewers: fabiodalez-dev

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Il titolo riassume bene il cambiamento principale: Telegram viene aggiunto come link social configurabile.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/Controllers/SettingsController.php`:
- Line 131: Aggiorna la gestione di social_telegram in SettingsController per
sanitizzare lato server l’URL tramite HtmlHelper::sanitizePublicHttpUrl().
Mantieni vuoto il valore se l’input è vuoto, ma rifiuta gli URL non validi o con
schemi non HTTP(S) prima della persistenza, evitando di salvare valori come
javascript:.

In `@app/Views/frontend/layout.php`:
- Around line 1678-1681: Replace HtmlHelper::e($socialTelegram) with
htmlspecialchars($socialTelegram, ENT_QUOTES, 'UTF-8') in the Telegram href of
app/Views/frontend/layout.php lines 1678-1681 and app/Views/user_layout.php
lines 1067-1070; no other changes are needed.

In `@docs/settings.MD`:
- Line 40: Aggiorna la descrizione operativa dei social nella sezione successiva
della documentazione, includendo Telegram insieme alle piattaforme già elencate.
Mantieni invariato il resto dei contenuti e allinea l’elenco alla voce della
tabella `general`.

In `@installer/database/data_it_IT.sql`:
- Line 284: Rendi non distruttivo il seeding della chiave social_telegram
nell’INSERT bulk con ON DUPLICATE KEY UPDATE: il valore vuoto deve essere
inserito solo quando la chiave non esiste e non deve sovrascrivere un link
Telegram già configurato durante riesecuzioni del seeder.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2eb7e2a5-1609-4a78-bb7d-641a869af153

📥 Commits

Reviewing files that changed from the base of the PR and between 63f5c04 and db64bb4.

📒 Files selected for processing (12)
  • app/Controllers/SettingsController.php
  • app/Support/ConfigStore.php
  • app/Views/frontend/layout.php
  • app/Views/settings/index.php
  • app/Views/user_layout.php
  • docs/settings.MD
  • installer/database/data_de_DE.sql
  • installer/database/data_en_US.sql
  • installer/database/data_fr_FR.sql
  • installer/database/data_it_IT.sql
  • installer/database/migrations/migrate_0.7.35.sql
  • tests/issue-257-telegram-social-links.unit.php

'social_instagram' => trim((string) ($data['social_instagram'] ?? '')),
'social_linkedin' => trim((string) ($data['social_linkedin'] ?? '')),
'social_bluesky' => trim((string) ($data['social_bluesky'] ?? '')),
'social_telegram' => trim((string) ($data['social_telegram'] ?? '')),

@coderabbitai coderabbitai Bot Jul 17, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Validare e sanitizzare l’URL Telegram lato server.

type="url" è solo una validazione client-side: un POST arbitrario può salvare javascript: o altri schemi pericolosi, che diventano eseguibili quando il valore viene usato nel footer. Riusa HtmlHelper::sanitizePublicHttpUrl() e rifiuta valori non vuoti non validi prima di persisterli.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/Controllers/SettingsController.php` at line 131, Aggiorna la gestione di
social_telegram in SettingsController per sanitizzare lato server l’URL tramite
HtmlHelper::sanitizePublicHttpUrl(). Mantieni vuoto il valore se l’input è
vuoto, ma rifiuta gli URL non validi o con schemi non HTTP(S) prima della
persistenza, evitando di salvare valori come javascript:.

Source: Path instructions

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

My change is stereotyped, the issue targets the existing code.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@Himura2la, corretto che il pattern esisteva già. Tuttavia social_telegram aggiunge un nuovo input persistito e renderizzato nel footer, quindi eredita direttamente la stessa vulnerabilità.

Per una correzione coerente, validerei tutti i link social nel loop con HtmlHelper::sanitizePublicHttpUrl() e rifiuterei qualsiasi valore non vuoto che non sia HTTP(S), invece di limitarsi a Telegram.

Comment on lines +1678 to +1681
<?php if ($socialTelegram !== ''): ?>
<a href="<?= HtmlHelper::e($socialTelegram) ?>" target="_blank" rel="noopener noreferrer"><i
class="fa-brands fa-telegram"></i></a>
<?php endif; ?>

@coderabbitai coderabbitai Bot Jul 17, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win

Violazione delle direttive di progetto: non usare HtmlHelper::e() nelle view.

Entrambi i file utilizzano HtmlHelper::e() all'interno dell'attributo href del link Telegram. Come da istruzioni di progetto, l'uso di HtmlHelper::e() nelle view è severamente vietato e costituisce un rischio per la sicurezza (XSS). Occorre usare obbligatoriamente htmlspecialchars(..., ENT_QUOTES, 'UTF-8') per tutti gli attributi HTML.

  • app/Views/frontend/layout.php#L1678-L1681: sostituisci HtmlHelper::e($socialTelegram) con htmlspecialchars($socialTelegram, ENT_QUOTES, 'UTF-8').
  • app/Views/user_layout.php#L1067-L1070: sostituisci HtmlHelper::e($socialTelegram) con htmlspecialchars($socialTelegram, ENT_QUOTES, 'UTF-8').
🛡️ Modifica suggerita
-                            <a href="<?= HtmlHelper::e($socialTelegram) ?>" target="_blank" rel="noopener noreferrer"><i
+                            <a href="<?= htmlspecialchars($socialTelegram, ENT_QUOTES, 'UTF-8') ?>" target="_blank" rel="noopener noreferrer"><i
                                     class="fa-brands fa-telegram"></i></a>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<?php if ($socialTelegram !== ''): ?>
<a href="<?= HtmlHelper::e($socialTelegram) ?>" target="_blank" rel="noopener noreferrer"><i
class="fa-brands fa-telegram"></i></a>
<?php endif; ?>
<?php if ($socialTelegram !== ''): ?>
<a href="<?= htmlspecialchars($socialTelegram, ENT_QUOTES, 'UTF-8') ?>" target="_blank" rel="noopener noreferrer"><i
class="fa-brands fa-telegram"></i></a>
<?php endif; ?>
📍 Affects 2 files
  • app/Views/frontend/layout.php#L1678-L1681 (this comment)
  • app/Views/user_layout.php#L1067-L1070
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/Views/frontend/layout.php` around lines 1678 - 1681, Replace
HtmlHelper::e($socialTelegram) with htmlspecialchars($socialTelegram,
ENT_QUOTES, 'UTF-8') in the Telegram href of app/Views/frontend/layout.php lines
1678-1681 and app/Views/user_layout.php lines 1067-1070; no other changes are
needed.

Source: Path instructions

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

My change is stereotyped, the issue targets the existing code.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@Himura2la Capisco: il pattern esisteva già. Tuttavia, le due occorrenze di Telegram sono nuove in questa PR e ricadono nella regola esplicita per app/Views/**.

La richiesta resta quindi limitata ai nuovi link Telegram; non richiede di modificare i link social preesistenti.

Comment thread docs/settings.MD
Comment thread installer/database/data_it_IT.sql
@Himura2la
Himura2la force-pushed the add-telegram-to-social-links branch from db64bb4 to c2c396f Compare July 17, 2026 08:14
@Himura2la
Himura2la force-pushed the add-telegram-to-social-links branch from c2c396f to 735762b Compare July 17, 2026 08:19
@Himura2la

Himura2la commented Jul 17, 2026

Copy link
Copy Markdown
Author

sorry for several AI-review triggers, I fucked up with git history two times...

UPD: oh, I see it did not run on on my amends/force-pushes, great! Review limit saved us.

fabiodalez-dev added a commit that referenced this pull request Jul 17, 2026
…updater message + official image in README

- Social links (footer, frontend + user layouts) now pass through
  HtmlHelper::sanitizePublicHttpUrl() at load, so only clean http(s) URLs are
  rendered — a javascript:/no-scheme/credentialed value stored for ANY social
  (facebook, twitter, instagram, linkedin, bluesky) collapses to no link instead
  of a clickable href. The hrefs escape with htmlspecialchars(..., ENT_QUOTES)
  per the view rule (HtmlHelper::e removed from the social hrefs). This closes
  the same stored-URL class the Telegram PR (#258) surfaced, at the root and for
  every social, not just one.
- Updater: the "files not writable inside a container" message no longer presumes
  "you're running the Docker image". It's reached only after the writability
  check already failed (a community image with a writable code volume passes that
  check and never lands here), so the wording now states the real condition and
  covers both the official read-only image (fabiodalez/pinakes) and a community
  image whose code volume is currently read-only. Reworded in all four locales.
- README: added the official Docker image — fabiodalez/pinakes on Docker Hub
  (+ GHCR), source at fabiodalez-dev/pinakes-docker — and clarified the community
  jbenamy image keeps code in a writable volume.
@fabiodalez-dev

Copy link
Copy Markdown
Owner

A few notes on the CodeRabbit findings — two of the three are pre-existing patterns across all the social links, not anything this PR introduced:

  • URL validation + HtmlHelper::e in the social href (SettingsController / footer layouts): every existing social (facebook / twitter / instagram / linkedin / bluesky) has the same shape, so I've hardened them at the root in the release branch — social URLs now pass through HtmlHelper::sanitizePublicHttpUrl() at output (only clean http(s) renders; a javascript: / no-scheme / credentialed value collapses to no link) and the hrefs use htmlspecialchars(..., ENT_QUOTES) (d0bbad9). Once you rebase on the upcoming stable, social_telegram inherits that automatically, so those two don't need a separate fix here.
  • Seed ON DUPLICATE KEY UPDATE: your social_telegram seed line is identical to the five existing socials in the same bulk INSERT, and the seed only runs on a fresh install (upgrades run migrations, not the seed), so a configured value isn't reset in normal use. If we make that seed strictly non-destructive it should cover all six socials together — I'll do that separately rather than singling out Telegram.

So after a rebase this reduces to just the social_telegram wiring, which is the useful part. No worries at all about the git-history/AI-review triggers — and good call: I'll set outside-collaborator workflow runs to require approval so a rebase doesn't fan out review runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants