aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2011-05-27 11:05:06 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2011-05-31 12:29:37 +0200
commite624e5412322e7b1ea9c738408a2baae65d696b7 (patch)
tree43f1b42b85a6fdabc64e83127ae828d6d1767ff5 /app
parentImprove ready recruits listing (diff)
downloadrecruiting-webapp-e624e5412322e7b1ea9c738408a2baae65d696b7.tar.gz
recruiting-webapp-e624e5412322e7b1ea9c738408a2baae65d696b7.tar.bz2
recruiting-webapp-e624e5412322e7b1ea9c738408a2baae65d696b7.zip
Add developer role
Fix bug: https://bugs.gentoo.org/show_bug.cgi?id=368185
Diffstat (limited to 'app')
-rw-r--r--app/models/user.rb5
-rw-r--r--app/rich_types/role.rb2
2 files changed, 3 insertions, 4 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 87d9024..f49341d 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -231,9 +231,8 @@ class User < ActiveRecord::Base
# and make sure change to role wasn't changed or was promotion of recruit
# to mentor or demotion of mentor to recruit
return true unless role_changed?
- return true if role.is_mentor? && RichTypes::Role.new(role_was).is_recruit?
- return true if role.is_recruit? && RichTypes::Role.new(role_was).is_mentor?
-
+ changable = [RichTypes::Role.new(:recruit), RichTypes::Role.new(:developer), RichTypes::Role.new(:mentor)]
+ return true if changable.include?(RichTypes::Role.new(role)) and changable.include?(RichTypes::Role.new(role_was))
false
end
diff --git a/app/rich_types/role.rb b/app/rich_types/role.rb
index ae9b129..31faa50 100644
--- a/app/rich_types/role.rb
+++ b/app/rich_types/role.rb
@@ -13,5 +13,5 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
module RichTypes
- Role = HoboFields::EnumString.for(:recruit, :mentor, :recruiter)
+ Role = HoboFields::EnumString.for(:recruit, :mentor, :developer, :recruiter)
end