Skip to content

Fix PAT and chat api#3160

Merged
feruzm merged 4 commits intodevelopmentfrom
api
Apr 2, 2026
Merged

Fix PAT and chat api#3160
feruzm merged 4 commits intodevelopmentfrom
api

Conversation

@feruzm
Copy link
Copy Markdown
Member

@feruzm feruzm commented Apr 2, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved chat session handling to prevent cross-account session conflicts and ensure unread counts update reliably.
  • New Features
    • Added a wave-style image grid for multi-image posts, improving gallery layout and image sizing.
  • Chores
    • Bumped several dependency versions for stability and maintenance.
    • Added ignore rule to exclude IDE settings directory.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 546cc4ae-6eed-458e-9e55-a8ab25f25021

📥 Commits

Reviewing files that changed from the base of the PR and between 38ca423 and be69dc0.

📒 Files selected for processing (3)
  • .gitignore
  • android/.settings/org.eclipse.buildship.core.prefs
  • src/components/postHtmlRenderer/postHtmlRenderer.tsx
✅ Files skipped from review due to trivial changes (1)
  • .gitignore
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/components/postHtmlRenderer/postHtmlRenderer.tsx
  • android/.settings/org.eclipse.buildship.core.prefs

📝 Walkthrough

Walkthrough

Added token-owner tracking for the shared chat API instance; setChatApiToken now accepts an optional username and updates owner state only when both token and username are provided. Mattermost bootstrap passes username; unread-chat refresh checks ownership to avoid stale concurrent updates.

Changes

Cohort / File(s) Summary
Token Ownership Infrastructure
src/config/chatApi.ts
Added _currentTokenOwner module state; changed `setChatApiToken(token: string
Bootstrap Provider Integration
src/providers/chat/mattermost.ts
bootstrapMattermostSession now calls setChatApiToken(data.token, payload.username) to record token owner during session bootstrap.
Concurrency Safety Guard
src/screens/application/container/applicationContainer.tsx
Imported getChatApiTokenOwner; captured currentAccount?.name as username; after bootstrap, early-return if getChatApiTokenOwner() ≠ captured username, preventing stale unread-chat updates.
Post HTML Renderer UI
src/components/postHtmlRenderer/postHtmlRenderer.tsx
Grouped adjacent image-only <p> blocks into wave-image-grid; adjusted image rendering to half-width/aspect ratio and paragraph styling; added wave-image-grid styles.
Build Settings
android/.settings/org.eclipse.buildship.core.prefs
Cleared Gradle arguments and java.home values (IDE/Gradle prefs changed).
Dependencies
package.json
Bumped @ecency/render-helper, @ecency/sdk, and @hiveio/dhive versions.
VCS Ignore
.gitignore
Added rule to ignore android/.settings/ directory.

Sequence Diagram

sequenceDiagram
    participant AC as ApplicationContainer
    participant MMP as MattermostProvider
    participant API as ChatApiConfig

    AC->>MMP: bootstrapMattermostSession(account, pin)
    MMP->>API: setChatApiToken(token, username)
    API->>API: _currentTokenOwner = username
    MMP-->>AC: bootstrap complete
    AC->>API: getChatApiTokenOwner()
    API-->>AC: returns current owner
    alt owner == captured username
        AC->>AC: fetch & update unread chats
    else owner != captured username
        AC->>AC: skip unread chat update (stale/concurrent)
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • Waves improvements #3156 — Related changes to src/components/postHtmlRenderer/postHtmlRenderer.tsx implementing wave-image grouping and rendering adjustments.

Poem

🐰 I found a token, kept its name,
I hopped around to guard its claim,
When sessions race and answers stray,
I check the owner, then I stay.
A tiny hop to keep things sane 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Fix PAT and chat api' is vague and does not clearly summarize the main changes in the pull request, which involve tracking token ownership in the chat API and updating related dependencies. Consider a more descriptive title such as 'Track token ownership in chat API calls' or 'Add username tracking to chat API token management' to better reflect the primary technical changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 api

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 and usage tips.

coderabbitai[bot]

This comment was marked as resolved.

@feruzm feruzm marked this pull request as draft April 2, 2026 10:58
@feruzm feruzm marked this pull request as ready for review April 2, 2026 10:58
@feruzm feruzm merged commit ae91024 into development Apr 2, 2026
6 of 12 checks passed
@feruzm feruzm deleted the api branch April 2, 2026 11:03
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.

1 participant