Skip to content

Commit 463aa1c

Browse files
committed
handle case when theres no attached user to a comment ??
1 parent 4753c9a commit 463aa1c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

api/ruby/find-inactive-members/find_inactive_members.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def issue_activity(repo, date=@date)
144144
def issue_comment_activity(repo, date=@date)
145145
# get all issue comments after specified date and iterate
146146
info "...Issue comments"
147-
@client.issues_comments(repo, { :since => date}).each do |comment|
147+
@client.issues_comments(repo, { :since => date }).each do |comment|
148148
# if commenter is a member of the org and not active, make active
149149
if t = @members.find {|member| member[:login] == comment["user"]["login"] && member[:active] == false }
150150
make_active(t[:login])
@@ -155,7 +155,11 @@ def issue_comment_activity(repo, date=@date)
155155
def pr_activity(repo, date=@date)
156156
# get all pull request comments comments after specified date and iterate
157157
info "...Pull Request comments"
158-
@client.pull_requests_comments(repo, { :since => date}).each do |comment|
158+
@client.pull_requests_comments(repo, { :since => date }).each do |comment|
159+
# if there's no user (ghost user?) then skip this // THIS NEEDS BETTER VALIDATION
160+
if comment["user"].nil?
161+
next
162+
end
159163
# if commenter is a member of the org and not active, make active
160164
if t = @members.find {|member| member[:login] == comment["user"]["login"] && member[:active] == false }
161165
make_active(t[:login])

0 commit comments

Comments
 (0)