-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TelegramGroup model, update old logic for use it.
- Loading branch information
Showing
8 changed files
with
74 additions
and
28 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 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,5 @@ | ||
class RedmineChatTelegram::TelegramGroup < ActiveRecord::Base | ||
unloadable | ||
|
||
belongs_to :issue | ||
end |
21 changes: 21 additions & 0 deletions
21
db/migrate/007_create_redmine_chat_telegram_telegram_groups.rb
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,21 @@ | ||
class CreateRedmineChatTelegramTelegramGroups < ActiveRecord::Migration | ||
def up | ||
create_table :redmine_chat_telegram_telegram_groups do |t| | ||
t.belongs_to :issue, index: true, foreign_key: true | ||
t.integer :telegram_id | ||
t.string :shared_url | ||
t.datetime :need_to_close_at | ||
t.datetime :last_notification_at | ||
end | ||
add_index :redmine_chat_telegram_telegram_groups, :telegram_id | ||
|
||
Issue.where.not(telegram_id: nil).find_each do |issue| | ||
issue.create_telegram_group telegram_id: issue.telegram_id.abs, | ||
shared_url: issue.telegram_chat_url | ||
end | ||
end | ||
|
||
def down | ||
drop_table :redmine_chat_telegram_telegram_groups | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require File.expand_path('../../test_helper', __FILE__) | ||
|
||
class RedmineChatTelegram::TelegramGroupTest < ActiveSupport::TestCase | ||
|
||
# Replace this with your real tests. | ||
def test_truth | ||
assert true | ||
end | ||
end |