Skip to content

Commit 0894a1f

Browse files
committed
Corrects problem with unassigned issue reassingment
1 parent fefb89d commit 0894a1f

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
linear-cli (0.7.0)
4+
linear-cli (0.7.1)
55
base64 (~> 0.2)
66
dry-cli (~> 1.0)
77
dry-cli-completion (~> 1.0)

lib/linear/commands/issue.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def make_da_issue!(**options)
6161

6262
def gimme_da_issue!(issue_id, me: Rubyists::Linear::User.me) # rubocop:disable Naming/MethodParameterName
6363
logger.trace('Looking up issue', issue_id:, me:)
64+
require 'pry'; binding.pry
6465
issue = Rubyists::Linear::Issue.find(issue_id)
6566
if issue.assignee && issue.assignee[:id] == me.id
6667
prompt.say("You are already assigned #{issue_id}")

lib/linear/commands/issue/develop.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Develop
2222

2323
def call(issue_id:, **options)
2424
logger.debug('Developing issue', options:)
25-
issue = gimme_da_issue!(issue_id, Rubyists::Linear::User.me)
25+
issue = gimme_da_issue!(issue_id, me: Rubyists::Linear::User.me)
2626
branch_name = issue.branchName
2727
branch = branch_for(branch_name)
2828
branch.checkout

lib/linear/models/base_model.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ def self.included(base) # rubocop:disable Metrics/MethodLength
3434

3535
# Class methods for Linear models.
3636
class << self
37-
def has_one(relation, klass) # rubocop:disable Naming/PredicateName
37+
def one_to_one(relation, klass)
3838
define_method relation do
3939
return instance_variable_get("@#{relation}") if instance_variable_defined?("@#{relation}")
40+
return unless (val = data[relation])
4041

41-
instance_variable_set("@#{relation}", Rubyists::Linear.const_get(klass).new(data[relation]))
42+
instance_variable_set("@#{relation}", Rubyists::Linear.const_get(klass).new(val))
4243
end
4344

4445
define_method "#{relation}=" do |val|

lib/linear/models/issue.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ module Linear
1010
# The Issue class represents a Linear issue.
1111
class Issue # rubocop:disable Metrics/ClassLength
1212
include SemanticLogger::Loggable
13-
has_one :assignee, :User
14-
has_one :team, :Team
13+
one_to_one :assignee, :User
14+
one_to_one :team, :Team
1515

1616
BASIC_FILTER = { completedAt: { null: true } }.freeze
1717

0 commit comments

Comments
 (0)