Skip to content
Snippets Groups Projects

State machine integrated to Issues, Merge Requests, Milestones

Merged gitlab-qa-bot requested to merge github/fork/Undev/state-machine into master

Created by: Andrew8xx8

I think, that the most part of community agree with me that we need a state machine for better observing support.

The state machine does state changes more clearly and produces additional callbacks to obser. Also it describes transitions, that allows to do some state changes or reject them. For more information, please, checkout this.

Now we have:

  • Issue, that can be closed, opened and reopened
  • Merge Request, that can be closed, opened, reopened and merged
  • Milestone, that can be closed and activated

For all transitions we can create callback in observer.

Also, I improved tests and the world looks more better now.

My Next step is to integrate State Machine for merge statuses.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
19 19 class Issue < ActiveRecord::Base
20 20 include Issuable
21 21
22 attr_accessible :title, :assignee_id, :closed, :position, :description,
23 :milestone_id, :label_list, :author_id_of_changes
22 attr_accessible :title, :assignee_id, :position, :description,
23 :milestone_id, :label_list, :author_id_of_changes,
24 :state_event
24 25
25 26 acts_as_taggable_on :labels
26 27
28 state_machine :state, initial: :opened do
  • Created by: dzaporozhets

    Use ruby 1.9 hash syntax please

    By Administrator on 2013-02-19T08:57:22 (imported from GitLab project)

    By Administrator on 2013-02-19T08:57:22 (imported from GitLab)

  • gitlab-qa-bot
  • Unable to load the diff
    • Created by: dzaporozhets

      Use before to prevent duplication

      By Administrator on 2013-02-19T08:57:22 (imported from GitLab project)

      By Administrator on 2013-02-19T08:57:22 (imported from GitLab)

  • Created by: dzaporozhets

    I like the PR. Migration to state_machine is a wise choice.

    But this PR miss logic to migrate existing data.

    All existing issues, merge requests should be properly migrated without any data loss

    By Administrator on 2013-02-18T13:51:31 (imported from GitLab project)

    By Administrator on 2013-02-18T13:51:31 (imported from GitLab)

  • gitlab-qa-bot
  • 29 29 $(function(){
    30 30 merge_request = new MergeRequest({
    31 31 url_to_automerge_check: "#{automerge_check_project_merge_request_path(@project, @merge_request)}",
    32 check_enable: #{@merge_request.state == MergeRequest::UNCHECKED ? "true" : "false"},
    32 check_enable: #{@merge_request.merge_status == MergeRequest::UNCHECKED ? "true" : "false"},
    33 33 url_to_ci_check: "#{ci_status_project_merge_request_path(@project, @merge_request)}",
    34 34 ci_enable: #{@project.gitlab_ci? ? "true" : "false"},
    35 current_state: "#{@merge_request.human_state}",
    35 current_status: "#{@merge_request.human_merge_status}",
    • Created by: dzaporozhets

      You changed key from current_state to current_status but did not change js file at assets/javascript/merge_request... This means accept widget not working properly now

      By Administrator on 2013-02-19T08:57:22 (imported from GitLab project)

      By Administrator on 2013-02-19T08:57:22 (imported from GitLab)

  • Created by: dzaporozhets

    Also please test functionality you change. Acceptance tests does not cover all cases yet

    By Administrator on 2013-02-19T08:48:31 (imported from GitLab project)

    By Administrator on 2013-02-19T08:48:31 (imported from GitLab)

  • Created by: dzaporozhets

    thank you

    By Administrator on 2013-02-19T09:05:36 (imported from GitLab project)

    By Administrator on 2013-02-19T09:05:36 (imported from GitLab)

  • Created by: Andrew8xx8

    Thank you too)

    By Administrator on 2013-02-19T09:06:47 (imported from GitLab project)

    By Administrator on 2013-02-19T09:06:47 (imported from GitLab)

  • Created by: zzet

    Nice!

    By Administrator on 2013-02-19T10:02:10 (imported from GitLab project)

    By Administrator on 2013-02-19T10:02:10 (imported from GitLab)

  • Please register or sign in to reply
    Loading