Skip to content

Commit

Permalink
Correção de tela branca ao receber mensagens
Browse files Browse the repository at this point in the history
  • Loading branch information
rtenorioh authored Mar 23, 2022
1 parent e61c44e commit a725dfe
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
10 changes: 9 additions & 1 deletion backend/src/services/MessageServices/CreateMessageService.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getIO } from "../../libs/socket";
import Message from "../../models/Message";
import Ticket from "../../models/Ticket";
import Whatsapp from "../../models/Whatsapp";

interface MessageData {
id: string;
Expand All @@ -27,7 +28,14 @@ const CreateMessageService = async ({
{
model: Ticket,
as: "ticket",
include: ["contact", "queue"]
include: [
"contact", "queue",
{
model: Whatsapp,
as: "whatsapp",
attributes: ["name"]
}
]
},
{
model: Message,
Expand Down
6 changes: 6 additions & 0 deletions backend/src/services/TicketServices/ShowTicketService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import AppError from "../../errors/AppError";
import Contact from "../../models/Contact";
import User from "../../models/User";
import Queue from "../../models/Queue";
import Whatsapp from "../../models/Whatsapp";

const ShowTicketService = async (id: string | number): Promise<Ticket> => {
const ticket = await Ticket.findByPk(id, {
Expand All @@ -22,6 +23,11 @@ const ShowTicketService = async (id: string | number): Promise<Ticket> => {
model: Queue,
as: "queue",
attributes: ["id", "name", "color"]
},
{
model: Whatsapp,
as: "whatsapp",
attributes: ["name"]
}
]
});
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/components/TicketListItem/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,17 @@ const useStyles = makeStyles(theme => ({

userTag: {
position: "absolute",
marginRight: 5,
right: 5,
bottom: 5,
marginRight: 35,
right: 10,
bottom: 9,
background:"#2576D2",
color: "#ffffff",
border:"1px solid #CCC",
padding: 1,
paddingLeft: 5,
paddingRight: 5,
borderRadius: 10,
fontSize: "1em"
fontSize: "0.9em"
},
}));

Expand Down Expand Up @@ -211,7 +211,7 @@ const TicketListItem = ({ ticket }) => {
)}
</Typography>
)}
{ticket.whatsappId && (
{ticket?.whatsappId && (
<div className={classes.userTag} title={i18n.t("ticketsList.connectionTitle")}>{ticket.whatsapp.name}</div>
)}
</span>
Expand Down

0 comments on commit a725dfe

Please sign in to comment.