File tree 3 files changed +19
-0
lines changed
3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ def save_and_redirect
106
106
redirect_to new_stream_path
107
107
when @stream . published?
108
108
Rails . logger . info ( "pushing to youtube" )
109
+ @stream . notify_team!
109
110
stream_to_youtube
110
111
redirect_to profile_stream_path ( current_user . username )
111
112
else
Original file line number Diff line number Diff line change
1
+ class Slack
2
+ class << self
3
+ def notify! ( emoji , message )
4
+ connection = Faraday . new ( url : ENV [ 'SLACK_WEBHOOK_URL' ] )
5
+ response = connection . post ( '' , payload : {
6
+ "icon_emoji" => emoji ,
7
+ 'text' => "#{ message } (cc <!here>)"
8
+ } . to_json )
9
+ end
10
+ end
11
+ end
Original file line number Diff line number Diff line change @@ -24,6 +24,13 @@ def broadcasting?
24
24
broadcasting == true
25
25
end
26
26
27
+ def notify_team!
28
+ user_link = "<https://coderwall.com/#{ user . username } |#{ user . username } >"
29
+ stream_link = "<https://coderwall.com/#{ user . username } /live|View Stream>"
30
+ message = "#{ user_link } just started live streaming. #{ stream_link } "
31
+ Slack . notify! ( ':movie_camera:' , message )
32
+ end
33
+
27
34
def self . any_broadcasting?
28
35
Rails . cache . fetch ( 'any-streams-broadcasting' , expires_in : 5 . seconds ) do
29
36
broadcasting . any?
You can’t perform that action at this time.
0 commit comments