CristianVasile23 / conversation-hud

A simple FoundryVTT module that adds a nice HUD that display the portraits of all the characters present in a conversation.
MIT License
17 stars 3 forks source link

Insufficient Rights error #48

Closed fragilekitty closed 5 months ago

fragilekitty commented 6 months ago

When calling startConversationFromJournalId, an error message is displayed for non-GM screens about Insufficient Rights.

It's coming from the function checkIfUserGM in helpers.js:

export function checkIfUserGM() { if (!game.user.isGM) { ui.notifications.error(game.i18n.localize("CHUD.errors.insufficientRights")); return false; } return true; }

CristianVasile23 commented 6 months ago

Hey! Thanks for reaching out.

I will need a bit more information regarding this issue. The behavior described above is intended, only GMs or Assistant GMs can start conversations no matter the source (this is done for security reasons, if any player could start a conversation that would be problematic and could cause issues for the GM as there is only one active conversation at a time that is displayed for everyone).

As such, why exactly would you need to start a conversation as a non-GM user? Can you please describe what you intend to do so that I may better understand the goal and thus help you?

Thanks in advance!

fragilekitty commented 6 months ago

Hi! Thanks for responding quickly.

I could have sworn this wasn't happening last November before I updated your module, but looking at the code history, I'm starting to question that. I'll close this.

FYI, here's my scenario, all running on a laptop for an in-person gaming session:

1) A browser running Foundry as a GM (displayed on my laptop for myself) 2) A browser running Foundry as a non-GM (displayed on a TV for the players) 3) Streamdeck using MaterialDeck to invoke a macro to start a conversation

My macro is this:

game.ConversationHud.startConversationFromJournalId(scope.journalId, true);

When the above is invoked, the conversation is started in both browsers. I get the error on browser 2 (non-GM), but not browser 1 (GM).

I think maybe what's happening is that Streamdeck is sending the macro command to both browsers. The GM browser processes it correctly, and the non-GM browser also starts the conversation (like you'd expect). But the non-GM browser gives the error (and doesn't process the command a second time).

I can comment out the error as a workaround, since in my scenario, I'm in full control and don't have to worry about players trying to start conversations. Maybe I can get Streamdeck to only send commands to the GM browser (if it is indeed sending to both).

Thanks for your time!

CristianVasile23 commented 5 months ago

After checking on my end as well, I can confirm this is a bug which was introduced during the last update. There is an issue in the code that updates the active conversation for all participants which also updates the visibility of the conversation and this code is called on all clients which is why the error appears.

I will fix it as soon as possible and thanks for bringing it up to my attention.

fragilekitty commented 5 months ago

Thanks for looking deeper, and I'm glad I wasn't going crazy. :)

CristianVasile23 commented 5 months ago

The issue should be resolved with version 5.5.0 so I will close the issue (hopefully for good this time). If the problem does persist, or you encounter any other problem, feel free to reach out and I will do my best to help :D