Repository navigation
Conversation
It plucked option.id from the options themselves, so every unvoted id was null.
…e API DeletingPollGroup and DeletedPollGroup were only dispatched by the unused DeletePollGroupHandler.
With flarum/audit enabled, poll create, edit, delete, publish, unpublish and votes, and poll group create, edit and delete, are logged. A vote is logged only when it changes something, and its options only for public polls. Entries for a poll in a discussion carry the discussion.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed in this pull request:
With flarum/audit enabled, polls logs:
poll.created,poll.updated,poll.deleted,poll.published,poll.unpublished, with the poll's id and question;poll.voted, only when a vote changes something. For public polls it records the options added and removed. For private polls it doesn't, because their voters are hidden;poll_group.created,poll_group.updated,poll_group.deleted, with the group's id and name.Entries for a poll in a discussion also carry
discussion_idandpost_id, so they appear when the log is filtered by that discussion. The audit browser labels are inen.ymlunderflarum-audit.lib.browser, as the bundled extensions do it. flarum/audit is a dev dependency and an optional dependency, and the extender is chained onto the existingExtend\Conditional.The tests exposed two existing bugs, fixed in their own commits:
PollVotesChanged::$unvotedOptionIdswas always a list of nulls: it pluckedoption.idfrom the options themselves.DeletingPollGroupandDeletedPollGroupwere never dispatched when a group was deleted through the API. Only the unusedDeletePollGroupHandlerdispatched them.PollGroupResourcenow does it in its delete hooks.AuditTestcovers each action, its payload, actor and IP, a resubmitted vote not being logged, and every action being registered with a label. flarum/audit'sInteractsWithAuditLoghelper isn't in its released package, so the few parts used are inlined. The label check readsen.ymldirectly, because extension locales aren't loaded in integration tests.Reviewers should focus on:
Whether to record vote choices for public polls only, as here.
Confirmed
composer test). PHPStan passes.