forked from arkhitech/redmine_update_reminder
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from centosadmin/develop
Develop
- Loading branch information
Showing
40 changed files
with
325 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class SlackLiveWorker | ||
include Sidekiq::Worker | ||
|
||
def perform(issue_id, journal_id, recipient_ids) | ||
return if recipient_ids.blank? | ||
|
||
issue = Issue.find_by(id: issue_id) || return | ||
journal = Journal.find_by(id: journal_id) | ||
|
||
issue = Intouch::IssueDecorator.new(issue, journal, protocol: 'slack') | ||
|
||
slack_accounts = SlackAccount.where(user_id: recipient_ids) | ||
|
||
client = RedmineBots::Slack.bot_client | ||
|
||
channels = client.im_list | ||
|
||
return unless channels['ok'] | ||
|
||
channels.ims.select { |im| im.user.in?(slack_accounts.map(&:slack_id)) }.each do |channel| | ||
client.chat_postMessage(text: issue.as_markdown, channel: channel.id) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
class SlackRegularWorker | ||
include Sidekiq::Worker | ||
|
||
def perform(issue_id, state) | ||
issue = Issue.find_by(id: issue_id) || return | ||
project = issue.project | ||
|
||
return unless Intouch::Regular::Checker::Base.new( | ||
issue: issue, | ||
state: state, | ||
project: project | ||
).required? | ||
|
||
slack_accounts = SlackAccount.where( | ||
user_id: Intouch::Regular::RecipientsList.new( | ||
issue: issue, | ||
state: state, | ||
protocol: 'slack' | ||
).call.map(&:id) | ||
).to_a | ||
|
||
return if slack_accounts.empty? | ||
|
||
client = RedmineBots::Slack.bot_client | ||
|
||
channels = client.im_list | ||
|
||
return unless channels['ok'] | ||
|
||
channels = client.im_list | ||
|
||
return unless channels['ok'] | ||
|
||
channels.ims.select { |im| im.user.in?(slack_accounts.map(&:slack_id)) }.each do |channel| | ||
client.chat_postMessage(text: issue.as_markdown, channel: channel.id) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.