Skip to content

Commit 8401a49

Browse files
Feature/chat mentors (#6963)
* Change pagination from 100 -> 10 for hackathon project response fix for infinite scrolling on project directory * let sponsors set winners * add mentors to bounty channels * Wip can manage for sponsors on mentors * add event as a valid param key for bounties viewset * update bootstrap vue to 2.1.5, migrate chat functionality into a slideout sidebar * remove mention of embed.html to ensure no crashing, TODO: remove embed.html * Chat is now in a Sidebar, needs testing * users are now automatically logged in if no session found when activating the chat window * wip, chat sidebar works across browsers with notifications, NOTE: mattermost webapp changes needed * new approach for the chat integration, remove the iframe from sitting on the dom, and lazy load the sidebar/iframe, in conjunction with a new notification approach for the main app, doesn't use postMessage and uses the websocket to the chat instead * remove some comments and eslint fixes * WIP, more chatWindow handlers to be migrated and rebound/moved to the new flow, e2e flow is in place * Mobile Fixes - sidebar is full width for mobile now, and has a header(needs styling) - login flow is improved for mobile apps. * remove the socket hijack for the frame logged in test, use the window and content document of hte iframe through cross origin setup. * rm test nginx conf * remove jquery from the contentWindow if check * chat panel app cleanup, needs styling around copy/content of loading * eslint fixes * abstract iframe fetch into helper * mentor v0 - can add N number of mentors to the mentor group per bounty, and they are added into the project channels of which are associated * updates to fix the sponsor widget margins * Chat Mentors Release - project channel refactor into a celery task - set mentors through the sponsorship dashboard in the hackathon view * use .first() * updated chat docs * WIP, default mentors now can be setup from the hackathon dashboard, adjustments to what js is loaded, chat is now available everywhere * move dashboard next to guide * for the chat application move all logger calls to info instead of debug or error * fix for the intro filter and expanded it to allow filtering by sponsors including @sponsor handle posts * fix for bad anchor element placement * rename all posts to all * cleanup and mentors are now apart of the hackathon chat sync tasks * hardcode the document.domain to gitcoin.co * eslint fixes * fixes from review * fixes from rebase/review Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>
1 parent 3f8aa16 commit 8401a49

31 files changed

+1103
-354
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*.DS_Store*
22
*.pyc
3-
chatconfig/config.json
3+
chatdata/config/*
4+
chatdata/root.html
45
static/*
56
sftp-config.json
67
app/app/local_settings.py

app/app/urls.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
# chat
172172
url(r'^chat/landing', chat.views.chat, name='landing_chat'),
173173
url(r'^chat/landing/', chat.views.chat, name='landing_chat2'),
174-
re_path(r'^chat/?', chat.views.embed, name='chat'),
174+
url(r'^chat/login/', chat.views.chat_login, name='chat_login'),
175175
# Health check endpoint
176176
re_path(r'^health/', include('health_check.urls')),
177177
re_path(r'^lbcheck/?', healthcheck.views.lbcheck, name='lbcheck'),
@@ -232,6 +232,7 @@
232232
path('hackathon/<str:hackathon>/projects/', dashboard.views.hackathon_projects, name='hackathon_projects'),
233233
path('hackathon/<str:hackathon>/showcase/', dashboard.views.hackathon, name='hackathon_showcase_proxy'),
234234
path('hackathon/<str:hackathon>/prizes/', dashboard.views.hackathon, name='hackathon_prizes'),
235+
path('hackathon/<str:hackathon>/townsquare/', dashboard.views.hackathon, name='hackathon_ts'),
235236
path(
236237
'hackathon/projects/<str:hackathon>/<str:project>', dashboard.views.hackathon_project, name='hackathon_project'
237238
),
@@ -700,6 +701,7 @@
700701

701702
# users
702703
url(r'^api/v0.1/user_bounties/', dashboard.views.get_user_bounties, name='get_user_bounties'),
704+
url(r'^api/v0.1/bounty_mentor/', dashboard.views.bounty_mentor, name='bounty_mentor'),
703705
url(r'^api/v0.1/users_fetch/', dashboard.views.users_fetch, name='users_fetch'),
704706

705707
# wiki

app/app/utils.py

-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ def sync_profile(handle, user=None, hide_profile=True):
211211

212212
except Exception as e:
213213
logger.error(str(e))
214-
raise ValueError(e)
215214

216215
except UserSocialAuth.DoesNotExist:
217216
pass

app/assets/v2/css/base.css

+16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
/* stylelint-disable no-descending-specificity */
22

33
/* ...because sometimes descending-specificity is a PIA to clean up */
4+
5+
6+
7+
.iframe-embed-loading {
8+
margin-top:50% !important;
9+
}
10+
11+
#sidebar-chat .b-sidebar-body {
12+
overflow-y: hidden !important;
13+
}
14+
15+
.chatWrapper iframe {
16+
width: 100%;
17+
min-height: 100vh;
18+
}
19+
420
div.body {
521
min-height: 400px;
622
}

app/assets/v2/css/bootstrap-vue.min.css

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/assets/v2/css/dashboard-vue-hackathon.css

-14
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
@media only screen and (max-width: 320px) {
2-
.chatWrapper {
3-
height: 76vh !important;
4-
}
5-
6-
.chatWrapper iframe {
7-
height: 92vh !important;
8-
}
9-
}
10-
111
.ribbon {
122
width: 150px;
133
height: 150px;
@@ -155,10 +145,6 @@
155145
background-color: var(--gc-blue-hover) !important;
156146
}
157147

158-
.chatWrapper iframe {
159-
width: 100%;
160-
height: 50vh;
161-
}
162148

163149
.card-bg {
164150
background-color: #0C1A27;

app/assets/v2/js/base.js

+1-54
Original file line numberDiff line numberDiff line change
@@ -451,61 +451,8 @@ const gitcoinUpdates = () => {
451451
});
452452

453453
};
454-
455-
456-
if (document.contxt.chat_access_token && document.contxt.chat_id) {
457-
// setup polling check for any updated data from chat
458-
// and set users as active on chat just by browsing gitcoin
459-
// scope our polling function so any potential js crashes won't affect it.
460-
(($) => {
461-
462-
const checkChatNotifications = () => {
463-
$.ajax({
464-
beforeSend: function(request) {
465-
request.setRequestHeader('Authorization', `Bearer ${document.contxt.chat_access_token}`);
466-
},
467-
url: `${document.contxt.chat_url}/api/v4/users/me/teams/unread`,
468-
dataType: 'json',
469-
success: (JSONUnread) => {
470-
let notified = false;
471-
472-
JSONUnread.forEach((team) => {
473-
if ((team.msg_count > 0 || team.mention_count > 0) && !notified) {
474-
$('#chat-notification-dot').addClass('notification__dot_active');
475-
notified = true;
476-
}
477-
});
478-
479-
},
480-
error: (error => {
481-
console.log(error);
482-
})
483-
});
484-
};
485-
486-
const set_as_active = () => {
487-
$.ajax({
488-
url: '/api/v0.1/chat/presence',
489-
dataType: 'json',
490-
success: (response) => {
491-
console.log(response);
492-
},
493-
error: (error => {
494-
console.log(error);
495-
})
496-
});
497-
};
498-
499-
500-
setInterval(() => {
501-
checkChatNotifications();
502-
set_as_active();
503-
}, document.contxt.chat_persistence_frequency);
504-
checkChatNotifications();
505-
set_as_active();
506-
})(jQuery);
507-
}
508454
// carousel/collabs/... inside menu
455+
509456
$(document).on('click', '.gc-megamenu .dropdown-menu', function(e) {
510457
e.stopPropagation();
511458
});

0 commit comments

Comments
 (0)