annotate .svn/pristine/14/144d87a484de2d989cccbe9e992e92ab12eacca5.svn-base @ 1524:82fac3dcf466 redmine-2.5-integration

Fix failure to interpret Javascript when autocompleting members for project
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 11 Sep 2014 10:24:38 +0100
parents cbb26bc654de
children
rev   line source
Chris@909 1 class PopulateChangesetsUserId < ActiveRecord::Migration
Chris@909 2 def self.up
Chris@909 3 committers = Changeset.connection.select_values("SELECT DISTINCT committer FROM #{Changeset.table_name}")
Chris@909 4 committers.each do |committer|
Chris@909 5 next if committer.blank?
Chris@909 6 if committer.strip =~ /^([^<]+)(<(.*)>)?$/
Chris@909 7 username, email = $1.strip, $3
Chris@909 8 u = User.find_by_login(username)
Chris@909 9 u ||= User.find_by_mail(email) unless email.blank?
Chris@909 10 Changeset.update_all("user_id = #{u.id}", ["committer = ?", committer]) unless u.nil?
Chris@909 11 end
Chris@909 12 end
Chris@909 13 end
Chris@909 14
Chris@909 15 def self.down
Chris@909 16 Changeset.update_all('user_id = NULL')
Chris@909 17 end
Chris@909 18 end