Added sender to messages sent IO-590
This commit is contained in:
@@ -21936,6 +21936,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</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>
|
||||
<name>typeamessage</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -8,6 +8,8 @@ import {
|
||||
List,
|
||||
} from "react-virtualized";
|
||||
import "./chat-message-list.styles.scss";
|
||||
import i18n from "i18next";
|
||||
import moment from "moment";
|
||||
|
||||
export default function ChatMessageListComponent({ messages }) {
|
||||
const virtualizedListRef = useRef(null);
|
||||
@@ -79,7 +81,19 @@ const MessageRender = (message) => {
|
||||
</a>
|
||||
);
|
||||
} 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
|
||||
image
|
||||
image_path
|
||||
userid
|
||||
created_at
|
||||
}
|
||||
messages_aggregate(
|
||||
where: { read: { _eq: false }, isoutbound: { _eq: false } }
|
||||
|
||||
@@ -1315,6 +1315,7 @@
|
||||
"nojobs": "Not associated to any job.",
|
||||
"phonenumber": "Phone #",
|
||||
"presets": "Presets",
|
||||
"sentby": "Sent by {{by}} at {{time}}",
|
||||
"typeamessage": "Send a message..."
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1315,6 +1315,7 @@
|
||||
"nojobs": "",
|
||||
"phonenumber": "",
|
||||
"presets": "",
|
||||
"sentby": "",
|
||||
"typeamessage": "Enviar un mensaje..."
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1315,6 +1315,7 @@
|
||||
"nojobs": "",
|
||||
"phonenumber": "",
|
||||
"presets": "",
|
||||
"sentby": "",
|
||||
"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:
|
||||
_eq: true
|
||||
columns:
|
||||
- id
|
||||
- created_at
|
||||
- updated_at
|
||||
- msid
|
||||
- conversationid
|
||||
- text
|
||||
- created_at
|
||||
- id
|
||||
- image
|
||||
- image_path
|
||||
- isoutbound
|
||||
- status
|
||||
- msid
|
||||
- read
|
||||
- status
|
||||
- text
|
||||
- updated_at
|
||||
- userid
|
||||
select_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
columns:
|
||||
- conversationid
|
||||
- created_at
|
||||
- id
|
||||
- image
|
||||
- isoutbound
|
||||
- read
|
||||
- image_path
|
||||
- isoutbound
|
||||
- msid
|
||||
- read
|
||||
- status
|
||||
- text
|
||||
- created_at
|
||||
- updated_at
|
||||
- conversationid
|
||||
- id
|
||||
- userid
|
||||
filter:
|
||||
conversation:
|
||||
bodyshop:
|
||||
|
||||
@@ -32,6 +32,7 @@ exports.send = (req, res) => {
|
||||
text: body,
|
||||
conversationid,
|
||||
isoutbound: true,
|
||||
userid: req.user.email,
|
||||
};
|
||||
gqlClient
|
||||
.request(queries.INSERT_MESSAGE, { msg: newMessage })
|
||||
|
||||
Reference in New Issue
Block a user