Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rescheduled 🗓️
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
c3lingo
rescheduled 🗓️
Commits
9eb06684
Commit
9eb06684
authored
10 months ago
by
Teal
Browse files
Options
Downloads
Patches
Plain Diff
only notify for relevant stages
parent
2caf3d32
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/subscribers/telegram_bot_subscriber.rb
+10
-6
10 additions, 6 deletions
app/subscribers/telegram_bot_subscriber.rb
with
10 additions
and
6 deletions
app/subscribers/telegram_bot_subscriber.rb
+
10
−
6
View file @
9eb06684
...
...
@@ -13,20 +13,22 @@ class TelegramBotSubscriber
def
handle_session_updated
(
event
)
Rails
.
logger
.
info
(
"session event
#{
event
.
inspect
}
"
)
model_name
,
action
=
event
.
name
.
split
(
'.'
)
record
=
event
.
payload
[
:record
]
session
=
event
.
payload
[
:record
]
changes
=
event
.
payload
[
:changes
]
return
unless
changes
.
any?
do
|
attr
,
(
from
,
to
)
|
%w[title language status starts_at ends_at stage_id]
.
include?
attr
end
return
unless
session
.
conference
.
relevant_stages
.
include?
session
.
stage
||
changes
[
"stage_id"
].
any?
{
|
stage_id
|
session
.
conference
.
relevant_stages
.
include?
Stage
.
find
(
stage_id
)
}
if
changes
[
"stage_id"
]
changes
[
"stage"
]
=
[
Stage
.
find
(
changes
[
"stage_id"
].
first
).
name
,
Stage
.
find
(
changes
[
"stage_id"
].
last
).
name
]
changes
.
delete
(
"stage_id"
)
end
message
=
"<b><a href=
\"
#{
conference_session_url
(
record
.
conference
,
record
,
host:
'rescheduled.c3lingo.org'
,
protocol:
'https'
)
}
\"
>Session
#{
record
.
title
}
</a>
#{
action
}
</b>
\n
"
+
changes
.
map
{
|
attr
,
(
from
,
to
)
|
"-
#{
attr
}
:
#{
from
}
->
#{
to
}
"
}.
join
(
"
\n
"
)
+
"
\n
#{
conference_session_url
(
record
.
conference
,
record
)
}
"
message
=
"<b><a href=
\"
#{
conference_session_url
(
session
.
conference
,
session
,
host:
'rescheduled.c3lingo.org'
,
protocol:
'https'
)
}
\"
>Session
#{
session
.
title
}
</a>
#{
action
}
</b>
\n
"
+
changes
.
map
{
|
attr
,
(
from
,
to
)
|
"-
#{
attr
}
:
#{
from
}
->
#{
to
}
"
}.
join
(
"
\n
"
)
+
"
\n
#{
conference_session_url
(
session
.
conference
,
session
)
}
"
TelegramGroupChatNotificationJob
.
perform_later
(
target:
"-316096320"
,
text:
message
,
parse_mode:
'HTML'
)
# TelegramGroupChatNotificationJob.perform_later(target: "2192297", text: message, parse_mode: 'HTML')
...
...
@@ -35,11 +37,13 @@ class TelegramBotSubscriber
def
handle_session_speaker_event
(
event
)
Rails
.
logger
.
info
(
"session_speaker event
#{
event
.
inspect
}
"
)
model_name
,
action
=
event
.
name
.
split
(
'.'
)
record
=
event
.
payload
[
:record
]
session
=
record
.
session
session_speaker
=
event
.
payload
[
:record
]
session
=
session_speaker
.
session
return
unless
session
.
conference
.
relevant_stages
.
include?
session
.
stage
message
=
"<b><a href=
\"
#{
conference_session_url
(
session
.
conference
,
session
,
host:
'rescheduled.c3lingo.org'
,
protocol:
'https'
)
}
\"
>Session
#{
session
.
title
}
</a> Speaker Change</b>
\n
"
+
"
#{
record
.
speaker
.
name
}
#{
action
==
'destroyed'
?
'removed'
:
'added'
}
"
+
"
\n
#{
conference_session_url
(
session
.
conference
,
session
)
}
"
"
#{
session_speaker
.
speaker
.
name
}
#{
action
==
'destroyed'
?
'removed'
:
'added'
}
"
+
"
\n
#{
conference_session_url
(
session
.
conference
,
session
)
}
"
TelegramGroupChatNotificationJob
.
perform_later
(
target:
"-316096320"
,
text:
message
,
parse_mode:
'HTML'
)
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment