Skip to content

Commit

Permalink
[foundryvtt#2124] Fix bug with dropping classes & subclasses onto cla…
Browse files Browse the repository at this point in the history
…ss journal pages
  • Loading branch information
arbron committed Feb 21, 2023
1 parent 4de2d2a commit 885f150
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions module/applications/journal/class-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export default class JournalClassPageSheet extends JournalPageSheet {
);

const linked = await fromUuid(this.document.system.item);
context.subclasses = await this._getSubclasses(this.document.system.subclassItems);

if ( !linked ) return context;
context.linked = {
document: linked,
Expand All @@ -54,7 +56,6 @@ export default class JournalClassPageSheet extends JournalPageSheet {
context.optionalTable = await this._getOptionalTable(linked);
context.features = await this._getFeatures(linked);
context.optionalFeatures = await this._getFeatures(linked, true);
context.subclasses = await this._getSubclasses(this.document.system.subclassItems);
context.subclasses?.sort((lhs, rhs) => lhs.name.localeCompare(rhs.name));

return context;
Expand Down Expand Up @@ -439,15 +440,14 @@ export default class JournalClassPageSheet extends JournalPageSheet {
switch ( item.type ) {
case "class":
await this.document.update({"system.item": item.uuid});
this.render();
return this.render();
case "subclass":
const itemSet = this.document.system.subclassItems;
itemSet.add(item.uuid);
await this.document.update({"system.subclassItems": Array.from(itemSet)});
this.render();
return this.render();
default:
return false;
}
}

}

0 comments on commit 885f150

Please sign in to comment.