favgroups: don't allow favgroups to be named 'any' or 'none'.

'any' and 'none' are now reserved keywords for the favgroup: metatag.

Also add a fix script to rename existing favgroups.
This commit is contained in:
evazion
2022-04-17 23:07:19 -05:00
parent db49a4fbff
commit 703fd05025
2 changed files with 16 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
#!/usr/bin/env ruby
require_relative "base"
with_confirmation do
FavoriteGroup.where(name: %w[any none]).find_each do |favgroup|
old_name = favgroup.name
favgroup.update!(name: "favgroup_#{favgroup.id}")
Dmail.create_automated(to: favgroup.creator, title: "Your favorite group has been renamed", body: <<~EOS)
Your favgroup ##{favgroup.id} has been renamed from "#{old_name}" to "#{favgroup.name}". "#{old_name}" is no longer an allowed favgroup name.
You can go "here":/favorite_groups/#{favgroup.id}/edit to change your favgroup's name to something else.
EOS
end
end