Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-19 13:01:19 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-19 13:01:19 +0400
commit155703c6132a86c13a18dba65da19129f49ea9c9 (patch)
tree621b90b97ad824e19f31152967d6e8ffd4a05b09 /app/models/issue.rb
parent52028dcd2d5a4048a6751312c6f1eba49013ce22 (diff)
parent6e333d507565a63037e9f4142a29138efa530971 (diff)
Merge branch 'state-machine' of https://github.com/Undev/gitlabhq into Undev-state-machine
Conflicts: app/models/issue.rb app/models/merge_request.rb
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r--app/models/issue.rb23
1 files changed, 20 insertions, 3 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 04c2df059a9..112f43c4692 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -9,7 +9,7 @@
# project_id :integer
# created_at :datetime not null
# updated_at :datetime not null
-# closed :boolean default(FALSE), not null
+# state :string default(FALSE), not null
# position :integer default(0)
# branch_name :string(255)
# description :text
@@ -19,8 +19,9 @@
class Issue < ActiveRecord::Base
include Issuable
- attr_accessible :title, :assignee_id, :closed, :position, :description,
- :milestone_id, :label_list, :author_id_of_changes
+ attr_accessible :title, :assignee_id, :position, :description,
+ :milestone_id, :label_list, :author_id_of_changes,
+ :state_event
acts_as_taggable_on :labels
@@ -33,4 +34,20 @@ class Issue < ActiveRecord::Base
opened.assigned(user)
end
end
+
+ state_machine :state, initial: :opened do
+ event :close do
+ transition [:reopened, :opened] => :closed
+ end
+
+ event :reopen do
+ transition closed: :reopened
+ end
+
+ state :opened
+
+ state :reopened
+
+ state :closed
+ end
end