Skip to content

fix: pictique messages vanishing - #383

Merged
coodos merged 1 commit into
mainfrom
fix/pictique-messages-disappearing
Oct 28, 2025
Merged

coodos merged 1 commit into
mainfrom
fix/pictique-messages-disappearing

Conversation

@coodos

@coodos coodos commented Oct 28, 2025 •

Copy link
Copy Markdown
Contributor

Description of change

messages from pictique kept vanishing for some reason

Issue Number

Type of change

  • Fix (a change which fixes an issue)

How the change has been tested

Change checklist

  • I have ensured that the CI Checks pass locally
  • I have removed any unnecessary logic
  • My code is well documented
  • I have signed my commits
  • My code follows the pattern of the application
  • I have self reviewed my code

Summary by CodeRabbit

  • Refactor
    • Updated message retrieval logic to eagerly load related chat and sender information during database queries.
    • Enhanced message enrichment process to include comprehensive related entity details during post-load operations.

@coderabbitai

coderabbitai Bot commented Oct 28, 2025 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

Walkthrough

Two services modified to enhance entity relationship handling: MessageService now eagerly loads related chat and sender entities during retrieval; subscriber.ts enriches loaded message entities with fully resolved User and Chat objects during post-processing.

Changes

Cohort / File(s) Summary
Message Retrieval Eager Loading
platforms/pictique-api/src/services/MessageService.ts
Modified findById to use findOne with where and relations options, enabling eager loading of related chat and sender entities instead of lazy loading via findOneBy.
Entity Enrichment Post-Processing
platforms/pictique-api/src/web3adapter/watchers/subscriber.ts
Added enrichment logic in post-load processing to conditionally fetch and attach related User (sender) and Chat (with participants and messages) entities to loaded message objects.

Sequence Diagram

sequenceDiagram
    participant MessageService
    participant Subscriber
    participant DB as Database
    participant UserRepo as User Repository
    participant ChatRepo as Chat Repository

    MessageService->>DB: findOne(id, relations: [sender, chat])
    activate DB
    DB-->>MessageService: message with sender.id & chat.id
    deactivate DB

    Subscriber->>Subscriber: enrichEntity(message)
    activate Subscriber
    
    alt sender exists with id
        Subscriber->>UserRepo: find(sender.id)
        activate UserRepo
        UserRepo-->>Subscriber: User entity
        deactivate UserRepo
        Subscriber->>Subscriber: assign User to enrichedEntity.sender
    end
    
    alt chat exists with id
        Subscriber->>ChatRepo: find(chat.id, relations: [participants, messages])
        activate ChatRepo
        ChatRepo-->>Subscriber: Chat entity with relations
        deactivate ChatRepo
        Subscriber->>Subscriber: assign Chat to enrichedEntity.chat
    end
    
    Subscriber-->>Subscriber: return enrichedEntity
    deactivate Subscriber
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • The MessageService change is straightforward—replacing one query method with another using standard ORM relation-loading patterns
  • The subscriber enrichment logic adds conditional entity fetching but follows a predictable, repetitive pattern
  • Both changes complement each other with minimal risk; verify that the eager-loading strategy aligns with intended performance characteristics

Poem

🐰 Messages now hop with relations so true,
Eager-loaded friends at their side through and through,
Subscribers enrich with a flourish and care,
Users and chats bloom beyond the thin air! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/pictique-messages-disappearing

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e1ca1b and 425f9a6.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • platforms/pictique-api/src/services/MessageService.ts (1 hunks)
  • platforms/pictique-api/src/web3adapter/watchers/subscriber.ts (1 hunks)

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.

@coodos
coodos merged commit c425752 into main Oct 28, 2025
0 of 4 checks passed
@coodos
coodos deleted the fix/pictique-messages-disappearing branch October 28, 2025 08:08
coodos added a commit that referenced this pull request Nov 4, 2025
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