Releases: FriendsOfFlarum/polls
2.2.0
2.1.2
2.0.1
- Add setting to change max options allowed in polls (#70)
- Fix poll end date set to
0
(start of Unix time is 1970) when editing a poll before posting (@"Wlork"#p216743) - Add 'hide votes' option until poll has ended (#2)
- Nobody can see vote count or voters if the poll has not ended (this includes admin & owner for now)
- Fix poll end date being able to be set past 2038 -- SQL column currently maxes out at 2038/01/18
- Convert poll options into single
settings
column- Since we don't query DB using these options, they can just be a JSON field to decrease the amt of columns
- The old columns will remain until it's clear that the migration works well and that they can be removed w/o issue
Full Changelog: 2.0.0...2.0.1
2.0.0
🛑 BACKUP BEFORE UPGRADING TO THIS VERSION 🛑
This version contains database refactors that make the data incompatible with 1.x
if you try to downgrade.
If you encounter errors, you WILL need to have a backup of all the polls tables available to go back to 1.4.2
. Permission names have also changed, so a backup of group_permissions
would also be helpful.
Upgrading
Save a backup of your database -- mostly the polls
, poll_votes
, poll_options
, and group_permissions
tables -- before continuing. If you don't have any polls in your forum and haven't configured polls permissions, you can skip this step.
The migration process will delete polls in discussions that don't have associated first posts (discussion's first_post_id = null
and no post exists with number = 1
). These polls would not have been visible in v1, and so removing them should (theoretically) not cause any visible data loss - check the Flarum log after migrating to see if any polls were deleted.
composer require fof/polls
php flarum migrate
php flarum cache:clear
What's Changed
- Drop flatpickr by @dsevillamartin in #72
- Move posts to polls by @dsevillamartin in #73
- More features & breaking v2 changes by @dsevillamartin in #74
- Move voters button next to heading & fix no permission error after poll ends
- Create endpoint for new poll to add to existing post (#67, #16)
- Drop 'newPollVote' websocket message (#38)
- Drop ReFlar/polls database compatibility (#37)
- Don't show poll if post is hidden unless revealing content, adjust some styling
- Separate edit permission into own polls & polls in own posts
Full Changelog: 1.4.2...2.0.0
1.4.2
What's Changed
- UI & UX improvements by @dsevillamartin in #71
- Convert
float
togrid
for options list andflex
for the options themselves - Fix duplicate timing message when the poll timer has ended
- Load votes for votes modal after opening, instead of before
- Improve layout margin & image positioning
- Use grid for voters list in modal
- Convert
Full Changelog: 1.4.1...1.4.2
1.4.1
- Fix the 'allow multiple votes' and 'max votes' options not being saved on poll creation, only when editing a poll
Full Changelog: 1.4.0...1.4.1
1.4.0
The database structure was modified in this update. You must run php flarum migrate
after updating.
Feature changes
- Add an option to polls to allow users to vote for multiple options
- Add an option to polls to limit the amount of options users can vote for
- Reorganize help section display to always have icons and show multiple instances of info (instead of one or another depending on permissions)
- Display HTTP request error to user if voting fails
Full Changelog: 1.3.0...1.4.0
Integration changes
A new API endpoint was created for backwards compatibility. Use /fof/polls/{id}/votes
and pass the IDs of all the options the user votes for -- any missing ones will count as the user 'unvoting' those options.
/fof/polls/{id}/vote
still works for single-vote polls, but will throw aPermissionDeniedException
if you try to use it on a poll that allows multiple votes per user.
The Pusher event has also been renamed from updatedPollOption
to updatedPollOptions
. The old one is no longer fired, to avoid issues with handling it. The new one contains the new vote counts of all the changed options (those affected by the user voting or unvoting them).
The DB event PollVotesChanged
was created as well for backwards compatibility. The old PollWasVoted
will be thrown for single-vote polls, but not for polls allowing multiple options to be voted for.
1.3.0
The database structure was modified in this update. You must run php flarum migrate
after updating.
Feature changes
- Added ability to link images in poll options. Must be enabled in admin panel. Image URLs must be fully qualified. Images are displayed under each option label.
Integration changes
Only important if you have a custom script using the Flarum REST API to create polls automatically.
The REST API syntax for creating polls via POST /api/discussions
was modified.
Previously an array of strings would be sent as data.attributes.poll.relationships.options
. This has been replaced by an array of objects (keys answer
, imageUrl
) sent as data.attributes.poll.options
to support more option attributes.
The older syntax is deprecated but will continue to be supported for a few versions.
Developer changes
The extensibility of the extension was improved by refacting the code into more methods.
The virtual DOM returned by the components is still almost entirely identical so there should be very little risk of breaking changes.
- Added
CreatePollModal.prototype.fields
ItemList. - Added
CreatePollModal.prototype.data
view sub-method. - Added
DiscussionPoll.prototype.viewOption
view sub-method. - Added
ListVotersModal.prototype.optionContent
andListVotersModal.prototype.voteContent
view sub-method. - Added
SavingPollAttributes
PHP event to hook into the poll (not options) saving. - Implemented
PollOptionValidator
(was unused previously).
This update was sponsored by annonny
1.2.1
1.2.0
- Use official Flarum
ComposerState
fields API to hold poll data. This allows other extensions to interact with Polls in new ways.