lib/reminder/task.rb in lita-reminder-0.0.2 vs lib/reminder/task.rb in lita-reminder-0.0.3
- old
+ new
@@ -67,12 +67,14 @@
end
end
end
def stop_repeat
- @repeat_job.unschedule
- @repeat_job = nil
+ unless @repeat_job.nil?
+ @repeat_job.unschedule
+ @repeat_job = nil
+ end
unless @periodic
kill
end
end
@@ -124,10 +126,14 @@
elsif message['who'] == 'here'
attrs['room'] = source.room
else
re = /^(user\s+id\s+(?<user_id>.*))?^(user\s+name\s+(?<user_id>.*))?(room \s+(?<room>.*))?$/
m = re.match(message['who'])
- attrs = attrs.merge(m)
+ if m.nil?
+ attrs['user_name'] = message['who']
+ else
+ attrs = attrs.merge(m)
+ end
end
attrs['type'] = message['type']
attrs['time'] = message['time']
attrs['first'] = Chronic.parse(message['first']) unless message['first'].nil?
attrs['repeat'] = message['repeat']