foundryvtt / Ferncombe

The humble town of Ferncombe is a quaint farming and fishing community, a pastoral and serene home away from home.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Overriding Existing Sheet Classes

vigoren opened this issue · comments

Hey, A user of my module (Simple Calendar) ran into an interesting issue when using this module.

Simple Calendar has the ability to add notes to the calendar and these notes are saved as Journal Entries within Foundry. The Simple Calendar notes use their own Journal Sheet so that I can properly display all the metadata associated with a calendar note (Date, Time, Tags etc.)

The issue that I have run into is that when users are using the Ferncombe module any time a note is created in Simple Calendar it opens with the Ferncombe sheet and a lot of functionality is lost for that note. Looking at the code I see that in the preCreateJournalEntry hook you are assigning the Ferncombe journal sheet to every journal entry that is created, which overrides the one I had assigned to the calendar note journal entries.

I have a proposed fix for this and have submitted a pull request with the fix. The fix in my mind is in the preCreateJournalEntry hook to first check to see if the passed in data has a sheetClass defined in the flags before assigning the Ferncombe one. This should account for any sheets using a custom journal sheet to keep using that one while assigning all newly created journal entries to the Ferncombe journal sheet. I have tested this a bit and it seems to work well, though I may be missing a use case or two that would break with this approach.

Please let me know what you think and if we can resolve this. Thanks!

Any update on this issue? It's been going on for a while and it's fairly frustrating.

commented

It looks like there was some lingering code from development that flagged the journals as you're describing. I've removed that code as it's no longer necessary and released a new version (1.0.4) that you should be able to update to to resolve this problem. Sorry for the headache in the meantime!