Skip to content

Commit

Permalink
Fix #1, #4, #5 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
WebMon9099 committed Dec 24, 2024
1 parent 398ffa4 commit 2f64be0
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
6 changes: 3 additions & 3 deletions backend/api/views/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ def contact_mentor(mentor_id):
@all_users
def get_sidebar(user_id):
try:
sentMessages = DirectMessage.objects.filter(Q(recipient_id=user_id)).order_by(
"-created_at"
)
sentMessages = DirectMessage.objects.filter(
Q(recipient_id=user_id) | Q(sender_id=user_id)
).order_by("-created_at")

contacts = []
sidebarContacts = set()
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ function App() {
<PublicRoute path="/n50/build-profile">
<BuildProfile />
</PublicRoute>
<PublicRoute path="/announcement/:id">
<AnnouncementDetail />
</PublicRoute>
{Object.keys(allHubData).map((hub_url) => {
return (
<>
Expand Down Expand Up @@ -669,9 +672,6 @@ function App() {
<PrivateRoute path="/announcements">
<Announcements />
</PrivateRoute>
<PublicRoute path="/announcement/:id">
<AnnouncementDetail />
</PublicRoute>
<PrivateRoute path="/createmeetinglink">
<CreateMeetingLink />
</PrivateRoute>
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/components/PublicRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ function PublicRoute({ children, ...rest }) {
login_path = getLoginPath();
if (!login_path) login_path = "";
}
var announcement_detail_flag = false;
var path = rest.path;
if (path.indexOf("/announcement/") > -1) {
announcement_detail_flag = true;
}

return (
<Route
{...rest}
render={() =>
!role ? (
(!role || announcement_detail_flag) ? (
children
) : (
<Redirect
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/pages/HomeLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ function HomeLayout({ children, ignoreHomeLayout, allHubData, location }) {
if (
ignoreHomeLayout ||
ignoreLayoutPaths.includes(location.pathname) ||
checkFlagInviteLink
checkFlagInviteLink ||
location.pathname.includes('/announcement/')
) {
return children;
}
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/components/pages/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ function Messages(props) {

const addMyMessage = (msg) => {
setMessages((prevMessages) => [...prevMessages, msg]);
setTimeout(() => {
async function fetchLatest() {
const data = await getLatestMessages(profileId);
setLatestConvos(data);
}
fetchLatest();
}, 500);
};

// BUG: If we swap between breakpoints of mobile/desktop, the sidebar will not update
Expand Down

0 comments on commit 2f64be0

Please sign in to comment.