* If a discussion doesn't exist, it can't be the last posted discussion
This fixes some rare errors where deleting the only post in the last posted discussion of a tag triggers a DB integrity exception.
* Decrement tag's discussion count when deleting a post deletes an unhidden discussion.
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
Fixes https://github.com/flarum/QualityAssurance/issues/41
When the API response is ingested by `pushObject`, since the flag instance is new, there is nothing to merge with, and therefore, there's no user on the flag instance in the store. As a result, the flag is displayed with "deleted" as the creating user until a page refresh occurs.
More broadly, this could be fixed by either:
- Refactoring the JSON API layer so that all singular operations return the same set of includes.
- Merging the API Paylod with sent data on model save (for new instances only).
But the former would require a major breaking rewrite, and the latter could introduce potentially unwanted side effects, and is effectively a bandaid over inconsistent backend behavior.
This PR updates the entire extension. It will not use a library that has not been updated for years, so it should work with newer versions of PHP.
Additionally, it sends more information to the Akismet API to make spam detection more accurate.
The Akismet class can be used by other extensions.
Todo:
- [x] Convert frontend to TypeScript
- [x] Call Akismet API manually
- [x] Option to remove blatant spam
- [x] Permission to bypass Akismet
- [x] Sending additional parameters like `is_test`
Nice to have, but can be left for another PR:
- [ ] Suspend obvious spamers
- [ ] Send `blog_lang` parameter
- [ ] Checking post edits
Sponsored by [forum.android.com.pl](https://forum.android.com.pl/)
* FIx broken post/discussion soft delete
Before the Model typescript rewrite, `pushAttributes` supported including relationship objects, which is hacky but incorrect behavior. With the rewrite, this functionality was broken.
This PR deprecates the functionality, adds a deprecated BC layer with a debug warning, and removes instances of incorrect usage.
* Update js/src/common/Model.ts
Co-authored-by: David Wheatley <hi@davwheat.dev>
* Update js/src/common/Model.ts
Co-authored-by: David Wheatley <hi@davwheat.dev>
* chore: format
Co-authored-by: David Wheatley <hi@davwheat.dev>