Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎙️ Thread chat #1113

Merged
merged 65 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
1eeada6
🧑🏻‍🦰 Fixing issues (#820)
SolMon9099 Nov 18, 2023
481527a
🧔🏼 Fixing pashto (#830)
SolMon9099 Nov 21, 2023
89f93e7
💞 Translations for main (#835)
git-translate[bot] Nov 25, 2023
5ef968d
👨‍👨‍👦 Fixing issues (#838)
SolMon9099 Dec 6, 2023
79231b4
🧑🏼‍✈️ Fixing issues (#842)
SolMon9099 Dec 7, 2023
1cd1a5e
👩🏿‍🎨 Fixing issues (#844)
SolMon9099 Dec 7, 2023
fa52d41
🦿 Fixing issues (#846)
SolMon9099 Dec 9, 2023
43a1f17
🔍 Fixing issues (#860)
SolMon9099 Dec 19, 2023
3ad6bc6
👱🏻‍♀️ Fixing issues (#871)
SolMon9099 Dec 20, 2023
9bdecbe
🧒🏻 Docker, pytest and cypress setups (#876)
HamzaAnis Jan 4, 2024
4e39f17
👷🏻‍♂️ Training record (#885)
SolMon9099 Jan 19, 2024
67e1d5b
🤵🏾‍♂️ Fixing issue 2 (#895)
SolMon9099 Jan 24, 2024
a4c71a6
🦙 Fixing issue 2 (#897)
SolMon9099 Jan 24, 2024
2acf037
🐛 Fix partner form bug (#903)
SolMon9099 Jan 30, 2024
76b501e
💍 Fixing issue 2 (#917)
SolMon9099 Feb 4, 2024
d96693d
🌖 Fixing issue 2 (#922)
SolMon9099 Feb 5, 2024
6d8c901
👩🏽‍🔧 Fixing issue 2 (#924)
SolMon9099 Feb 5, 2024
4be2749
👱🏼‍♀️ Fixing issue 2 (#928)
SolMon9099 Feb 8, 2024
202dc5a
😞 Fixing issue 2 (#955)
SolMon9099 Feb 20, 2024
141c0e0
🤽🏽‍♂️ Hub (#968)
SolMon9099 Feb 28, 2024
143234c
🙋🏾 Resolved the Conflicts (#973)
Humayun0008 Mar 2, 2024
296e565
🤎 Hub (#994)
SolMon9099 Mar 8, 2024
cae95b2
🎡 Hub (#1000)
SolMon9099 Mar 8, 2024
dc40994
👫🏿 Hub2 (#1012)
SolMon9099 Mar 14, 2024
937f817
🛌🏻 Hub3 (#1019)
SolMon9099 Mar 22, 2024
a8ec7b5
☝🏾 Hub group chat (#1027)
SolMon9099 May 1, 2024
9cacf5c
🧚 Add meeting link generation feature (#1030)
binary-exe May 6, 2024
804bdc5
🧜‍♂️ Adding iframe meeting feature using 8x8 Jaas (#1036)
binary-exe May 29, 2024
1de5f9e
🧑🏽‍🎤 Freddy branch (#1041)
WebMon9099 May 30, 2024
f9cdfd9
👩🏻‍🦼 Freddy branch (#1047)
WebMon9099 May 31, 2024
aa56b36
🐠 Get AppID if it is not set when copying from clipboard (#1049)
binary-exe May 31, 2024
89bb068
👮🏽‍♀️ Removed commas (#1052)
binary-exe Jun 4, 2024
211ef68
🧘🏿‍♀️ Freddy branch (#1061)
WebMon9099 Jun 6, 2024
422acce
😨 Freddy branch (#1063)
WebMon9099 Jun 10, 2024
941259f
🧖🏼‍♀️ Freddy branch (#1066)
WebMon9099 Jun 12, 2024
06af49e
🛒 Freddy branch (#1071)
WebMon9099 Jun 14, 2024
8d7ecf8
🧖🏾 Freddy branch (#1074)
WebMon9099 Jun 21, 2024
f8307eb
👩‍🎓 from new branch (#1082)
WebMon9099 Jun 25, 2024
e1c232c
💖 modified age range for mentee application main (#1085)
robert-dm Aug 17, 2024
9757a1e
test merge heroku update (#1087)
robert-dm Aug 17, 2024
dbd132d
🙋🏻‍♀️ Freddy branch (#1089)
WebMon9099 Aug 29, 2024
ba89ed1
👨🏼‍⚕️ New dropdown value mentee2 (#1091)
robert-dm Sep 2, 2024
f245ea5
🥾 Fix meeting (#1094)
WebMon9099 Sep 24, 2024
346ced2
👮🏿 Fix meeting (#1097)
WebMon9099 Sep 25, 2024
0946c02
🧑🏾‍⚖️ add organization to Mentor (#1099)
WebMon9099 Oct 14, 2024
00fbbe1
Replace logos, test stage for thread function
WebMon9099 Oct 27, 2024
5be860e
fix format
WebMon9099 Oct 27, 2024
dad3069
Finish thread function
WebMon9099 Oct 28, 2024
7e04b39
Merge branch 'dev' of https://github.com/hack4impact-uiuc/mentee into…
WebMon9099 Oct 28, 2024
6036e96
Change the logo
WebMon9099 Oct 28, 2024
e740741
Merge branch 'dev' into Thread-Chat
WebMon9099 Oct 28, 2024
de881be
🦷 Thread chat (#1103)
WebMon9099 Oct 28, 2024
c53bbee
Fix logo size
WebMon9099 Oct 28, 2024
8cb3e8a
Merge branch 'Thread-Chat' of https://github.com/hack4impact-uiuc/men…
WebMon9099 Oct 28, 2024
6ff2fee
change the logo size
WebMon9099 Oct 28, 2024
75f9aa3
👩🏾‍💻 Thread chat (#1105)
WebMon9099 Oct 28, 2024
b98f08b
Change the main logo size
WebMon9099 Oct 29, 2024
176f5f1
Change the main logo size
WebMon9099 Oct 29, 2024
4090f3e
Merge branch 'main' into Thread-Chat
WebMon9099 Oct 29, 2024
1e1a4a3
🤷🏾‍♂️ Thread chat (#1107)
robert-dm Oct 29, 2024
8645643
change the position of logo
WebMon9099 Oct 29, 2024
a37b0f5
Merge branch 'main' into Thread-Chat
WebMon9099 Oct 29, 2024
7e022fa
Merge branch 'dev' into Thread-Chat
WebMon9099 Oct 29, 2024
b284148
Add timezone
WebMon9099 Nov 10, 2024
7a46243
Merge branch 'dev' into Thread-Chat
WebMon9099 Nov 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/api/models/MenteeProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class MenteeProfile(Document, Mixin):
workstate = ListField(StringField(), required=False)
preferred_language = StringField(required=False, default="en-US")
roomName = StringField(required=False)
timezone = StringField(required=True)

def __repr__(self):
return f"""<MenteeProfile user_id:{self.firebase_uid} \n name: {self.name}
Expand Down
1 change: 1 addition & 0 deletions backend/api/models/MentorProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class MentorProfile(Document, Mixin):
preferred_language = StringField(required=False, default="en-US")
roomName = StringField(required=False)
organization = StringField(required=False)
timezone = StringField(required=True)

def __repr__(self):
return f"""<MentorProfile firebase_id: {self.firebase_uid}
Expand Down
1 change: 1 addition & 0 deletions backend/api/models/PartnerProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class PartnerProfile(Document, Mixin):
hub_user = DictField(required=False)
hub_user_name = StringField(required=False)
roomName = StringField(required=False)
timezone = StringField(required=True)

def __repr__(self):
return f"""<Partner email: {self.email}
Expand Down
3 changes: 3 additions & 0 deletions backend/api/utils/profile_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def edit_profile(data: dict = {}, profile: object = None):
"preferred_language", profile.preferred_language
)
profile.roomName = data.get("roomName", profile.roomName)
profile.timezone = data.get("timezone", profile.timezone)
return True

if isinstance(profile, MentorProfile):
Expand All @@ -194,6 +195,7 @@ def edit_profile(data: dict = {}, profile: object = None):
)
profile.linkedin = data.get("linkedin", profile.linkedin)
profile.website = data.get("website", profile.website)
profile.timezone = data.get("timezone", profile.timezone)

if ex_organization != profile.organization:
# for old data---------------------------------
Expand Down Expand Up @@ -267,6 +269,7 @@ def edit_profile(data: dict = {}, profile: object = None):
profile.is_private = data.get("is_private", profile.is_private)
profile.specializations = data.get("specializations", profile.specializations)
profile.workstate = data.get("workstate", profile.workstate)
profile.timezone = data.get("timezone", profile.timezone)
profile.immigrant_status = data.get(
"immigrant_status", profile.immigrant_status
)
Expand Down
103 changes: 99 additions & 4 deletions backend/api/views/appointment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime, timezone, timedelta
from flask import Blueprint, request
from api.models import AppointmentRequest, Availability, MentorProfile, MenteeProfile
from api.core import create_response, logger
Expand All @@ -18,6 +18,7 @@
TRANSLATIONS,
)
from api.utils.require_auth import admin_only, all_users, mentor_only
import re

appointment = Blueprint("appointment", __name__)

Expand Down Expand Up @@ -112,6 +113,24 @@ def send_invite_email():
end_time = end_date_object.strftime("%I:%M%p %Z")
avail_htmls.append(start_time + " ~ " + end_time)

if mentee.timezone:
print("timezone", mentee.timezone)
match = re.match(r"UTC([+-]\d{2}):(\d{2})", mentee.timezone)
print("match", match)
if match:
hours_offset = int(match.group(1))
minutes_offset = int(match.group(2))
# Create a timezone with the parsed offset
offset = timezone(timedelta(hours=hours_offset, minutes=minutes_offset))
# Convert the datetime to the target timezone
avail_htmls.append(
start_date_object.astimezone(offset).strftime("%m-%d-%Y %I:%M%p %Z")
+ " ~ "
+ start_date_object.astimezone(offset).strftime(
"%m-%d-%Y %I:%M%p %Z"
)
)

if len(avail_htmls) > 0 and mentee.email_notifications:
res, res_msg = (
send_email(
Expand Down Expand Up @@ -176,6 +195,24 @@ def create_appointment():

date_object = datetime.strptime(time_data.get("start_time"), "%Y-%m-%dT%H:%M:%S%z")
start_time = date_object.strftime(APPT_TIME_FORMAT + " %Z")
if mentee.timezone:
print("timezone", mentee.timezone)
match = re.match(r"UTC([+-]\d{2}):(\d{2})", mentee.timezone)
print("match", match)
if match:
hours_offset = int(match.group(1))
minutes_offset = int(match.group(2))
# Create a timezone with the parsed offset
offset = timezone(timedelta(hours=hours_offset, minutes=minutes_offset))
# Convert the datetime to the target timezone
converted_date = date_object.astimezone(offset)
start_time_local_timezone = converted_date.strftime(
APPT_TIME_FORMAT + " %Z"
)
else:
start_time_local_timezone = start_time
else:
start_time_local_timezone = start_time

if mentee.email_notifications:
res, res_msg = send_email(
Expand All @@ -184,7 +221,7 @@ def create_appointment():
data={
"confirmation": True,
"name": mentor.name,
"date": start_time,
"date": start_time_local_timezone,
mentee.preferred_language: True,
"subject": TRANSLATIONS[mentee.preferred_language]["mentee_appt"],
},
Expand All @@ -194,12 +231,31 @@ def create_appointment():
logger.info(msg)

if mentor.email_notifications:
if mentor.timezone:
print("timezone", mentor.timezone)
match = re.match(r"UTC([+-]\d{2}):(\d{2})", mentor.timezone)
print("match", match)
if match:
hours_offset = int(match.group(1))
minutes_offset = int(match.group(2))
# Create a timezone with the parsed offset
offset = timezone(timedelta(hours=hours_offset, minutes=minutes_offset))
# Convert the datetime to the target timezone
converted_date = date_object.astimezone(offset)
start_time_local_timezone = converted_date.strftime(
APPT_TIME_FORMAT + " %Z"
)
else:
start_time_local_timezone = start_time
else:
start_time_local_timezone = start_time

res, res_msg = send_email(
recipient=mentor.email,
template_id=MENTOR_APPT_TEMPLATE,
data={
"name": mentee.name,
"date": start_time,
"date": start_time_local_timezone,
mentor.preferred_language: True,
"subject": TRANSLATIONS[mentee.preferred_language]["mentor_appt"],
},
Expand Down Expand Up @@ -247,11 +303,30 @@ def put_appointment(id):

if mentee.email_notifications:
start_time = appointment.timeslot.start_time.strftime(APPT_TIME_FORMAT + " GMT")
if mentee.timezone:
print("timezone", mentee.timezone)
match = re.match(r"UTC([+-]\d{2}):(\d{2})", mentee.timezone)
print("match", match)
if match:
hours_offset = int(match.group(1))
minutes_offset = int(match.group(2))
# Create a timezone with the parsed offset
offset = timezone(timedelta(hours=hours_offset, minutes=minutes_offset))
# Convert the datetime to the target timezone
converted_date = appointment.timeslot.start_time.astimezone(offset)
start_time_local_timezone = converted_date.strftime(
APPT_TIME_FORMAT + " %Z"
)
else:
start_time_local_timezone = start_time
else:
start_time_local_timezone = start_time

res_email = send_email(
recipient=mentee.email,
data={
"name": mentor.name,
"date": start_time,
"date": start_time_local_timezone,
"approved": True,
mentee.preferred_language: True,
"subject": TRANSLATIONS[mentee.preferred_language]["mentee_appt"],
Expand Down Expand Up @@ -282,6 +357,26 @@ def delete_request(appointment_id):

if mentee.email_notifications:
start_time = request.timeslot.start_time.strftime(f"{APPT_TIME_FORMAT} GMT")

if mentee.timezone:
print("timezone", mentee.timezone)
match = re.match(r"UTC([+-]\d{2}):(\d{2})", mentee.timezone)
print("match", match)
if match:
hours_offset = int(match.group(1))
minutes_offset = int(match.group(2))
# Create a timezone with the parsed offset
offset = timezone(timedelta(hours=hours_offset, minutes=minutes_offset))
# Convert the datetime to the target timezone
converted_date = request.timeslot.start_time.astimezone(offset)
start_time_local_timezone = converted_date.strftime(
APPT_TIME_FORMAT + " %Z"
)
else:
start_time_local_timezone = start_time
else:
start_time_local_timezone = start_time

res_email = send_email(
recipient=mentee.email,
data={
Expand Down
66 changes: 57 additions & 9 deletions backend/api/views/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
MenteeProfile,
PartnerProfile,
)
from datetime import datetime
from datetime import datetime, timezone, timedelta
import re
from api.utils.translate import (
get_all_translations,
)
from datetime import datetime
from api.utils.constants import (
Account,
EVENT_TEMPLATE,
Expand Down Expand Up @@ -77,8 +77,26 @@ def delete_train(id):


######################################################################
def send_mail_for_event(recipients, role_name, title, eventdate, target_url):
def send_mail_for_event(
recipients, role_name, title, eventdate, target_url, start_datetime, end_datetime
):
for recipient in recipients:
if recipient.timezone:
print("timezone", recipient.timezone)
match = re.match(r"UTC([+-]\d{2}):(\d{2})", recipient.timezone)
print("match", match)
if match:
hours_offset = int(match.group(1))
minutes_offset = int(match.group(2))
# Create a timezone with the parsed offset
offset = timezone(timedelta(hours=hours_offset, minutes=minutes_offset))
# Convert the datetime to the target timezone
eventdate.append(
start_datetime.astimezone(offset).strftime("%m-%d-%Y %I:%M%p %Z")
+ " ~ "
+ end_datetime.astimezone(offset).strftime("%m-%d-%Y %I:%M%p %Z")
)

res, res_msg = send_email(
recipient=recipient.email,
data={
Expand Down Expand Up @@ -151,18 +169,48 @@ def new_event():
if start_datetime_str != "":
eventdate = start_datetime_str + " ~ " + end_datetime_str
if Account.MENTOR in roles:
recipients = MentorProfile.objects.only("email", "preferred_language")
recipients = MentorProfile.objects.only(
"email", "preferred_language", "timezone"
)
role_name = "MENTOR"

send_mail_for_event(recipients, role_name, title, eventdate, target_url)
send_mail_for_event(
recipients,
role_name,
title,
eventdate,
target_url,
start_datetime,
end_datetime,
)
if Account.MENTEE in roles:
recipients = MenteeProfile.objects.only("email", "preferred_language")
recipients = MenteeProfile.objects.only(
"email", "preferred_language", "timezone"
)
role_name = "MENTEE"
send_mail_for_event(recipients, role_name, title, eventdate, target_url)
send_mail_for_event(
recipients,
role_name,
title,
eventdate,
target_url,
start_datetime,
end_datetime,
)
if Account.PARTNER in roles:
recipients = PartnerProfile.objects.only("email", "preferred_language")
recipients = PartnerProfile.objects.only(
"email", "preferred_language", "timezone"
)
role_name = "Partner"
send_mail_for_event(recipients, role_name, title, eventdate, target_url)
send_mail_for_event(
recipients,
role_name,
title,
eventdate,
target_url,
start_datetime,
end_datetime,
)
if hub_id is not None:
role_name = "Hub"
partners = PartnerProfile.objects.filter(hub_id=hub_id).only(
Expand Down
5 changes: 4 additions & 1 deletion frontend/public/locales/ar/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@
"requiredCheckbox":"يرجى التحقق من هذا الحقل",
"requiredPartner": "الرجاء اختيار شريك",
"stopImpersonating":"التوقف عن انتحال الشخصية",
"impersonate":"انتحال شخصية"
"impersonate":"انتحال شخصية",
"timezone":"المنطقة الزمنية",
"requiredTimezone":"الرجاء إدخال المنطقة الزمنية",
"requiredAvatar":"الرجاء تحميل صورة الملف الشخصي"
},
"commonApplication": {
"no-affiliation":"عدم الانتماء",
Expand Down
5 changes: 4 additions & 1 deletion frontend/public/locales/en-US/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@
"requiredCheckbox":"Please check this field",
"requiredPartner": "Please select a Partner",
"stopImpersonating":"Stop Impersonating",
"impersonate":"Impersonate"
"impersonate":"Impersonate",
"timezone":"Time Zone",
"requiredTimezone":"Please enter time zone",
"requiredAvatar":"Please upload profile image"
},
"commonApplication": {
"no-affiliation":"no-affiliation",
Expand Down
5 changes: 4 additions & 1 deletion frontend/public/locales/es-US/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@
"requiredCheckbox":"Por favor revisa este campo",
"requiredPartner": "Por favor seleccione un socio",
"stopImpersonating":"Deja de hacerte pasar por",
"impersonate":"Personificar"
"impersonate":"Personificar",
"timezone":"Huso horario",
"requiredTimezone":"Por favor, introduzca la zona horaria",
"requiredAvatar":"Por favor sube una imagen de perfil"
},
"commonApplication": {
"no-affiliation":"sin afiliación",
Expand Down
5 changes: 4 additions & 1 deletion frontend/public/locales/fa-AF/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@
"requiredCheckbox":"لطفا این فیلد را بررسی کنید",
"requiredPartner": "لطفا یک شریک انتخاب کنید",
"stopImpersonating":"جعل هویت را متوقف کنید",
"impersonate":"جعل هویت"
"impersonate":"جعل هویت",
"timezone":"منطقه زمانی",
"requiredTimezone":"لطفا منطقه زمانی را وارد کنید",
"requiredAvatar":"لطفا تصویر نمایه را آپلود کنید"
},
"commonApplication": {
"no-affiliation":"عدم وابستگی",
Expand Down
5 changes: 4 additions & 1 deletion frontend/public/locales/pa-AR/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@
"requiredCheckbox":"مهرباني وکړئ دا ساحه وګورئ",
"requiredPartner": "مهرباني وکړئ یو شریک وټاکئ",
"stopImpersonating":"تقلید بند کړئ",
"impersonate":"تقلید"
"impersonate":"تقلید",
"timezone":"د وخت زون",
"requiredTimezone":"مهرباني وکړئ د وخت زون دننه کړئ",
"requiredAvatar":"مهرباني وکړئ د پروفایل عکس اپلوډ کړئ"
},
"commonApplication": {
"no-affiliation":"بې تړاو",
Expand Down
5 changes: 4 additions & 1 deletion frontend/public/locales/pt-BR/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@
"requiredCheckbox":"Por favor verifique este campo",
"requiredPartner": "Selecione um parceiro",
"stopImpersonating":"Pare de se passar por",
"impersonate":"Personificar"
"impersonate":"Personificar",
"timezone":"Fuso horário",
"requiredTimezone":"Por favor, insira o fuso horário",
"requiredAvatar":"Por favor, carregue a imagem do perfil"
},
"commonApplication": {
"no-affiliation":"sem afiliação",
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/NavigationHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
} from "@ant-design/icons";
import { fetchUser } from "features/userSlice";
import { uploadAccountImage } from "utils/api";
import Profile from "./pages/Profile";

const { Header } = Layout;

Expand Down Expand Up @@ -155,6 +156,9 @@ function NavigationHeader() {
style={{ background: colorBgContainer, display: "flex" }}
theme="light"
>
{!user.timezone && (
<div style={{ color: "red" }}>Please set time zone in profile page</div>
)}
{isMobile && <MenuFoldOutlined onClick={() => dispatch(collapse())} />}
<div style={{ flex: "1 1 0%" }} />
{supportUserID && user && (
Expand Down
Loading
Loading