Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync between branches/repos - merge missing commits from sourceforge for 'stable-2.7' branch #52

Open
wants to merge 8 commits into
base: stable-2.7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/controllers/mylyn_connector/issues_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def updated_since
@issues = Issue.find(
:all,
:joins => ["join #{Project.table_name} on project_id=#{Project.table_name}.id"],
:conditions => ["#{Issue.table_name}.id in (?) and #{Issue.table_name}.updated_on >= ? and " << Project.visible_by, issues, cond]
:conditions => ["#{Issue.table_name}.id in (?) and #{Issue.table_name}.updated_on >= ? and " << Project.visible_condition(User.current), issues, cond]
)
respond_to do |format|
format.xml {render :layout => false}
Expand All @@ -76,7 +76,7 @@ def list
@issues = Issue.find(
:all,
:joins => ["join #{Project.table_name} on project_id=#{Project.table_name}.id"],
:conditions => ["#{Issue.table_name}.id in (?) and " << Project.visible_by, issues]
:conditions => ["#{Issue.table_name}.id in (?) and " << Project.visible_condition(User.current), issues]
)
respond_to do |format|
format.xml {render :layout => false}
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/mylyn_connector/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MylynConnector::ProjectsController < MylynConnector::ApplicationController
def all
@projects = Project.find(:all,
:joins => :enabled_modules,
:conditions => [ "enabled_modules.name = 'issue_tracking' AND #{Project.visible_by}"])
:conditions => [ "enabled_modules.name = 'issue_tracking' AND #{Project.visible_condition(User.current)}"])

respond_to do |format|
format.xml {render :layout => false}
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/mylyn_connector/queries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def all
@queries = Query.find(
:all,
:joins => ["left join #{Project.table_name} on project_id=#{Project.table_name}.id"],
:conditions => ["(#{Query.table_name}.is_public = ? OR #{Query.table_name}.user_id = ?) AND (project_id IS NULL OR " << Project.visible_by << ")", true, User.current.id],
:conditions => ["(#{Query.table_name}.is_public = ? OR #{Query.table_name}.user_id = ?) AND (project_id IS NULL OR " << Project.visible_condition(User.current) << ")", true, User.current.id],
:order => "#{Query.table_name}.name ASC"
)

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/mylyn_connector/issues_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def subtasks(issue)
begin
Issue.find(:all, :joins => :project, :conditions => ["#{Issue.table_name}.parent_id=? AND (" + Issue.visible_condition(User.current) + ")", issue])
rescue
issue.children.to_a.reject!{|i|
issue.children.to_a.reject{|i|
!User.current.allowed_to?({:controller => :issues, :action => :show}, i.project || @projects)
}
end unless (issue.leaf?)
Expand Down
3 changes: 2 additions & 1 deletion app/views/mylyn_connector/information/version.xml.builder
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ xml.version root_attribs do
:minor => @data[1],
:tiny => @data[2])
xml.redmine Redmine::VERSION
xml.rails RAILS_GEM_VERSION
xml.rails Rails::GemBoot.gem_version
#xml.rails RAILS_GEM_VERSION
end
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
rmc.connect 'mylyn/attachment/:id/:filename', :controller => 'attachments', :action => 'download', :format=> 'xml', :id => /\d+/, :filename => /.*/
end

map.connect 'mylyn/authtest', :controller => 'MylynConnector::Information', :action => 'authtest', :conditions => {:method => :get}
map.connect 'mylyn/authtest', :controller => 'MylynConnector::Information', :action => 'authtest', :format=> 'xml', :conditions => {:method => :get}

end
9 changes: 9 additions & 0 deletions init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@
Dispatcher.to_prepare do
CustomValue.send(:include, MylynConnector::Patches::CustomValuePatch) unless CustomValue.included_modules.include?(MylynConnector::Patches::CustomValuePatch)
end

#Redmine::VERSION.to_a.slice(0,2).join('.')

if MylynConnector::Version.redmine_release.to_f < 1.2
require 'mylyn_connector/patches/project_patch'
Dispatcher.to_prepare do
Project.send(:include, MylynConnector::Patches::ProjectPatch) unless Project.included_modules.include?(MylynConnector::Patches::ProjectPatch)
end
end
35 changes: 35 additions & 0 deletions lib/mylyn_connector/patches/project_patch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module MylynConnector

module Patches

module ProjectPatch

def self.included(base) # :nodoc:
base.extend(ClassMethods)

base.send(:include, InstanceMethods)

# Same as typing in the class
base.class_eval do
unloadable # Send unloadable so it will not be unloaded in development
end

end

module ClassMethods

#packport of Project.visible_condition
def visible_condition(user)
visible_by(user)
end

end

module InstanceMethods
end

end

end

end
6 changes: 5 additions & 1 deletion lib/mylyn_connector/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module MylynConnector
module Version
MAJOR = 2
MINOR = 7
TINY = 5
TINY = 6

# stable/trunk
BRANCH = 'stable'
Expand Down Expand Up @@ -35,6 +35,10 @@ def is1dot1?
def is1dot2?
MylynConnector::Version.redmine_release.to_f == 1.2 || MylynConnector::Version.redmine_release.to_f == 1.1 && Redmine::VERSION.to_s.include?('devel')
end

def isMin1dot2?
MylynConnector::Version.redmine_release.to_f >= 1.2 || MylynConnector::Version.redmine_release.to_f == 1.1 && Redmine::VERSION.to_s.include?('devel')
end
end

end
Expand Down
8 changes: 8 additions & 0 deletions release-note.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Version 2.7.6
fix : missing format for authtest added
chg : Tests adapted for Redmine 1.3
fix : uninitialized constant ActionView::Base::CompiledTemplates::RAILS_GEM_VERSION
fix : subtasks compatibility with Redmine < 1.2
fix : backport of Project.visible_condition added for the compatibility with Redmine < 1.2
fix : deprecated method calls replaced

Version 2.7.5
fix : Added missing property subtasks

Expand Down
159 changes: 159 additions & 0 deletions test/fixtures/1.3/custom_fields.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
---
custom_fields_001:
name: Database
min_length: 0
regexp: ""
is_for_all: true
is_filter: true
type: IssueCustomField
max_length: 0
possible_values:
- MySQL
- PostgreSQL
- Oracle
id: 1
is_required: false
field_format: list
default_value: ""
editable: true
custom_fields_002:
name: Searchable field
min_length: 1
regexp: ""
is_for_all: true
type: IssueCustomField
max_length: 100
possible_values: ""
id: 2
is_required: false
field_format: string
searchable: true
default_value: "Default string"
editable: true
custom_fields_003:
name: Development status
min_length: 0
regexp: ""
is_for_all: false
is_filter: true
type: ProjectCustomField
max_length: 0
possible_values:
- Stable
- Beta
- Alpha
- Planning
id: 3
is_required: true
field_format: list
default_value: ""
editable: true
custom_fields_004:
name: Phone number
min_length: 0
regexp: ""
is_for_all: false
type: UserCustomField
max_length: 0
possible_values: ""
id: 4
is_required: false
field_format: string
default_value: ""
editable: true
custom_fields_005:
name: Money
min_length: 0
regexp: ""
is_for_all: false
type: UserCustomField
max_length: 0
possible_values: ""
id: 5
is_required: false
field_format: float
default_value: ""
editable: true
custom_fields_006:
name: Float field
min_length: 0
regexp: ""
is_for_all: true
type: IssueCustomField
max_length: 0
possible_values: ""
id: 6
is_required: false
field_format: float
default_value: ""
editable: true
custom_fields_007:
name: Billable
min_length: 0
regexp: ""
is_for_all: false
is_filter: true
type: TimeEntryActivityCustomField
max_length: 0
possible_values: ""
id: 7
is_required: false
field_format: bool
default_value: ""
editable: true
custom_fields_008:
name: Custom date
min_length: 0
regexp: ""
is_for_all: true
is_filter: false
type: IssueCustomField
max_length: 0
possible_values: ""
id: 8
is_required: false
field_format: date
default_value: ""
editable: true
custom_fields_009:
name: Project 1 cf
min_length: 0
regexp: ""
is_for_all: false
is_filter: true
type: IssueCustomField
max_length: 0
possible_values: ""
id: 9
is_required: false
field_format: date
default_value: ""
editable: true
custom_fields_010:
name: Overtime
min_length: 0
regexp: ""
is_for_all: false
is_filter: false
type: TimeEntryCustomField
max_length: 0
possible_values: ""
id: 10
is_required: false
field_format: bool
default_value: 0
editable: true
custom_fields_011:
name: Custom date
min_length: 0
regexp: ""
is_for_all: false
is_filter: false
type: TimeEntryCustomField
max_length: 0
possible_values: ""
id: 11
is_required: false
field_format: date
default_value: ""
editable: true
Loading