OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/db/migrate/20140127134733_fix_issue_in...

36 lines
998 B

#-- copyright
# OpenProject is a project management system.
#
# Copyright (C) 2012-2013 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
class FixIssueInNotifications < ActiveRecord::Migration
REPLACED = {
"issue_added" => "work_package_added",
"issue_updated" => "work_package_updated",
"issue_priority_updated" => "work_package_priority_updated",
"issue_note_added" => "work_package_note_added"
}
def up
Setting['notified_events'] = replace(Setting['notified_events'], REPLACED)
end
def down
Setting['notified_events'] = replace(Setting['notified_events'], REPLACED.invert)
end
private
def replace(value,mapping)
if value.respond_to? :map
value.map { |s| mapping[s].nil? ? s : mapping[s] }
else
mapping[value].nil? ? value : mapping[value]
end
end
end