diff --git a/app/models/member.rb b/app/models/member.rb index 44a42174..3ef1afde 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/views/projects/settings/_members.rhtml b/app/views/projects/settings/_members.rhtml index bfea8675..c0d48b9c 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 4be99796..5d7e23ac 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 015b0552..6013b9ca 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 59b3a44f..4f8193f4 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 bcbf7ac9..2255ca49 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 5123f241..87cd0e1c 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 81e69ef2..79619efb 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 98800250..4a8ffb2b 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 1c421cb4..c21643c0 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 bcf8bd21..dd0ec9dc 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 6f255d03..def80f98 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 6ecfc240..97849b55 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 af1c6eb9..8f65a701 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 f66970cc..f2429c60 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 a48228cd..70a963d3 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 e124764c..59d52f67 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 b469099e..2fc70a5f 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 0de5160e..324abaaa 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 4b82b77f..8c9de9db 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 8c874065..60eec613 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 223df9b4..b4630b23 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 461708b3..89c034f2 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 ad8040aa..4ff9ef25 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 ed8e83e3..2628d81d 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 9441e56c..cacea629 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 f91525b7..59b2a072 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 4c282250..682a878d 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 53b06dc8..cdc04803 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 852ad6ac..66da1b3c 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 fd0a5db9..4792ff08 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 109ca7e6..e6345b4f 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 294880ba..29f07473 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 42677a87..0bc54ad9 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 879b0aaa..c6adec84 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 afd63e9b..ccba5434 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 44066dbd..54a46fd2 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 63143e1d..a5ecdd08 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?