Skip to content

Commit

Permalink
Add support for moving stories between projects (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
TimKJones authored and forest committed Jan 21, 2019
1 parent 5e3803a commit 0938634
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/tracker_api/resources/story.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class UpdateRepresenter < Representable::Decorator
property :deadline
property :requested_by_id
property :owner_ids, if: ->(_) { !owner_ids.blank? }
property :project_id

# Use render_empty: false to address: https://github.com/dashofcode/tracker_api/issues/110
# - The default value of the labels attribute in Resources::Story is an empty array.
Expand Down Expand Up @@ -165,6 +166,17 @@ def transitions(params = {})
end
end

# Returns the story's original ("undirtied") project_id
#
# @return Integer
def project_id
if dirty_attributes.key?(:project_id)
original_attributes[:project_id]
else
@project_id
end
end

# @param [Hash] params attributes to create the task with
# @return [Task] newly created Task
def create_task(params)
Expand Down

0 comments on commit 0938634

Please sign in to comment.