Skip to content

Commit 7e82ea0

Browse files
Merge pull request #5569 from gitcoinco/chat/driver-1.2
Chat 1.2 - General Availability
2 parents dd38451 + 3e01223 commit 7e82ea0

48 files changed

Lines changed: 782 additions & 57 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/app/context.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,30 @@ def preprocess(request):
9191
callback = request.GET.get('cb')
9292
handle_marketing_callback(callback, request)
9393

94+
chat_unread_messages = False
95+
96+
if profile and profile.chat_id:
97+
try:
98+
from chat.tasks import get_driver
99+
chat_driver = get_driver()
100+
101+
chat_unreads_request = chat_driver.teams.get_team_unreads_for_user(
102+
profile.chat_id
103+
)
104+
105+
if 'message' not in chat_unreads_request:
106+
for teams in chat_unreads_request:
107+
if teams['msg_count'] > 0 or teams['mention_count'] > 0:
108+
chat_unread_messages = True
109+
break
110+
except Exception as e:
111+
logger.error(str(e))
112+
94113
context = {
95114
'STATIC_URL': settings.STATIC_URL,
96115
'MEDIA_URL': settings.MEDIA_URL,
97116
'num_slack': num_slack,
117+
'chat_unread_messages' : chat_unread_messages,
98118
'github_handle': request.user.username if user_is_authenticated else False,
99119
'email': request.user.email if user_is_authenticated else False,
100120
'name': request.user.get_full_name() if user_is_authenticated else False,

app/app/settings.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
'health_check.contrib.s3boto3_storage',
9292
'app',
9393
'avatar',
94+
'chat',
9495
'retail',
9596
'rest_framework',
9697
'marketing',
@@ -468,6 +469,8 @@
468469
CELERY_TASK_SERIALIZER = 'json'
469470
# http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-result_serializer
470471
CELERY_RESULT_SERIALIZER = 'json'
472+
# http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-result_backend
473+
CELERY_RESULT_BACKEND = env('CELERY_RESULT_BACKEND', default=CACHEOPS_REDIS)
471474

472475
DJANGO_REDIS_IGNORE_EXCEPTIONS = env.bool('REDIS_IGNORE_EXCEPTIONS', default=True)
473476
DJANGO_REDIS_LOG_IGNORED_EXCEPTIONS = env.bool('REDIS_LOG_IGNORED_EXCEPTIONS', default=True)
@@ -542,8 +545,11 @@
542545
GITHUB_APP_NAME = env('GITHUB_APP_NAME', default='gitcoin-local')
543546

544547
# Chat
545-
CHAT_URL = env('CHAT_DRIVER_USER', default='') # location of where mattermost is hosted
546-
548+
CHAT_PORT = env('CHAT_PORT', default=8065) # port of where mattermost is hosted
549+
CHAT_URL = env('CHAT_URL', default='http://localhost') # location of where mattermost is hosted
550+
CHAT_DRIVER_TOKEN = env('CHAT_DRIVER_TOKEN', default='') # driver token
551+
GITCOIN_HACK_CHAT_TEAM_ID = env('GITCOIN_HACK_CHAT_TEAM_ID', default='')
552+
GITCOIN_CHAT_TEAM_ID = env('GITCOIN_CHAT_TEAM_ID', default='')
547553
# Social Auth
548554
LOGIN_URL = 'gh_login'
549555
LOGOUT_URL = 'logout'

app/app/urls.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,9 @@
143143
url(r'^api/v0.1/choose_persona/', dashboard.views.choose_persona, name='choose_persona'),
144144

145145
# chat
146-
url(r'^chat/', chat.views.embed, name='chat'),
147-
url(r'^chat', chat.views.embed, name='chat2'),
146+
url(r'^chat/web', chat.views.embed, name='web_chat'),
147+
url(r'^chat/web/', chat.views.embed, name='web_chat2'),
148+
re_path(r'^chat/?', chat.views.chat, name='chat'),
148149
# Health check endpoint
149150
re_path(r'^health/', include('health_check.urls')),
150151
re_path(r'^lbcheck/?', healthcheck.views.lbcheck, name='lbcheck'),

app/assets/v2/css/chat.css

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.banner {
2+
background-color: #0d023b;
3+
background-size: cover;
4+
background-position: 0px 0px;
5+
background-repeat: no-repeat;
6+
position: relative;
7+
color: #fff;
8+
padding-top: 5rem;
9+
padding-bottom: 5rem;
10+
}
11+
12+
.sub-headline {
13+
line-height: 48px;
14+
}
15+
16+
.online {
17+
color: #25e899;
18+
}
19+
20+
.dot {
21+
background-color: #25e899;
22+
display: none;
23+
width: 9px;
24+
height: 9px;
25+
border-radius: 50%;
26+
position: absolute;
27+
top: 0.5em;
28+
right: 0.9em;
29+
}
30+
31+
.open-app {
32+
background-color: #0D001A;
33+
}
34+
35+
img.feature {
36+
border-radius: 80px;
37+
}
38+
39+
@media (max-width: 1024px) {
40+
.chat-img {
41+
display: none;
42+
}
43+
}
246 Bytes
Loading
224 Bytes
Loading

app/assets/v2/images/chat/chat.png

86.5 KB
Loading
2.91 KB
Loading
66.2 KB
Loading
26.7 KB
Loading

0 commit comments

Comments
 (0)