Skip to content

Add Telegram as a configurable social link (#257)#260

Merged
fabiodalez-dev merged 1 commit into
mainfrom
feat/telegram-social-257
Jul 17, 2026
Merged

Add Telegram as a configurable social link (#257)#260
fabiodalez-dev merged 1 commit into
mainfrom
feat/telegram-social-257

Conversation

@fabiodalez-dev

@fabiodalez-dev fabiodalez-dev commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Closes #257.

Adds social_telegram next to the existing five social profile links, so a library can link its Telegram channel/group in the footer the same way it links Facebook, Bluesky, etc. Wired through every sync point of the (fixed-key) social system:

  • ConfigStore defaults + the DB→runtime mapping whitelist
  • SettingsController save + load (General → Social)
  • the Telegram URL input in the settings form
  • the footer render in both frontend/layout.php and user_layout.php
  • the Organization Schema.org sameAs
  • the fresh-install seed in all four locale data files (data_{it,en,de,fr}.sql)

It inherits the social hardening that shipped in 0.7.37: the URL goes through HtmlHelper::sanitizePublicHttpUrl() at output, so only a clean http(s) value renders a link (a javascript:/data:/scheme-less/credentialed value collapses to no link), and the href escapes with htmlspecialchars(..., ENT_QUOTES). i18n placeholder added in all four locales with key parity preserved.

Credit: this implements @Himura2la's request in #257. His PR #258 predated the social-hardening refactor in 0.7.37 (which changed how all socials load/render/validate), so a rebase would have been painful; I built it directly on the hardened base and folded the escaping/validation findings from #258 into it at the same time.

tests/social-links.spec.js now covers six socials — the Telegram footer render (valid https → link, malicious → no link) plus the static invariants (sanitize + escape count, whitelist, sameAs). PHPStan L5 = 0, social-links E2E 27 passed.

Summary by CodeRabbit

  • Nuove funzionalità

    • Aggiunto il supporto a Telegram tra i social configurabili dell’applicazione.
    • È possibile inserire l’URL del canale o gruppo Telegram dal pannello di amministrazione.
    • Il collegamento Telegram viene mostrato nei footer pubblico e utente quando configurato.
    • Telegram è incluso nei dati strutturati del sito e nei test dei collegamenti social.
  • Localizzazione

    • Aggiunti esempi di URL Telegram nelle traduzioni disponibili.
    • Aggiornati alcuni testi informativi relativi agli aggiornamenti in ambienti containerizzati.

Adds social_telegram alongside the existing five social profile links
(facebook/twitter/instagram/linkedin/bluesky), wired through every sync point:
ConfigStore defaults + DB-mapping whitelist, SettingsController save/load, the
General - Social form input, the footer render in both frontend and user
layouts, the Organization Schema.org sameAs, and the fresh-install seed in all
four locale data files. It inherits the social hardening added in 0.7.37: the
URL passes through HtmlHelper::sanitizePublicHttpUrl() at output so only a clean
http(s) link renders, and the href escapes with htmlspecialchars. i18n
placeholder in all four locales (key parity preserved).

Implements the request in #257 by Himura2la (whose PR #258 predated the social
hardening refactor). social-links.spec.js now covers six socials.

Closes #257
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Il PR aggiunge social_telegram alla configurazione, alla persistenza, al pannello amministrativo, ai footer frontend e allo schema Organization.sameAs. Aggiorna inoltre traduzioni, seed SQL e test E2E/statici per includere sei social.

Changes

Supporto social Telegram

Layer / File(s) Summary
Configurazione e persistenza
app/Support/ConfigStore.php, installer/database/data_*.sql
Aggiunge app.social_telegram ai default, al caricamento dal database e ai seed localizzati.
Impostazioni amministrative
app/Controllers/SettingsController.php, app/Views/settings/index.php, locale/*.json
Espone il campo URL Telegram, salva il valore sanificato e lo risolve nelle impostazioni applicative; aggiorna le traduzioni correlate.
Rendering frontend e dati strutturati
app/Views/frontend/layout.php, app/Views/user_layout.php, app/Controllers/FrontendController.php
Sanitizza e visualizza il link Telegram nei footer e lo aggiunge a Organization.sameAs quando valorizzato.
Copertura dei test
tests/social-links.spec.js
Estende i test E2E e statici da cinque a sei social, includendo Telegram e i relativi controlli di sanitizzazione e wiring.

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

Sequence Diagram(s)

sequenceDiagram
  participant Amministratore
  participant SettingsController
  participant ConfigStore
  participant Frontend
  Amministratore->>SettingsController: salva URL Telegram
  SettingsController->>ConfigStore: aggiorna app.social_telegram
  ConfigStore-->>Frontend: restituisce URL configurato
  Frontend->>Frontend: sanitizza URL
  Frontend-->>Amministratore: mostra link Telegram nel footer
Loading

Possibly related PRs

  • fabiodalez-dev/Pinakes#258: implementa la stessa integrazione del link social Telegram nei controller, nella configurazione, nei footer, nei seed e nei test.

Suggested reviewers: fabiodalez

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Nei file locale compaiono anche modifiche a una stringa Docker non collegata alla nuova configurazione Telegram. Rimuovi o sposta in una PR separata le modifiche al messaggio Docker se non servono a #257.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 60.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 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: aggiunta di Telegram come social link configurabile.
Linked Issues check ✅ Passed La PR aggiunge Telegram alle liste social, l’icona/link relativo e l’aggiornamento SQL per la nuova chiave.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/telegram-social-257

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: 3

🤖 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 135: Sanitize and validate the non-empty social_telegram value before
persisting or caching it in SettingsController using
HtmlHelper::sanitizePublicHttpUrl(). Reject the request when the value is not a
valid public HTTP(S) URL, while preserving empty values and the existing trimmed
input handling.

In `@app/Views/settings/index.php`:
- Around line 221-225: Sostituisci HtmlHelper::e() nel valore dell’input
social_telegram con htmlspecialchars(..., ENT_QUOTES, 'UTF-8'), mantenendo il
fallback a stringa vuota e l’escaping applicato direttamente all’attributo
value.

In `@installer/database/data_en_US.sql`:
- Line 231: Prevent the seed upsert from overwriting configured social_telegram
values with an empty default by separating this entry from the default upsert or
preserving the existing setting_value. Apply the same correction at
installer/database/data_en_US.sql:231-231,
installer/database/data_de_DE.sql:233-233,
installer/database/data_fr_FR.sql:233-233, and
installer/database/data_it_IT.sql:284-284.
🪄 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: 8e294c7d-94c9-4c0c-bf52-d1ecc8584abb

📥 Commits

Reviewing files that changed from the base of the PR and between 36df4fe and 5cfe206.

📒 Files selected for processing (15)
  • app/Controllers/FrontendController.php
  • app/Controllers/SettingsController.php
  • app/Support/ConfigStore.php
  • app/Views/frontend/layout.php
  • app/Views/settings/index.php
  • app/Views/user_layout.php
  • installer/database/data_de_DE.sql
  • installer/database/data_en_US.sql
  • installer/database/data_fr_FR.sql
  • installer/database/data_it_IT.sql
  • locale/de_DE.json
  • locale/en_US.json
  • locale/fr_FR.json
  • locale/it_IT.json
  • tests/social-links.spec.js

Comment thread app/Controllers/SettingsController.php
Comment thread app/Views/settings/index.php
Comment thread installer/database/data_en_US.sql
@fabiodalez-dev
fabiodalez-dev merged commit 2c56c33 into main Jul 17, 2026
7 checks passed
@fabiodalez-dev
fabiodalez-dev deleted the feat/telegram-social-257 branch July 17, 2026 14:33
fabiodalez-dev added a commit that referenced this pull request Jul 17, 2026
Escape social settings inputs with htmlspecialchars (CodeRabbit on #260)
Himura2la pushed a commit to hackerembassy/Pinakes that referenced this pull request Jul 17, 2026
…alchars, not HtmlHelper::e

CodeRabbit flagged the Telegram input for using HtmlHelper::e() in a view, which
the project rules forbid — but all six social inputs (facebook/twitter/
instagram/linkedin/bluesky/telegram) had the same pattern. Converted them all to
htmlspecialchars(..., ENT_QUOTES, 'UTF-8') for consistency, not just the one
CodeRabbit saw.
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.

Add Telegram to social links

1 participant