-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add setting to sync permissions of an entry on every sync
Closes #69
- Loading branch information
1 parent
5e0a496
commit 7a6f805
Showing
8 changed files
with
73 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
import type KankaFoundry from '../KankaFoundry'; | ||
|
||
export default async function migrateV2(module: KankaFoundry): Promise<void> { | ||
const g = game as Game; | ||
const entries = g.journal?.filter(e => !!e.getFlag(module.name, 'id') && !e.getFlag('core', 'sheetClass')) ?? []; | ||
const entries = module.game.journal?.filter(e => !!e.getFlag(module.name, 'id') && !e.getFlag('core', 'sheetClass')) ?? []; | ||
|
||
await Promise.all(entries.map(entry => entry.setFlag('core', 'sheetClass', `${module.name}.KankaJournalApplication`))); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type KankaFoundry from '../KankaFoundry'; | ||
import { AutomaticPermissionValue } from '../module/KankaFoundrySettings'; | ||
import { KankaSettings } from '../types/KankaSettings'; | ||
|
||
export default async function migrateV3(module: KankaFoundry): Promise<void> { | ||
const permissionSetting = module.game.settings.get(module.name, KankaSettings.automaticPermissions) as string; | ||
|
||
if (permissionSetting === 'false') { | ||
module.game.settings.set(module.name, KankaSettings.automaticPermissions, AutomaticPermissionValue.never); | ||
} else if (permissionSetting === 'true') { | ||
module.game.settings.set(module.name, KankaSettings.automaticPermissions, AutomaticPermissionValue.initial); | ||
} else if (!AutomaticPermissionValue[permissionSetting]) { | ||
module.game.settings.set(module.name, KankaSettings.automaticPermissions, AutomaticPermissionValue.never); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters