Show More
@@ -245,7 +245,7 b' class ChangesetCommentsModel(BaseModel):' | |||||
245 |
|
245 | |||
246 | registry = get_current_registry() |
|
246 | registry = get_current_registry() | |
247 | rhodecode_plugins = getattr(registry, 'rhodecode_plugins', {}) |
|
247 | rhodecode_plugins = getattr(registry, 'rhodecode_plugins', {}) | |
248 | channelstream_config = rhodecode_plugins.get('channelstream') |
|
248 | channelstream_config = rhodecode_plugins.get('channelstream', {}) | |
249 | msg_url = '' |
|
249 | msg_url = '' | |
250 | if commit_obj: |
|
250 | if commit_obj: | |
251 | msg_url = commit_comment_url |
|
251 | msg_url = commit_comment_url | |
@@ -254,7 +254,7 b' class ChangesetCommentsModel(BaseModel):' | |||||
254 | msg_url = pr_comment_url |
|
254 | msg_url = pr_comment_url | |
255 | repo_name = pr_target_repo.repo_name |
|
255 | repo_name = pr_target_repo.repo_name | |
256 |
|
256 | |||
257 | if channelstream_config: |
|
257 | if channelstream_config.get('enabled'): | |
258 | message = '<strong>{}</strong> {} - ' \ |
|
258 | message = '<strong>{}</strong> {} - ' \ | |
259 | '<a onclick="window.location=\'{}\';' \ |
|
259 | '<a onclick="window.location=\'{}\';' \ | |
260 | 'window.location.reload()">' \ |
|
260 | 'window.location.reload()">' \ | |
@@ -262,25 +262,24 b' class ChangesetCommentsModel(BaseModel):' | |||||
262 | message = message.format( |
|
262 | message = message.format( | |
263 | user.username, _('made a comment'), msg_url, |
|
263 | user.username, _('made a comment'), msg_url, | |
264 | _('Refresh page')) |
|
264 | _('Refresh page')) | |
265 | if channelstream_config: |
|
265 | channel = '/repo${}$/pr/{}'.format( | |
266 | channel = '/repo${}$/pr/{}'.format( |
|
266 | repo_name, | |
267 |
|
|
267 | pull_request_id | |
268 | pull_request_id |
|
268 | ) | |
269 |
|
|
269 | payload = { | |
270 | payload = { |
|
270 | 'type': 'message', | |
271 | 'type': 'message', |
|
271 | 'timestamp': datetime.utcnow(), | |
272 | 'timestamp': datetime.utcnow(), |
|
272 | 'user': 'system', | |
273 |
|
|
273 | 'exclude_users': [user.username], | |
274 | 'exclude_users': [user.username], |
|
274 | 'channel': channel, | |
275 |
|
|
275 | 'message': { | |
276 |
'message': |
|
276 | 'message': message, | |
277 |
|
|
277 | 'level': 'info', | |
278 |
|
|
278 | 'topic': '/notifications' | |
279 | 'topic': '/notifications' |
|
|||
280 | } |
|
|||
281 | } |
|
279 | } | |
282 | channelstream_request(channelstream_config, [payload], |
|
280 | } | |
283 | '/message', raise_exc=False) |
|
281 | channelstream_request(channelstream_config, [payload], | |
|
282 | '/message', raise_exc=False) | |||
284 |
|
283 | |||
285 | return comment |
|
284 | return comment | |
286 |
|
285 |
General Comments 0
You need to be logged in to leave comments.
Login now