javierriveracastro / betteroll-swade

A Better Rolls port for SWADE
GNU General Public License v3.0
16 stars 32 forks source link

The save macro button now only appears for owners and trusted players #733

Closed ddbrown30 closed 2 months ago

ddbrown30 commented 2 months ago

Summary by Sourcery

Restrict the save macro button visibility to owners and trusted players, enhancing the security and user interface by ensuring that only authorized users can access certain features.

Enhancements:

sourcery-ai[bot] commented 2 months ago

Reviewer's Guide by Sourcery

This pull request implements changes to restrict the visibility of the save macro button to owners and trusted players, and updates the logic for hiding forms and master-only sections in chat messages.

File-Level Changes

Change Details Files
Restrict visibility of save macro button
  • Add 'brsw-owner-trusted-only' class to the save macro button
  • Implement logic to hide the save macro button for non-owner and non-trusted players
betterrolls-swade2/templates/common_card_header.html
betterrolls-swade2/scripts/brsw2-init.js
Update logic for hiding forms and master-only sections
  • Change condition for hiding forms from non-master and non-owner to using 'message.isOwner'
  • Keep existing logic for hiding master-only sections
betterrolls-swade2/scripts/brsw2-init.js

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.
javierriveracastro commented 2 months ago

Unless I'm mistaken (haven't already tried this), this PR will hide the roll buttons of the player's chat cards from the GM. Is this intended? Or maybe I'm just mistaken?

ddbrown30 commented 2 months ago

You are indeed mistaken. isOwner returns true for the GM. They are considered owners of everything.