Skip to content

Commit

Permalink
fixes #317
Browse files Browse the repository at this point in the history
  • Loading branch information
owocki committed Jan 31, 2018
1 parent 2a2599f commit 37479c0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 41 deletions.
41 changes: 2 additions & 39 deletions app/assets/v2/js/pages/bounty_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,45 +101,8 @@ var callbacks = {
return [ 'status', ui_status];
},
'issue_description': function(key, val, result){
var ui_body = val;
var allowed_tags = ['br', 'li', 'em', 'ol', 'ul', 'p', 'td', 'a', 'img', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'code'];
var open_close = ['', '/'];
var replace_tags = {
'h1': 'h5',
'h2': 'h5',
'h3': 'h5',
'h4': 'h5',
}

for(var i=0; i<allowed_tags.length;i++){
var tag = allowed_tags[i];
for(var k=0; k<open_close.length;k++){
var oc = open_close[k];
var replace_tag = '&lt;'+ oc + tag +'.*&gt;';
var with_tag = '<'+ oc + tag +'>';
var re = new RegExp(replace_tag, 'g');
ui_body = ui_body.replace(re, with_tag);
var re = new RegExp(replace_tag.toUpperCase(), 'g');
ui_body = ui_body.replace(re, with_tag);
}
}
for(var key in replace_tags){
for(var k=0; k<open_close.length;k++){
var oc = open_close[k];
var replace = key;
var _with = replace_tags[key];
var replace_tag = '<'+ oc + replace +'>';
var with_tag = '<'+ oc + _with +'>';
var re = new RegExp(replace_tag, 'g');
ui_body = ui_body.replace(re, with_tag);
}
}

var max_len = 1000
if(ui_body.length > max_len){
ui_body = ui_body.substring(0, max_len) + '... <a target=new href="'+result['github_url']+'">See More</a> '
}
return [ 'issue_description', ui_body];
var converter = new showdown.Converter();
return [ 'issue_description', converter.makeHtml(val)];
},
'fulfiller_address': address_ize,
'bounty_owner_address': address_ize,
Expand Down
4 changes: 2 additions & 2 deletions app/assets/v2/js/pages/new_bounty.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ $(document).ready(function(){
mixpanel.track("New Bounty Error", {step: 'post_bounty', error: error});
console.error(error);
_alert({ message: "There was an error. Please try again or contact support." });
$('#submitBounty').removeAttr('disabled');
unloading_button($('#submitBounty'));
return;
}

Expand All @@ -235,7 +235,7 @@ $(document).ready(function(){
mixpanel.track("New Bounty Error", {step: 'post_ipfs', error: error});
console.error(error);
_alert({ message: "There was an error. Please try again or contact support." });
$('#submitBounty').removeAttr('disabled');
unloading_button($('#submitBounty'));
return;
}

Expand Down
3 changes: 3 additions & 0 deletions app/assets/v2/js/showdown.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/dashboard/templates/bounty_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ <h5>Started Work</h5>
<script src="{% static "legacy/v2/js/pages/bounty_details.js" %}"></script>
<script src="{% static "legacy/v2/js/shared.js" %}"></script>
{% else %}
<script src="{% static "v2/js/showdown.js" %}"></script>
<script src="{% static "v2/js/abi.js" %}"></script>
<script src="{% static "v2/js/tokens.js" %}"></script>
<script src="{% static "v2/js/pages/bounty_details.js" %}"></script>
Expand Down

0 comments on commit 37479c0

Please sign in to comment.