diff --git a/app/app/context.py b/app/app/context.py index 47b95a233cc..459d2d5dc4e 100644 --- a/app/app/context.py +++ b/app/app/context.py @@ -38,12 +38,14 @@ logger = logging.getLogger(__name__) + def fetchPost(qt='2'): """Fetch last post from wordpress blog.""" url = f"https://gitcoin.co/blog/wp-json/wp/v2/posts?_fields=excerpt,title,link,jetpack_featured_media_url&per_page={qt}" last_posts = requests.get(url=url).json() return last_posts + @cached_as(Announcement.objects.filter(key__in=['footer', 'header']), timeout=120) def get_sitewide_announcements(): announcements = Announcement.objects.filter(key__in=['footer', 'header']) diff --git a/app/app/urls.py b/app/app/urls.py index c3de94d0def..dd17bd14ee6 100644 --- a/app/app/urls.py +++ b/app/app/urls.py @@ -439,8 +439,16 @@ # bounty requests re_path(r'^requests/?', bounty_requests.views.bounty_request, name='bounty_requests'), - url('^api/v1/bounty_request/create', bounty_requests.views.create_bounty_request_v1, name='create_bounty_request_v1'), - url('^api/v1/bounty_request/update', bounty_requests.views.update_bounty_request_v1, name='update_bounty_request_v1'), + url( + '^api/v1/bounty_request/create', + bounty_requests.views.create_bounty_request_v1, + name='create_bounty_request_v1' + ), + url( + '^api/v1/bounty_request/update', + bounty_requests.views.update_bounty_request_v1, + name='update_bounty_request_v1' + ), # admin views re_path(r'^_administration/?', admin.site.urls, name='admin'), diff --git a/app/assets/v2/js/activity.js b/app/assets/v2/js/activity.js index 9d379c6f344..0a1618d99dd 100644 --- a/app/assets/v2/js/activity.js +++ b/app/assets/v2/js/activity.js @@ -389,16 +389,19 @@ $(document).ready(function() { }); $('.activity.wall_post .activity-status b, .activity.status_update .activity-status b').each(function() { - let new_text = $(this).text(); - - new_text = new_text.replace('<', '_'); - new_text = new_text.replace('>', '_'); - new_text = new_text.replace('>', '_'); - new_text = new_text.replace('<', '_'); - new_text = urlify(new_text); - new_text = new_text.replace(/#(\S*)/g, '#$1'); - new_text = new_text.replace(/@(\S*)/g, '@$1'); - $(this).html(new_text); + if (!$(this).hasClass('clean')) { + let new_text = $(this).text(); + + new_text = new_text.replace('<', '_'); + new_text = new_text.replace('>', '_'); + new_text = new_text.replace('>', '_'); + new_text = new_text.replace('<', '_'); + new_text = urlify(new_text); + new_text = new_text.replace(/#(\S*)/g, '#$1'); + new_text = new_text.replace(/@(\S*)/g, '@$1'); + $(this).html(new_text); + $(this).addClass('clean'); + } }); // inserts links into the text where there are URLS detected diff --git a/app/assets/v2/js/pages/tribe-edit.js b/app/assets/v2/js/pages/tribe-edit.js index d4b78e28051..03da7709c68 100644 --- a/app/assets/v2/js/pages/tribe-edit.js +++ b/app/assets/v2/js/pages/tribe-edit.js @@ -204,16 +204,16 @@ $('[data-createbountyrequest]').on('click', function() { _alert('Bounty Request has been created'); location.reload(); } else { - _alert('Error creating bounty request. Try again later', 'error'); + _alert(`Error creating bounty request as ${response.message}`, 'error'); console.error(response.message); } }).fail(function(error) { - _alert('Error creating bounty request. Try again later', 'error'); + _alert(`Error creating bounty request as ${error}`, 'error'); console.error('error: unable to creating bounty request', error); }); }).catch(error => { - _alert(`Error creating bounty request. Try again later. ${error}`, 'error'); + _alert(`Error creating bounty request as ${error}`, 'error'); console.error('error: unable to creating bounty request', error); }); }); @@ -238,12 +238,12 @@ $('[data-cancelbountyrequest]').on('click', function() { _alert('Bounty Request has been rejected'); $(`#${bounty_request_id}`).hide(); } else { - _alert('Error rejecting bounty request. Try again later', 'error'); + _alert(`Error rejecting bounty request as ${response.message}`, 'error'); console.error(response.message); } }).fail(function(error) { - _alert('Error rejecting bounty request. Try again later', 'error'); + _alert(`Error rejecting bounty request. ${error}`, 'error'); console.error('error: unable to reject bounty request', error); }); }); \ No newline at end of file diff --git a/app/assets/v2/js/status.js b/app/assets/v2/js/status.js index e1901c9026c..0472f7a7bda 100644 --- a/app/assets/v2/js/status.js +++ b/app/assets/v2/js/status.js @@ -80,6 +80,20 @@ $(document).ready(function() { $('#textarea').focus(); } + document.is_shift = false; + // handle shift button + $('body').on('keyup', '#textarea', function(e) { + if (e.keyCode == 16) { + document.is_shift = false; + } + }); + // handle shift button + $('body').on('keydown', '#textarea', function(e) { + if (e.keyCode == 16) { + document.is_shift = true; + } + }); + $('body').on('focus change paste keyup blur', '#textarea', function(e) { // enforce a max length @@ -88,19 +102,11 @@ $(document).ready(function() { if ($(this).val().trim().length > max_len) { e.preventDefault(); $(this).addClass('red'); - var old_val = $(this).val(); - - setTimeout(function() { - $('#textarea').val(old_val.slice(0, max_len)); - }, 20); - } else { - $(this).removeClass('red'); - } - - // enable post via enter button - if ($(this).val().trim().length > 4) { + $('#btn_post').attr('disabled', true); + } else if ($(this).val().trim().length > 4) { $('#btn_post').attr('disabled', false); - if ($('#textarea').is(':focus') && (e.keyCode == 13)) { + $(this).removeClass('red'); + if ($('#textarea').is(':focus') && !document.is_shift && (e.keyCode == 13)) { submitStatusUpdate(); e.preventDefault(); } @@ -110,6 +116,9 @@ $(document).ready(function() { }); function submitStatusUpdate() { + if ($('#btn_post').is(':disabled')) { + return; + } const data = new FormData(); const message = $('#textarea'); const ask = $('.activity_type_selector .active input').val(); diff --git a/app/dashboard/templates/dashboard/sidebar_search_hackathon.html b/app/dashboard/templates/dashboard/sidebar_search_hackathon.html index cc08e542172..eed9b8c0320 100644 --- a/app/dashboard/templates/dashboard/sidebar_search_hackathon.html +++ b/app/dashboard/templates/dashboard/sidebar_search_hackathon.html @@ -52,9 +52,9 @@ {% for org in orgs %} -
- -