Skip to content

Conversation

@damencho
Copy link
Member

@damencho damencho commented Sep 9, 2025

No description provided.

* @param question
* @param answers
*/
createPoll(pollId: string, question: string, answers: Array<{ name: string; }>) {
Copy link
Member

Choose a reason for hiding this comment

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

Why not use an array of stringas at this level, rather than have to flatten it here?

Copy link
Member Author

Choose a reason for hiding this comment

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

So we can put it as a type ... I will drop the flattened strings from everywhere so we can have a single strucutre as it now differs and depends on the operation

Copy link
Member

Choose a reason for hiding this comment

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

I forgot where we landed on this one, can you remind me pl?

const msg = $msg({ to: targetJid,
type: 'chat' });
// when not sending to a direct jid, let's indicate the room jid (used in polls)
const roomJid = useDirectJid ? this.roomjid : undefined;
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed? Isn't the room JID already in the to?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, we switched to sending messages to a component and the jid is missing there, it used to be the to of the messages.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, but we can get the target room with:

    -- get room name with tenant and find room
    local room = get_room_by_name_and_subdomain(session.jitsi_web_query_room, session.jitsi_web_query_prefix);

In Prosody, like we do for breakout rooms, no?

* @param question
* @param answers
*/
createPoll(pollId: string, question: string, answers: Array<{ name: string; }>) {
Copy link
Member

Choose a reason for hiding this comment

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

I forgot where we landed on this one, can you remind me pl?

@damencho
Copy link
Member Author

In the code where it is not voting, the answer is always in a structure with a name, greatly simplifies logic and types.

Copy link
Member

@saghul saghul left a comment

Choose a reason for hiding this comment

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

I think we can remove the need for passing the roomJid, LGTM otherwise.

const msg = $msg({ to: targetJid,
type: 'chat' });
// when not sending to a direct jid, let's indicate the room jid (used in polls)
const roomJid = useDirectJid ? this.roomjid : undefined;
Copy link
Member

Choose a reason for hiding this comment

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

Yes, but we can get the target room with:

    -- get room name with tenant and find room
    local room = get_room_by_name_and_subdomain(session.jitsi_web_query_room, session.jitsi_web_query_prefix);

In Prosody, like we do for breakout rooms, no?

@damencho damencho merged commit 43bbd50 into master Sep 25, 2025
2 checks passed
@damencho damencho deleted the polls-update branch September 25, 2025 18:44
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