Skip to content

Commit

Permalink
Merge pull request #91 from centosadmin/develop
Browse files Browse the repository at this point in the history
Release 1.2.1
  • Loading branch information
vladislav-yashin authored Apr 26, 2018
2 parents 67403de + b95f456 commit 2cc786e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.2.1

* Fix helpdesk support

# 1.2.0

* Fix rack-protection issue
Expand Down
12 changes: 6 additions & 6 deletions app/models/intouch_sender.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ class IntouchSender
unloadable

def self.send_email_message(issue_id, state)
EmailSenderWorker.perform_in(5.seconds, issue_id, state)
EmailSenderWorker.perform_async(issue_id, state)
end

def self.send_telegram_message(issue_id, state)
TelegramSenderWorker.perform_in(5.seconds, issue_id, state)
TelegramSenderWorker.perform_async(issue_id, state)
end

def self.send_telegram_group_message(issue_id, group_ids, state)
TelegramGroupSenderWorker.perform_in(5.seconds, issue_id, group_ids, state)
TelegramGroupSenderWorker.perform_async(issue_id, group_ids, state)
end

def self.send_live_email_message(issue_id, journal_id, required_recipients = [])
EmailLiveSenderWorker.perform_in(5.seconds, issue_id, journal_id, required_recipients)
EmailLiveSenderWorker.perform_async(issue_id, journal_id, required_recipients)
end

def self.send_live_telegram_message(issue_id, journal_id, required_recipients = [])
TelegramLiveSenderWorker.perform_in(5.seconds, issue_id, journal_id, required_recipients)
TelegramLiveSenderWorker.perform_async(issue_id, journal_id, required_recipients)
end

def self.send_live_telegram_group_message(issue_id, journal_id)
TelegramGroupLiveSenderWorker.perform_in(5.seconds, issue_id, journal_id)
TelegramGroupLiveSenderWorker.perform_async(issue_id, journal_id)
end
end
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
name 'Redmine Intouch plugin'
url 'https://github.com/centosadmin/redmine_intouch'
description 'This is a plugin for Redmine which sends a reminder email and Telegram messages to the assignee workign on a task, whose status is not updated with-in allowed duration'
version '1.2.0'
version '1.2.1'
author 'Southbridge'
author_url 'https://github.com/centosadmin'

Expand Down
4 changes: 3 additions & 1 deletion lib/intouch/issue_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def live_recipient_ids(protocol)
end

def intouch_live_recipients(protocol)
User.where(id: live_recipient_ids(protocol))
users = User.where(id: live_recipient_ids(protocol))
contacts = protocol == 'email' && project.module_enabled?(:contacts) ? ([self.customer] + self.contacts.to_a).uniq : []
users + contacts.compact - [User.anonymous]
end

private
Expand Down
3 changes: 1 addition & 2 deletions lib/intouch/live/message/private.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def initialize(issue, project, journal: nil)

def send
return unless need_private_message?

send_telegram_private_messages
send_email_messages
end
Expand All @@ -34,7 +33,7 @@ def send_telegram_private_messages
def send_email_messages
return unless email_enabled?

::IntouchSender.send_live_email_message(issue.id, @journal.id, required_recipients)
::IntouchSender.send_live_email_message(issue.id, @journal&.id, required_recipients)
end

def telegram_enabled?
Expand Down
2 changes: 1 addition & 1 deletion lib/intouch/patches/journal_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def self.included(base) # :nodoc:
private

def handle_updated_issue
LiveHandlerWorker.perform_in(5.seconds, id)
LiveHandlerWorker.perform_async(id)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/intouch/regular/recipients_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def call
return [] unless recipient_ids.present?

users = User.where(id: recipient_ids).status(User::STATUS_ACTIVE)
customer = @issue.customer if @protocol == 'email' && @issue.project.module_enabled?(:contacts)
users + [customer].compact - [User.anonymous]
contacts = @protocol == 'email' && @issue.project.module_enabled?(:contacts) ? ([@issue.customer] + @issue.contacts.to_a).uniq : []
users + contacts.compact - [User.anonymous]
end

def recipient_ids
Expand Down

0 comments on commit 2cc786e

Please sign in to comment.