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

Add partecipants to a Conversation #54

Open
andreaparadigma opened this issue Mar 22, 2024 · 5 comments
Open

Add partecipants to a Conversation #54

andreaparadigma opened this issue Mar 22, 2024 · 5 comments

Comments

@andreaparadigma
Copy link

Is there a way to add/remove a partecipant or change its permission?

In JS SDK I see this conversation.setParticipant(me); but not found anything in Dart SDK

Ref: https://talkjs.com/docs/Features/Group_Chats/Access_rights/

@bugnano
Copy link
Collaborator

bugnano commented Mar 25, 2024

When you call session.getConversation ( https://talkjs.com/docs/Reference/Flutter_SDK/Session/#Session__getConversation ), you pass it an object with a property called participants, and there you can add/remove participants and set the corresponding permissions.

You then pass the returned Conversation object as the conversation property to the ChatBox widget.

@andreaparadigma
Copy link
Author

@bugnano the session.getConversation always return an object with zero partecipants.

Example:

  • I have a conversation with user1 and user2 with conversation id 123
  • I use conversation = session.getConversation(123) and set conversation property to the ChatBox widget and is working, but the conversation.participants.length is empty despite the fact that the ChatBox correctly shows the two users.
  • So I can't remove user2, even if I just pass user1 to getConversation. The ChatBox remain the same.
  • Instead if I pass a third user3 to partecipants this is added in the ChatBox.

Currently it seems that we can only add users, but not remove them. It is probably a bug for which partecipants always remain empty

@bugnano
Copy link
Collaborator

bugnano commented Mar 25, 2024

Currently it seems that we can only add users, but not remove them.

You are correct. There is no way to remove a participant via the Flutter SDK at the moment. If you need to remove a participant, you should use the REST API ( https://talkjs.com/docs/Reference/REST_API/Participation/#leave-conversation )

@andreaparadigma
Copy link
Author

@bugnano in order to remove a participant, I need to know the participants in the conversation.
Should I use the REST API in this case as well? https://talkjs.com/docs/Reference/REST_API/Conversations/#a-single-conversation

@bugnano
Copy link
Collaborator

bugnano commented Mar 27, 2024

Yes, that's correct

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

No branches or pull requests

2 participants