Skip to content

Commit

Permalink
Merge pull request #68 from Indicio-tech/fix/first-message
Browse files Browse the repository at this point in the history
fix: Save first message received to contact message list
  • Loading branch information
TelegramSam authored Jan 8, 2024
2 parents 73a0453 + b7b5303 commit e867a5f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/pages/profile/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ div.console-container {
div.compose-container {
flex-grow: 1;
}
#left {
min-width: 0;
}
19 changes: 17 additions & 2 deletions src/pages/profile/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,23 @@ export default class MessageCard implements m.ClassComponent<MessageCardAttrs> {
[
m(
"span",
{ style: { flexGrow: 1 } },
`${header} - ${message.timestamp.toLocaleTimeString()}`
{ style: { display: 'flex', minWidth: 0, flex: 'auto' } },
m(
"div",
{
style: {
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
wordBreak: 'break-word',
},
},
header
),
m("div",
{ style: {whiteSpace: 'nowrap', padding: '0 0.3rem'}},
` - ${message.timestamp.toLocaleTimeString()}`
),
),
m("span.icon", m(`i.fas.fa-${icon}`)),
]
Expand Down
9 changes: 9 additions & 0 deletions src/pages/profile/messaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ class ContactListComponent
if (!ContactService.getContact(message.message.from)) {
let newContact = { did: message.message.from }
ContactService.addContact(newContact as Contact)
let msgToSave = {
raw: message.message,
type: message.message.type,
sender: newContact.did,
receiver: message.receiver?.label || message.receiver.did,
timestamp: new Date(),
content: message.message.body?.content
};
ContactService.addMessage(newContact.did, msgToSave)
if (
message.message.type != "https://didcomm.org/user-profile/1.0/profile"
) {
Expand Down

0 comments on commit e867a5f

Please sign in to comment.