Added sender to messages sent IO-590
This commit is contained in:
@@ -21936,6 +21936,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>sentby</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>typeamessage</name>
|
<name>typeamessage</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import {
|
|||||||
List,
|
List,
|
||||||
} from "react-virtualized";
|
} from "react-virtualized";
|
||||||
import "./chat-message-list.styles.scss";
|
import "./chat-message-list.styles.scss";
|
||||||
|
import i18n from "i18next";
|
||||||
|
import moment from "moment";
|
||||||
|
|
||||||
export default function ChatMessageListComponent({ messages }) {
|
export default function ChatMessageListComponent({ messages }) {
|
||||||
const virtualizedListRef = useRef(null);
|
const virtualizedListRef = useRef(null);
|
||||||
@@ -79,7 +81,19 @@ const MessageRender = (message) => {
|
|||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return <span>{message.text}</span>;
|
return (
|
||||||
|
<div>
|
||||||
|
<div>{message.text}</div>
|
||||||
|
{message.isoutbound && (
|
||||||
|
<div style={{ color: "slategray", fontSize: 10 }}>
|
||||||
|
{i18n.t("messaging.labels.sentby", {
|
||||||
|
by: message.userid,
|
||||||
|
time: moment(message.created_at).format("MM/DD/YYYY @ hh:mm a"),
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ export const CONVERSATION_SUBSCRIPTION_BY_PK = gql`
|
|||||||
isoutbound
|
isoutbound
|
||||||
image
|
image
|
||||||
image_path
|
image_path
|
||||||
|
userid
|
||||||
|
created_at
|
||||||
}
|
}
|
||||||
messages_aggregate(
|
messages_aggregate(
|
||||||
where: { read: { _eq: false }, isoutbound: { _eq: false } }
|
where: { read: { _eq: false }, isoutbound: { _eq: false } }
|
||||||
|
|||||||
@@ -1315,6 +1315,7 @@
|
|||||||
"nojobs": "Not associated to any job.",
|
"nojobs": "Not associated to any job.",
|
||||||
"phonenumber": "Phone #",
|
"phonenumber": "Phone #",
|
||||||
"presets": "Presets",
|
"presets": "Presets",
|
||||||
|
"sentby": "Sent by {{by}} at {{time}}",
|
||||||
"typeamessage": "Send a message..."
|
"typeamessage": "Send a message..."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1315,6 +1315,7 @@
|
|||||||
"nojobs": "",
|
"nojobs": "",
|
||||||
"phonenumber": "",
|
"phonenumber": "",
|
||||||
"presets": "",
|
"presets": "",
|
||||||
|
"sentby": "",
|
||||||
"typeamessage": "Enviar un mensaje..."
|
"typeamessage": "Enviar un mensaje..."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1315,6 +1315,7 @@
|
|||||||
"nojobs": "",
|
"nojobs": "",
|
||||||
"phonenumber": "",
|
"phonenumber": "",
|
||||||
"presets": "",
|
"presets": "",
|
||||||
|
"sentby": "",
|
||||||
"typeamessage": "Envoyer un message..."
|
"typeamessage": "Envoyer un message..."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."messages" DROP COLUMN "user";
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."messages" ADD COLUMN "user" uuid NULL;
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: alter table "public"."messages" rename column "userid" to "user";
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: alter table "public"."messages" rename column "user" to "userid";
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."messages" ALTER COLUMN "userid" TYPE uuid;
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: ALTER TABLE "public"."messages" ALTER COLUMN "userid" TYPE text;
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: alter table "public"."messages" drop constraint "messages_userid_fkey";
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
- args:
|
||||||
|
cascade: false
|
||||||
|
read_only: false
|
||||||
|
sql: |-
|
||||||
|
alter table "public"."messages"
|
||||||
|
add constraint "messages_userid_fkey"
|
||||||
|
foreign key ("userid")
|
||||||
|
references "public"."users"
|
||||||
|
("email") on update set null on delete set null;
|
||||||
|
type: run_sql
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: drop_insert_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
check:
|
||||||
|
conversation:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
columns:
|
||||||
|
- id
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- msid
|
||||||
|
- conversationid
|
||||||
|
- text
|
||||||
|
- image
|
||||||
|
- image_path
|
||||||
|
- isoutbound
|
||||||
|
- status
|
||||||
|
- read
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: create_insert_permission
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: drop_insert_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
check:
|
||||||
|
conversation:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
columns:
|
||||||
|
- conversationid
|
||||||
|
- created_at
|
||||||
|
- id
|
||||||
|
- image
|
||||||
|
- image_path
|
||||||
|
- isoutbound
|
||||||
|
- msid
|
||||||
|
- read
|
||||||
|
- status
|
||||||
|
- text
|
||||||
|
- updated_at
|
||||||
|
- userid
|
||||||
|
set: {}
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: create_insert_permission
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: drop_select_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
allow_aggregations: true
|
||||||
|
columns:
|
||||||
|
- image
|
||||||
|
- isoutbound
|
||||||
|
- read
|
||||||
|
- image_path
|
||||||
|
- msid
|
||||||
|
- status
|
||||||
|
- text
|
||||||
|
- created_at
|
||||||
|
- updated_at
|
||||||
|
- conversationid
|
||||||
|
- id
|
||||||
|
computed_fields: []
|
||||||
|
filter:
|
||||||
|
conversation:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: create_select_permission
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
- args:
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: drop_select_permission
|
||||||
|
- args:
|
||||||
|
permission:
|
||||||
|
allow_aggregations: true
|
||||||
|
columns:
|
||||||
|
- conversationid
|
||||||
|
- created_at
|
||||||
|
- id
|
||||||
|
- image
|
||||||
|
- image_path
|
||||||
|
- isoutbound
|
||||||
|
- msid
|
||||||
|
- read
|
||||||
|
- status
|
||||||
|
- text
|
||||||
|
- updated_at
|
||||||
|
- userid
|
||||||
|
computed_fields: []
|
||||||
|
filter:
|
||||||
|
conversation:
|
||||||
|
bodyshop:
|
||||||
|
associations:
|
||||||
|
_and:
|
||||||
|
- user:
|
||||||
|
authid:
|
||||||
|
_eq: X-Hasura-User-Id
|
||||||
|
- active:
|
||||||
|
_eq: true
|
||||||
|
role: user
|
||||||
|
table:
|
||||||
|
name: messages
|
||||||
|
schema: public
|
||||||
|
type: create_select_permission
|
||||||
@@ -3014,32 +3014,34 @@ tables:
|
|||||||
- active:
|
- active:
|
||||||
_eq: true
|
_eq: true
|
||||||
columns:
|
columns:
|
||||||
- id
|
|
||||||
- created_at
|
|
||||||
- updated_at
|
|
||||||
- msid
|
|
||||||
- conversationid
|
- conversationid
|
||||||
- text
|
- created_at
|
||||||
|
- id
|
||||||
- image
|
- image
|
||||||
- image_path
|
- image_path
|
||||||
- isoutbound
|
- isoutbound
|
||||||
- status
|
- msid
|
||||||
- read
|
- read
|
||||||
|
- status
|
||||||
|
- text
|
||||||
|
- updated_at
|
||||||
|
- userid
|
||||||
select_permissions:
|
select_permissions:
|
||||||
- role: user
|
- role: user
|
||||||
permission:
|
permission:
|
||||||
columns:
|
columns:
|
||||||
|
- conversationid
|
||||||
|
- created_at
|
||||||
|
- id
|
||||||
- image
|
- image
|
||||||
- isoutbound
|
|
||||||
- read
|
|
||||||
- image_path
|
- image_path
|
||||||
|
- isoutbound
|
||||||
- msid
|
- msid
|
||||||
|
- read
|
||||||
- status
|
- status
|
||||||
- text
|
- text
|
||||||
- created_at
|
|
||||||
- updated_at
|
- updated_at
|
||||||
- conversationid
|
- userid
|
||||||
- id
|
|
||||||
filter:
|
filter:
|
||||||
conversation:
|
conversation:
|
||||||
bodyshop:
|
bodyshop:
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ exports.send = (req, res) => {
|
|||||||
text: body,
|
text: body,
|
||||||
conversationid,
|
conversationid,
|
||||||
isoutbound: true,
|
isoutbound: true,
|
||||||
|
userid: req.user.email,
|
||||||
};
|
};
|
||||||
gqlClient
|
gqlClient
|
||||||
.request(queries.INSERT_MESSAGE, { msg: newMessage })
|
.request(queries.INSERT_MESSAGE, { msg: newMessage })
|
||||||
|
|||||||
Reference in New Issue
Block a user