Skip to content

fix(AniTilky): handle undefined lang setting - #11469

Open
hyqanxd wants to merge 4 commits into
PreMiD:mainfrom
hyqanxd:fix/anitilky-undefined-lang
Open

hyqanxd wants to merge 4 commits into
PreMiD:mainfrom
hyqanxd:fix/anitilky-undefined-lang

Conversation

@hyqanxd

@hyqanxd hyqanxd commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

presence.getSetting<string>('lang') can resolve to undefined (it does not reject), so the .catch(() => 'en') fallback in getSettings() never applied. getStrings() then threw synchronously on lang.startsWith('tr'):

[PreMiD] Error in UpdateData handler: TypeError: Cannot read properties of undefined (reading 'startsWith')

Because strings was never assigned, the !strings check retried on every UpdateData tick and threw again. As a result the console filled with errors and no activity was ever set.

Changes:

  • presence.ts: default the lang setting to 'en' when it resolves to a falsy value
  • functions/strings.ts: getStrings() accepts an optional lang and no longer throws on a missing value
  • metadata.json: bump version 2.0.1 → 2.0.2

Acknowledgements

Screenshots

Proof showing the creation/modification is working as expected

eslint websites/A/AniTilky passes and pmd build AniTilky type-checks and compiles successfully.

Ekran görüntüsü 2026-11-14 172830 Ekran görüntüsü 2026-11-14 172847 Ekran görüntüsü 2026-11-14 172911 Ekran görüntüsü 2026-11-14 172928

Summary by CodeRabbit

  • Bug Fixes
    • Language selection now handles missing or empty values consistently by defaulting to English.
    • Turkish is selected for language values beginning with “tr,” regardless of capitalization; other values use English.

getSetting('lang') can resolve to undefined instead of rejecting, so the
.catch fallback never ran and getStrings threw on lang.startsWith. Because
strings was never assigned, every UpdateData tick retried and threw again,
so no activity was ever set.

Default the setting to 'en' and make getStrings tolerate a missing value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d24e305a-9c51-468e-b7ae-c040d6aff41f
Commits

Reviewing files that changed from the base of the PR and between cbabf97 and 18a3b72.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

AniTilky now defaults empty or missing language values to English. Turkish language matching is case-insensitive. The metadata version changes from 2.0.1 to 2.0.2.

Changes: AniTilky language handling

Layer / File(s) Summary
Language defaults and string selection
websites/A/AniTilky/presence.ts, websites/A/AniTilky/functions/strings.ts, websites/A/AniTilky/metadata.json
getSettings defaults empty and rejected language settings to en. getStrings accepts an omitted language, matches the tr prefix without case sensitivity, and selects English for other values. The metadata version changes to 2.0.2.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: Minimal · previous review ed4f1

This change makes AniTilky fall back to English when the language setting is empty or missing, which prevents repeated errors and a missing activity. It is localized and easy to revert, so merge risk is minimal.

Security architecture risk: Minimal · up to ed4f1

The change restores activity updates when the language setting is missing and preserves existing privacy controls. No introduced or worsened architecture-level security risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title 'fix(AniTilky): handle undefined lang setting' matches the main change. The PR defaults a missing or empty lang setting to 'en', makes the lang parameter of getStrings optional, and bumps th…
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title 'fix(AniTilky): handle undefined lang setting' matches the main change. The PR defaults a missing or empty lang setting to 'en', makes the lang parameter of getStrings optional, and bumps the AniTilky metadata version. The title names the bug fix and the affected component, so a teammate scanning history can identify the primary change.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 63a6217f-5aea-42cf-b396-12cf43df457f
Commits

Reviewing files that changed from the base of the PR and between c8b3fac and ed4f1d3.

Files selected for processing: 3

  • websites/A/AniTilky/functions/strings.ts
  • websites/A/AniTilky/metadata.json
  • websites/A/AniTilky/presence.ts
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@dimerp

dimerp Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

🖼️ Activity asset preview

Another day, another diff. Here's everything shiny I could dig out of this one.

AniTilky (websites/A/AniTilky) — update

Preview Source URL
logo https://cdn.rcd.gg/PreMiD/websites/A/AniTilky/assets/logo.png
thumbnail https://cdn.rcd.gg/PreMiD/websites/A/AniTilky/assets/thumbnail.png

Beep boop — I refresh this comment on every push, so no need to scroll. 🤖

This branch has not been deployed

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

Development

Successfully merging this pull request may close these issues.

1 participant