Skip to content

Commit

Permalink
fix: Revert "fix: Use system code to see who should handle a hooked e…
Browse files Browse the repository at this point in the history
…vent."

This reverts commit 1a31207.
  • Loading branch information
xdy committed Jul 9, 2024
1 parent 58bff9c commit 6f57369
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/module/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,16 @@ export function debounce(callback, wait) {
}

export function shouldIHandleThis(actor) {
return actor?.primaryUpdater === game.user;
if (!actor) return null;
const currentUser = game.users.current;
const activePlayers = game.users.players.filter((u) => u.active);
const assignedUser = activePlayers.find((u) => u.character === actor);
const anyoneWithPermission = activePlayers.find((u) => actor.canUserModify(u, "update"));
const updater =
currentUser?.active && actor.canUserModify(currentUser, "update")
? currentUser
: assignedUser ?? game.users.activeGM ?? anyoneWithPermission ?? null;
return game.user.id === updater?.id;
}

export function pushNotification(message: any, type: string = "info") {
Expand Down

0 comments on commit 6f57369

Please sign in to comment.