X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/dba809feb44cd1c4d155f3e3254a1cca5323f95f..6452ce53707b8e5c3f9ef95dd3793284272398e4:/redmine/redmine_publications/lib/redmine_publications/change_patch.rb diff --git a/redmine/redmine_publications/lib/redmine_publications/change_patch.rb b/redmine/redmine_publications/lib/redmine_publications/change_patch.rb index 41ea9596..b8e5c4b6 100644 --- a/redmine/redmine_publications/lib/redmine_publications/change_patch.rb +++ b/redmine/redmine_publications/lib/redmine_publications/change_patch.rb @@ -21,12 +21,14 @@ module RedminePublications module InstanceMethods def update_publication - if self.action == 'A' + if (self.action == 'A') and (self.changeset.repository.project_id == Setting.plugin_redmine_publications[:project].to_i) regexp = Regexp.new(Setting.plugin_redmine_publications[:pattern]) match = self.path.match(regexp) - Rails.logger.info('[INFO] Adding publication: "' << match[1]) - Publication.find_or_create_by_name(:name => match[1], - :source_file => self.path, :repository_id => self.changeset.repository.id ) + if match + Rails.logger.info('[INFO] Adding publication: "' << match[1]) + Publication.find_or_create_by_name(:name => match[1], + :source_file => self.path, :repository_id => self.changeset.repository.id ) + end end end