Show More
@@ -29,6 +29,7 b' from webob.exc import HTTPNotFound, HTTP' | |||||
29 | from pylons import request, tmpl_context as c, url |
|
29 | from pylons import request, tmpl_context as c, url | |
30 | from pylons.controllers.util import redirect |
|
30 | from pylons.controllers.util import redirect | |
31 | from pylons.i18n.translation import _ |
|
31 | from pylons.i18n.translation import _ | |
|
32 | from pyramid.threadlocal import get_current_registry | |||
32 | from sqlalchemy.sql import func |
|
33 | from sqlalchemy.sql import func | |
33 | from sqlalchemy.sql.expression import or_ |
|
34 | from sqlalchemy.sql.expression import or_ | |
34 |
|
35 | |||
@@ -40,6 +41,7 b' from rhodecode.lib.base import (' | |||||
40 | from rhodecode.lib.auth import ( |
|
41 | from rhodecode.lib.auth import ( | |
41 | LoginRequired, HasRepoPermissionAnyDecorator, NotAnonymous, |
|
42 | LoginRequired, HasRepoPermissionAnyDecorator, NotAnonymous, | |
42 | HasAcceptedRepoType, XHRRequired) |
|
43 | HasAcceptedRepoType, XHRRequired) | |
|
44 | from rhodecode.lib.channelstream import channelstream_request | |||
43 | from rhodecode.lib.utils import jsonify |
|
45 | from rhodecode.lib.utils import jsonify | |
44 | from rhodecode.lib.utils2 import safe_int, safe_str, str2bool, safe_unicode |
|
46 | from rhodecode.lib.utils2 import safe_int, safe_str, str2bool, safe_unicode | |
45 | from rhodecode.lib.vcs.backends.base import EmptyCommit |
|
47 | from rhodecode.lib.vcs.backends.base import EmptyCommit | |
@@ -520,6 +522,34 b' class PullrequestsController(BaseRepoCon' | |||||
520 | count_added=len(changes.added), |
|
522 | count_added=len(changes.added), | |
521 | count_removed=len(changes.removed)) |
|
523 | count_removed=len(changes.removed)) | |
522 | h.flash(msg, category='success') |
|
524 | h.flash(msg, category='success') | |
|
525 | registry = get_current_registry() | |||
|
526 | rhodecode_plugins = getattr(registry, | |||
|
527 | 'rhodecode_plugins', {}) | |||
|
528 | channelstream_config = rhodecode_plugins.get( | |||
|
529 | 'channelstream', {}) | |||
|
530 | if channelstream_config.get('enabled'): | |||
|
531 | message = msg + ' - <a onclick="' \ | |||
|
532 | 'window.location.reload()">' \ | |||
|
533 | '<strong>{}</strong></a>'.format( | |||
|
534 | _('Reload page') | |||
|
535 | ) | |||
|
536 | channel = '/repo${}$/pr/{}'.format( | |||
|
537 | pull_request.target_repo.repo_name, | |||
|
538 | pull_request.pull_request_id | |||
|
539 | ) | |||
|
540 | payload = { | |||
|
541 | 'type': 'message', | |||
|
542 | 'user': 'system', | |||
|
543 | 'exclude_users': [request.user.username], | |||
|
544 | 'channel': channel, | |||
|
545 | 'message': { | |||
|
546 | 'message': message, | |||
|
547 | 'level': 'success', | |||
|
548 | 'topic': '/notifications' | |||
|
549 | } | |||
|
550 | } | |||
|
551 | channelstream_request(channelstream_config, [payload], | |||
|
552 | '/message', raise_exc=False) | |||
523 | else: |
|
553 | else: | |
524 | h.flash(_("Nothing changed in pull request."), |
|
554 | h.flash(_("Nothing changed in pull request."), | |
525 | category='warning') |
|
555 | category='warning') |
General Comments 0
You need to be logged in to leave comments.
Login now