#1955: Change the logic concerning unused tags and add CHANGELOG entries

This commit is contained in:
Jyri-Petteri Paloposki 2019-07-19 03:17:33 +03:00
parent 1c61f9cffb
commit ad0f617d7c
2 changed files with 29 additions and 6 deletions

View file

@ -65,12 +65,21 @@ class AddUserIdToTag < ActiveRecord::Migration[5.2]
tag.save! tag.save!
end end
# Set all unowned tags to user ID #1, because they're unused. # Set all unowned tags to the only user, if there's only one. Otherwise
execute <<-EOQ # remove them since there's no way of knowing who they belong to.
UPDATE tags if User.all.count == 1
SET user_id = 1 uid = User.first.id
WHERE user_id IS NULL execute <<-EOQ
EOQ UPDATE tags
SET user_id = #{uid}
WHERE user_id IS NULL
EOQ
else
execute <<-EOQ
DELETE FROM tags
WHERE user_id IS NULL
EOQ
end
end end
def self.down def self.down
remove_column :tags, :user_id remove_column :tags, :user_id

View file

@ -1,13 +1,27 @@
## Version 2.4 ## Version 2.4
### New features
* Removed support for deprecated password-hashing algorithm. This * Removed support for deprecated password-hashing algorithm. This
eliminates config.salt. Note the addition of a pre-upgrade step to eliminates config.salt. Note the addition of a pre-upgrade step to
check for obsolete passwords. check for obsolete passwords.
* All tags now belong to a user. Existing tags are migrated to users based on
the taggings and duplicated as necessary. If there's only one user, all unused tags are
assigned to them, otherwise unused tags are removed.
* All REST APIs now also accept user token as password.
* The stats view now uses Charts.js instead of the Flash-based chart library.
* A Docker environment is used unless the .skip-docker file exists.
* Rails 4.2 * Rails 4.2
* Thin replaces WEBrick as the included web server * Thin replaces WEBrick as the included web server
* Tracks is tested on Ruby 1.9.3, 2.0.0, 2.1, and 2.2. * Tracks is tested on Ruby 1.9.3, 2.0.0, 2.1, and 2.2.
* The MessageGateway will save the received email as an attachement to the todo * The MessageGateway will save the received email as an attachement to the todo
* Add a configuration option for serving static assets from Rails * Add a configuration option for serving static assets from Rails
### Removed features
* Ruby versions below 2.4 are no longer supported.
### Bug fixes
* Multiple fixes to REST APIs.
* Several UI bugs fixed.
## Version 2.3.0 ## Version 2.3.0
### New and changed features ### New and changed features