Skip to content

Commit

Permalink
Allow messaging past requests
Browse files Browse the repository at this point in the history
  • Loading branch information
aapeliv committed Nov 27, 2024
1 parent 53874b1 commit 2b0a562
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/web/features/messages/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"mark_all_read_button_text": "Mark all as read",
"request_closed_message": "This host request is closed or in the past. To continue chatting, send the other person a normal message.",
"request_closed_message": "This host request is closed. To continue chatting, send the other person a normal message.",
"write_reference_button_text": "Write a Reference",
"close_request_dialog_title": "Are you done messaging?",
"close_request_dialog_host": "Please make sure you are done chatting before you decline their request.",
Expand All @@ -9,6 +9,7 @@
"confirm_request_button_text": "Confirm",
"host_pending_request_help_text": "<0>Things to consider</0> before responding.",
"surfer_declined_request_help_text": "<0>Read our guide</0> on how to write a request that will get accepted.",
"past_request_help_text": "This request is in the past, you can still send messages but cannot otherwise modify it.",
"messages_page": {
"title": "Messages",
"tabs": {
Expand Down
13 changes: 12 additions & 1 deletion app/web/features/messages/requests/HostRequestGuideLinks.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { styled, Typography } from "@mui/material";
import StyledLink from "components/StyledLink";
import { Trans } from "i18n";
import { Trans, useTranslation } from "i18n";
import { MESSAGES } from "i18n/namespaces";
import { HostRequestStatus } from "proto/conversations_pb";
import React from "react";
import { howToRespondRequestGuideUrl, howToWriteRequestGuideUrl } from "routes";
Expand All @@ -21,6 +22,8 @@ export default function HostRequestGuideLinks({
isHost: boolean;
status: HostRequestStatus;
}) {
const { t } = useTranslation([MESSAGES]);

const isHostPending =
!isPast &&
isHost &&
Expand Down Expand Up @@ -55,6 +58,14 @@ export default function HostRequestGuideLinks({
</Typography>
</StyledHelpTextContainer>
);
} else if (isPast) {
return (
<StyledHelpTextContainer>
<Typography variant="body1">
{t("messages:past_request_help_text")}
</Typography>
</StyledHelpTextContainer>
);
} else {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export default function HostRequestSendField({
const isPast = hostRequest.toDate < new Date().toISOString().split("T")[0];

const isRequestClosed =
isPast ||
hostRequest.status === HostRequestStatus.HOST_REQUEST_STATUS_CANCELLED ||
hostRequest.status === HostRequestStatus.HOST_REQUEST_STATUS_REJECTED;

Expand Down

0 comments on commit 2b0a562

Please sign in to comment.