#3183 Fix commenting on PRs and issues if the SSE is not configured at all
Merged 5 years ago by pingou. Opened 5 years ago by pingou.

file modified
+10 -2
@@ -664,10 +664,14 @@ 

  {% if config['EVENTSOURCE_SOURCE'] and not issue.private %}

  <script type="text/javascript"

    src="{{ url_for('static', filename='issue_ev.js') }}"></script>

+ {% endif %}

+ 

  

  <script type="text/javascript">

  var source = null;

  var sse = true;

+ 

+ {% if config['EVENTSOURCE_SOURCE'] and not issue.private %}

  if (!!window.EventSource) {

    source = new EventSource('{{ config["EVENTSOURCE_SOURCE"]

      + request.script_root + request.path }}');
@@ -714,6 +718,10 @@ 

  

    }, false);

  

+ {% else %}

+ sse = false;

+ {% endif %}

+ 

  {% if g.authenticated and form %}

  function set_ui_for_comment(setting){

    if (setting == false) {
@@ -774,9 +782,9 @@ 

  {% endif %}

  

  </script>

- {% endif %}

- <script type="text/javascript">

  

+ 

+ <script type="text/javascript">

  {% if g.authenticated and g.repo_user %}

  function take_issue(){

    var _url = "{{ url_for('api_ns.api_assign_issue',

@@ -1688,11 +1688,11 @@ 

  </script>

  

  

- {% if config['EVENTSOURCE_SOURCE'] and pull_request %}

  

  <script type="text/javascript">

  var source = null;

  var sse = true;

+ {% if config['EVENTSOURCE_SOURCE'] and pull_request %}

  if (!!window.EventSource) {

    source = new EventSource('{{ config["EVENTSOURCE_SOURCE"]

      + request.script_root + request.path }}');
@@ -1715,8 +1715,10 @@ 

    setup_edit_btns();

    setup_reply_btns();

    }, false);

- </script>

+ {% else %}

+ sse = false;

  {% endif %}

+ </script>

  

  {% if repo.quick_replies %}

  <script type="text/javascript" src="{{ url_for('static', filename='quick_reply.js') }}"></script>