From a23399f220b3244dcd90aa4a01d78960f0059a79 2009-12-27 12:41:27 From: Jean-Philippe Lang Date: 2009-12-27 12:41:27 Subject: [PATCH] Merged r3249 to r3252 and r3254 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3255 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/member.rb b/app/models/member.rb index 44a4217..3ef1afd 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -57,6 +57,14 @@ class Member < ActiveRecord::Base member_roles.detect {|mr| mr.inherited_from}.nil? end + def include?(user) + if principal.is_a?(Group) + !user.nil? && user.groups.include?(principal) + else + self.user == user + end + end + def before_destroy if user # remove category based auto assignments for this member diff --git a/app/models/member_role.rb b/app/models/member_role.rb index 286659f..9c28d41 100644 --- a/app/models/member_role.rb +++ b/app/models/member_role.rb @@ -30,6 +30,10 @@ class MemberRole < ActiveRecord::Base errors.add :role_id, :invalid if role && !role.member? end + def inherited? + !inherited_from.nil? + end + private def remove_member_if_empty diff --git a/app/models/project.rb b/app/models/project.rb index 4accf5a..490c290 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -23,6 +23,7 @@ class Project < ActiveRecord::Base # Specific overidden Activities has_many :time_entry_activities has_many :members, :include => [:user, :roles], :conditions => "#{User.table_name}.type='User' AND #{User.table_name}.status=#{User::STATUS_ACTIVE}" + has_many :memberships, :class_name => 'Member' has_many :member_principals, :class_name => 'Member', :include => :principal, :conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{User::STATUS_ACTIVE})" @@ -583,10 +584,14 @@ class Project < ActiveRecord::Base # Copies members from +project+ def copy_members(project) - project.members.each do |member| + project.memberships.each do |member| new_member = Member.new new_member.attributes = member.attributes.dup.except("id", "project_id", "created_on") - new_member.role_ids = member.role_ids.dup + # only copy non inherited roles + # inherited roles will be added when copying the group membership + role_ids = member.member_roles.reject(&:inherited?).collect(&:role_id) + next if role_ids.empty? + new_member.role_ids = role_ids new_member.project = self self.members << new_member end diff --git a/app/views/projects/settings/_members.rhtml b/app/views/projects/settings/_members.rhtml index bfea867..c0d48b9 100644 --- a/app/views/projects/settings/_members.rhtml +++ b/app/views/projects/settings/_members.rhtml @@ -35,7 +35,8 @@ <%= link_to_function l(:button_edit), "$('member-#{member.id}-roles').hide(); $('member-#{member.id}-roles-form').show(); return false;", :class => 'icon icon-edit' %> <%= link_to_remote(l(:button_delete), { :url => {:controller => 'members', :action => 'destroy', :id => member}, - :method => :post + :method => :post, + :confirm => (!User.current.admin? && member.include?(User.current) ? l(:text_own_membership_delete_confirmation) : nil) }, :title => l(:button_delete), :class => 'icon icon-del') if member.deletable? %> diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 4be9979..5d7e23a 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -869,3 +869,6 @@ bg: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/bs.yml b/config/locales/bs.yml index 015b055..6013b9c 100644 --- a/config/locales/bs.yml +++ b/config/locales/bs.yml @@ -893,3 +893,6 @@ bs: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 59b3a44..4f8193f 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -872,3 +872,6 @@ ca: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/cs.yml b/config/locales/cs.yml index bcbf7ac..2255ca4 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -875,3 +875,6 @@ cs: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/da.yml b/config/locales/da.yml index 5123f24..87cd0e1 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -895,3 +895,6 @@ da: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/de.yml b/config/locales/de.yml index 81e69ef..79619ef 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -895,3 +895,6 @@ de: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/el.yml b/config/locales/el.yml index 9880025..4a8ffb2 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -875,3 +875,6 @@ el: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/en.yml b/config/locales/en.yml index 1c421cb..c21643c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -848,6 +848,7 @@ en: text_wiki_page_nullify_children: "Keep child pages as root pages" text_wiki_page_destroy_children: "Delete child pages and all their descendants" text_wiki_page_reassign_children: "Reassign child pages to this parent page" + text_own_membership_delete_confirmation: "You are about to remove some or all of your permissions and may no longer be able to edit this project after that.\nAre you sure you want to continue?" default_role_manager: Manager default_role_developper: Developer diff --git a/config/locales/es.yml b/config/locales/es.yml index bcf8bd2..dd0ec9d 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -919,3 +919,6 @@ es: setting_mail_handler_body_delimiters: Truncar correos tras una de estas líneas permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 6f255d0..def80f9 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -905,3 +905,6 @@ fi: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 6ecfc24..97849b5 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -856,6 +856,7 @@ fr: text_wiki_page_nullify_children: "Conserver les sous-pages en tant que pages racines" text_wiki_page_destroy_children: "Supprimer les sous-pages et toutes leurs descedantes" text_wiki_page_reassign_children: "Réaffecter les sous-pages à cette page" + text_own_membership_delete_confirmation: "Vous allez supprimer tout ou partie de vos permissions sur ce projet et ne serez peut-être plus autorisé à modifier ce projet.\nEtes-vous sûr de vouloir continuer ?" default_role_manager: Manager default_role_developper: Développeur diff --git a/config/locales/gl.yml b/config/locales/gl.yml index af1c6eb..8f65a70 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -895,3 +895,6 @@ gl: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/he.yml b/config/locales/he.yml index f66970c..f2429c6 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -879,3 +879,6 @@ he: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/hu.yml b/config/locales/hu.yml index a48228c..70a963d 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -900,3 +900,6 @@ setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/id.yml b/config/locales/id.yml index e124764..59d52f6 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -887,3 +887,6 @@ id: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/it.yml b/config/locales/it.yml index b469099..2fc70a5 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -882,3 +882,6 @@ it: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 0de5160..324abaa 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -904,3 +904,6 @@ ja: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 4b82b77..8c9de9d 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -935,3 +935,6 @@ ko: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/lt.yml b/config/locales/lt.yml index 8c87406..60eec61 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -943,3 +943,6 @@ lt: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 223df9b..b4630b2 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -857,3 +857,6 @@ nl: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/no.yml b/config/locales/no.yml index 461708b..89c034f 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -870,3 +870,6 @@ setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/pl.yml b/config/locales/pl.yml index ad8040a..4ff9ef2 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -898,3 +898,6 @@ pl: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index ed8e83e..2628d81 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -902,3 +902,6 @@ pt-BR: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 9441e56..cacea62 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -887,3 +887,6 @@ pt: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/ro.yml b/config/locales/ro.yml index f91525b..59b2a07 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -872,3 +872,6 @@ ro: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 4c28225..682a878 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -983,3 +983,6 @@ ru: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/sk.yml b/config/locales/sk.yml index 53b06dc..cdc0480 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -874,3 +874,6 @@ sk: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 852ad6a..66da1b3 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -871,3 +871,6 @@ sl: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/sr.yml b/config/locales/sr.yml index fd0a5db..4792ff0 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -890,3 +890,6 @@ setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 109ca7e..e6345b4 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -925,3 +925,6 @@ sv: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/th.yml b/config/locales/th.yml index 294880b..29f0747 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -872,3 +872,6 @@ th: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 42677a8..0bc54ad 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -902,3 +902,6 @@ tr: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 879b0aa..c6adec8 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -871,3 +871,6 @@ uk: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/vi.yml b/config/locales/vi.yml index afd63e9..ccba543 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -934,3 +934,6 @@ vi: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 44066db..54a46fd 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -968,3 +968,6 @@ enumeration_system_activity: 系統活動 permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 63143e1..a5ecdd0 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -899,3 +899,6 @@ zh: setting_mail_handler_body_delimiters: Truncate emails after one of these lines permission_add_subprojects: Create subprojects label_subproject_new: New subproject + text_own_membership_delete_confirmation: |- + You are about to remove some or all of your permissions and may no longer be able to edit this project after that. + Are you sure you want to continue? diff --git a/db/migrate/20091227112908_change_wiki_contents_text_limit.rb b/db/migrate/20091227112908_change_wiki_contents_text_limit.rb new file mode 100644 index 0000000..225f71e --- /dev/null +++ b/db/migrate/20091227112908_change_wiki_contents_text_limit.rb @@ -0,0 +1,16 @@ +class ChangeWikiContentsTextLimit < ActiveRecord::Migration + def self.up + # Migrates MySQL databases only + # Postgres would raise an error (see http://dev.rubyonrails.org/ticket/3818) + # Not fixed in Rails 2.3.5 + if ActiveRecord::Base.connection.adapter_name =~ /mysql/i + max_size = 16.megabytes + change_column :wiki_contents, :text, :text, :limit => max_size + change_column :wiki_content_versions, :data, :binary, :limit => max_size + end + end + + def self.down + # no-op + end +end diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb index b467c28..9620729 100644 --- a/lib/redmine/scm/adapters/abstract_adapter.rb +++ b/lib/redmine/scm/adapters/abstract_adapter.rb @@ -182,7 +182,7 @@ module Redmine end def self.shellout(cmd, &block) - logger.debug "Shelling out: #{cmd}" if logger && logger.debug? + logger.debug "Shelling out: #{strip_credential(cmd)}" if logger && logger.debug? if Rails.env == 'development' # Capture stderr when running in dev environment cmd = "#{cmd} 2>>#{RAILS_ROOT}/log/scm.stderr.log" diff --git a/public/javascripts/calendar/calendar-setup.js b/public/javascripts/calendar/calendar-setup.js index f2b4854..bf205b5 100644 --- a/public/javascripts/calendar/calendar-setup.js +++ b/public/javascripts/calendar/calendar-setup.js @@ -190,7 +190,7 @@ Calendar.setup = function (params) { cal.create(); cal.refresh(); if (!params.position) - cal.showAtElement(params.button || params.displayArea || params.inputField, params.align); + cal.showAtElement(params.button || params.displayArea || params.inputField); else cal.showAt(params.position[0], params.position[1]); return false; diff --git a/test/fixtures/groups_users.yml b/test/fixtures/groups_users.yml index 3702d6e..a7ee94e 100644 --- a/test/fixtures/groups_users.yml +++ b/test/fixtures/groups_users.yml @@ -2,4 +2,7 @@ groups_users_001: group_id: 10 user_id: 8 +groups_users_002: + group_id: 11 + user_id: 8 \ No newline at end of file diff --git a/test/fixtures/member_roles.yml b/test/fixtures/member_roles.yml index e0fc6d0..7ddcb87 100644 --- a/test/fixtures/member_roles.yml +++ b/test/fixtures/member_roles.yml @@ -37,3 +37,13 @@ member_roles_009: role_id: 2 member_id: 7 inherited_from: 7 +member_roles_010: + id: 10 + role_id: 2 + member_id: 9 + inherited_from: +member_roles_011: + id: 11 + role_id: 2 + member_id: 10 + inherited_from: 10 diff --git a/test/fixtures/members.yml b/test/fixtures/members.yml index 504d64f..f4d39fb 100644 --- a/test/fixtures/members.yml +++ b/test/fixtures/members.yml @@ -48,3 +48,15 @@ members_008: id: 8 user_id: 1 mail_notification: true +members_009: + id: 9 + created_on: 2006-07-19 19:35:33 +02:00 + project_id: 2 + user_id: 11 + mail_notification: false +members_010: + id: 10 + created_on: 2006-07-19 19:35:33 +02:00 + project_id: 2 + user_id: 8 + mail_notification: false diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb index f1dcb34..c1fc843 100644 --- a/test/unit/project_test.rb +++ b/test/unit/project_test.rb @@ -633,15 +633,15 @@ class ProjectTest < ActiveSupport::TestCase assert_not_equal source_relation_cross_project.id, copied_relation.id end - should "copy members" do + should "copy memberships" do assert @project.valid? assert @project.members.empty? assert @project.copy(@source_project) - assert_equal @source_project.members.size, @project.members.size - @project.members.each do |member| - assert member - assert_equal @project, member.project + assert_equal @source_project.memberships.size, @project.memberships.size + @project.memberships.each do |membership| + assert membership + assert_equal @project, membership.project end end diff --git a/test/unit/wiki_content_test.rb b/test/unit/wiki_content_test.rb index 372121b..0261678 100644 --- a/test/unit/wiki_content_test.rb +++ b/test/unit/wiki_content_test.rb @@ -77,4 +77,12 @@ class WikiContentTest < ActiveSupport::TestCase assert_kind_of String, version.text end end + + def test_large_text_should_not_be_truncated_to_64k + page = WikiPage.new(:wiki => @wiki, :title => "Big page") + page.content = WikiContent.new(:text => "a" * 500.kilobyte, :author => User.find(1)) + assert page.save + page.reload + assert_equal 500.kilobyte, page.content.text.size + end end