Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: IONConnect DB conversation infrastructure #416

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ice-damocles
Copy link
Contributor

Description

Adds

  • IONDatabaseNotifier to proxy DB from direct interaction
  • General Event messages insert
  • One-to-one conversation DB logic: init of the conversation, new messages, last message
  • Group conversations DB logic: init of the conversation, new messages, change of subject, change of participants amount
  • Test event messages mocks
  • Changes to conversation provider: mocks are removed

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring
  • Documentation
  • Chore

@ice-damocles ice-damocles requested review from a team as code owners December 11, 2024 14:28
@ice-damocles ice-damocles force-pushed the feature/origin/chat-conversations-provider branch from f679bca to 84588c4 Compare December 11, 2024 14:29
@ice-damocles ice-damocles enabled auto-merge (squash) December 11, 2024 14:29
@ice-damocles ice-damocles changed the title Feature/origin/chat conversations provider feat: Nostr DB conversation infrastructure Dec 11, 2024
) async {
if (eventMessage.kind == 14) {
// This is the first message of the one-to-one conversation OR
// change of the group conversation subject
Copy link
Contributor

@ice-orion ice-orion Dec 11, 2024

Choose a reason for hiding this comment

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

In my understanding empty content can also mean that:

  1. This is the first message of a conversation (doesn't matter 1v1 or group)
  2. This is the event that changes the group participants
  3. This is the event that changes the group subject

We need to process the event first before generating a new uuid for it and inserting to the conversations table.

So in my understanding it should be like:

Try to find a conversation that the message belongs to by pubkeys fingerprint (sorted p tags + pubkey)
      * If not found
            *  If this is a "service" message (no content) ->  try to find by the subject
                     * if found -> insert with the found conversation id (meaning the participants have changed)
                     * if not found -> generate uuid, insert
              * If this is a regular message -> throw exception
       * If found -> insert with the found conversation id

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix and write unit tests for it

Choose a reason for hiding this comment

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

@ice-orion empty content also means u change the group picture

@ice-damocles ice-damocles changed the title feat: Nostr DB conversation infrastructure feat: IONConnet DB conversation infrastructure Dec 11, 2024
@ice-damocles ice-damocles changed the title feat: IONConnet DB conversation infrastructure feat: IONConnect DB conversation infrastructure Dec 11, 2024
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