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

Invited cant see messages because of prev_batch null #1756

Open
1 of 2 tasks
MichalNemec opened this issue Apr 5, 2024 · 3 comments
Open
1 of 2 tasks

Invited cant see messages because of prev_batch null #1756

MichalNemec opened this issue Apr 5, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@MichalNemec
Copy link

MichalNemec commented Apr 5, 2024

Checklist

  • I could not find a solution in the documentation, the existing issues or discussions.
  • I already asked for help in the chat

In which Project did the bug appear?

Other

If you selected "Other" as Project, please enter in which project the bug occurred.

SDK

On which platform did the bug appear?

Android, iOS

SDK Version

29d982b

Describe the problem caused by this bug

im using this for private conversation:

.startDirectChat(
        mxId,
        preset: CreateRoomPreset.trustedPrivateChat,
        enableEncryption: false,
        initialState: [
          StateEvent(
            content: {
              'history_visibility': HistoryVisibility.worldReadable.text, //wanted joined, but still same issue
            },
            type: EventTypes.HistoryVisibility,
          ),
        ],
      )

When creator sends a message in that room, then invitee sees username and no message, upon clicking on that conversation, i get error:
Tried to request history without a prev_batch token

I need to see messages before accepting the conversation to prevent spam.

upon accepting conversation, i see messages.

Steps To Reproduce

  1. invite someone
  2. see no message
  3. cannot see any events in timeline
  4. exception

Screenshots or Logs

No response

Security related

No response

@MichalNemec MichalNemec added the bug Something isn't working label Apr 5, 2024
@krille-chan
Copy link
Contributor

I need to see messages before accepting the conversation to prevent spam.

This is not possible. As you can see in the spec here the matrix protocol doesn't allow taking a look into the timeline. However it is possible to set the reason field when sending an invite. Be aware that this would be not end to end encrypted

@MichalNemec
Copy link
Author

MichalNemec commented Apr 19, 2024

I used element app:

  1. created a room
  2. made the room public
  3. "You made future room history visible to anyone."
  4. "You changed the room name to PUBLIC"
  5. "You changed the topic to "?"
  6. "You invited [testing user from matrix-dart-sdk]"
  7. sent "hello" message
  8. click in flutter app on invite
  9. see empty screen, no messages.

The only thing i see is a status message (joined the chat) from event.calcLocalizedBodyFallback(i18n, withSenderNamePrefix: true),

@PhantomRay
Copy link
Contributor

I don't use reason, but something similar:

 var creationContent = <String, Object?>{};
    creationContent['request_info'] = requestInfo;

    var roomId = await _client.createRoom(
      invite: [matrixUserId],
      isDirect: true,
      preset: CreateRoomPreset.trustedPrivateChat,
      initialState: initialState,
      powerLevelContentOverride: null,
      creationContent: creationContent,
    );

Then you can retrieve it in RoomCreate event

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants