Commit Graph

36 Commits

Author SHA1 Message Date
Andrea Maria Piana b331b61807 Add ClearHistory & DeactivateChat methods 2021-01-11 13:36:05 +01:00
Andrea Maria Piana 6f088bb5c5 Fix communities migration
In some instances the communities migration would be skipped but not
marked as `dirty`.

This commit addresses the issue by:
- Making sure that if dirty is set the migration is not skipped but
replayed
- If the version is on the communities migration and dirty is false, we
check for the presence of the communities table. If not present we
replay the communities migration.
- Make community_id field in user_messages nullable

It also removes all the `down` migration, as we can't use them
effectively, as explained in the README.md added.
2021-01-08 08:43:16 +01:00
Andrea Maria Piana 5d929c3584 Handle organisation membership requests 2020-12-23 17:20:55 +01:00
Andrea Maria Piana f3f6cdcd93 Mark message as seen when hiding
When hiding a message, we want to mark it as seen in order to preserve
the right count
2020-12-15 15:47:02 +01:00
flexsurfer e8dbc66227
timeline reactions (#2079) 2020-11-16 12:54:39 +01:00
Andrea Maria Piana 8966d81199 linting 2020-11-06 06:35:35 +01:00
andrey 6f207def2b timeline 2020-11-06 06:35:35 +01:00
Volodymyr Kozieiev 3e446eed8c
Link previews support (#2059) 2020-10-27 19:35:28 +02:00
Andrea Maria Piana b11399ffc6 Use ErrRecordNotFound instead of sql.ErrNoRows
We were checking for the wrong error kind when pulling messages from the
database, which resulted in the code not retrying to pull the message,
giving flaky tests / race condition (that's present in production as
well)
2020-10-08 13:23:00 +02:00
Andrea Maria Piana 61b345ff33 Add index on seen & hide long messages
This commit does two things:
1) Add an index on seen & update only the not-seen messages in the query
2) Hide long messages in the database, as that's likely spam
2020-09-10 10:26:59 +02:00
Andrea Maria Piana 00c5b60d7f
Move message to common namespace 2020-09-09 21:22:12 +02:00
Andrea Maria Piana 7d5d413222
Add parsing and storing of mentions 2020-09-09 21:22:07 +02:00
Roman Volosovskyi 57728224d4
[mentions] ParsedText in quoted message
ParsedText is needed to properly display mention in quoted message.
2020-09-09 16:07:31 +03:00
andrey 3b748a2e46 group chat invitation 2020-09-07 12:15:58 +02:00
Samuel Hawksby-Robinson 19487da894
Fixes a minor rebase quirk (#2016)
See commit fc7b311838
2020-08-13 18:57:17 +01:00
Andrea Maria Piana ab01a05cd6 Don't use bytes anymore for LastMessage
LastMessage in chat was encoded in bytes so that we don't have to
encoded/decode everytime we save to db or pass the client.

An issue with emoji surfaced a problem with this approach.
Chat.LastClockValue represent the last clock value of any type of
message exchanged in a chat (emoji,group membership updates, contact
updates).
So when receving a new message, we should update LastMessage if the
clock of the LastMessage is lower than the received message, and we
should not only check LastClockValue, otherwise the message might be
discarded although it is the most recent.

This commit fixes the issue by keeping LastMessage as an object and
comparing LastMessage.Clock instead of LastClockValue
2020-07-31 13:40:11 +02:00
Andrea Maria Piana 2cc3a9bab1
increase count & add comment 2020-07-30 20:21:10 +02:00
Andrea Maria Piana a1a6e1c6c0
linting 2020-07-30 20:21:00 +02:00
Andrea Maria Piana 29f25c5486
Use local chat-id for matching messages 2020-07-30 20:20:59 +02:00
Andrea Maria Piana d067b56fc2
Fix cursored query for emoji 2020-07-30 20:20:58 +02:00
Andrea Maria Piana 37a2073008
add endpoint for getting emojis 2020-07-30 20:20:40 +02:00
Andrea Maria Piana 5a178939de
Use same message with flag for emoji retraction and use compound id 2020-07-30 20:20:37 +02:00
Samuel Hawksby-Robinson 3e857203ac
Created ChatEntity encoding per chat type 2020-07-30 20:20:29 +02:00
Samuel Hawksby-Robinson 0a26d5a37d
Added emoji reaction retraction persistence 2020-07-30 20:20:20 +02:00
Samuel Hawksby-Robinson 106ccfcf0f
Added main functionality for SendEmojiReactionRetraction() 2020-07-30 20:20:19 +02:00
Samuel Hawksby-Robinson 8779b9a333
Added emoji_reaction get by id db func 2020-07-30 20:20:18 +02:00
Samuel Hawksby-Robinson fdc180039f
Added emoji_reaction persistence 2020-07-30 20:20:17 +02:00
Samuel Hawksby-Robinson fc7b311838
Added switch to persistence 2020-07-30 20:20:01 +02:00
Samuel Hawksby-Robinson 351cc4403d
Added emoji reaction to message persistence 2020-07-30 20:20:00 +02:00
Andrea Maria Piana eadf68325e Fix audio null value
If a message was inserted before the migration the field
audio_duration_ms would be set to NULL, and would not be serialized into
go correctly, as uint is non-nullable.
this commit fixes the issue by calling COALESCE on the value.
2020-07-30 15:00:39 +02:00
Andrea Maria Piana 8716a8ce45
add audio duration 2020-07-27 17:15:10 +02:00
Andrea Maria Piana e58ba1e9c8
Add audio messages
Why make this change?

We are adding support of audio recorded files, similarly to how we did
with images

What has changed?

- Added protobuf definition, only AAC supported
- Added migrations to store files
- Fixed an issue with nil pointer when transaction would fail to be
created, causing the application to crash
2020-07-27 17:14:50 +02:00
Andrea Maria Piana 20f45a7c1c Create different index for filtering
The index for message was fairly inefficient as it was only using the
cursor, as it was referring to the old `chat_id` field.

This meant that newer messages would be fetched much faster then older
messages.

The index has been changed so that now it includes `local_chat_id`
(which is currently used for filtering), and not using `hide`.

The reason being is that `hide` is a low cardinality index, so there's
no performance benefit to have it in, also it's mostly ignored by the
query planner.

This commit also adds the missing migrations, we generated the file, but
the source was missing, probably I forgot to add them in a rebase. They
have been generated from the migration file, using `RestoreAsset`.
2020-06-08 10:02:31 +02:00
Andrea Maria Piana 0bffeab908 Address feedback from code review and add quoted image 2020-06-01 11:30:04 +02:00
Andrea Maria Piana f5ab58b87f Add support for images
This commit adds support for images in protobuf messages.

The client can specify a path which will be used to load the image
and set the corresponding fields.

This makes the assumption that the RCP server runs on the same machine
as the client and they have access to the same files. This holds
currently for both status-react and status-console-client, we could
revisit and adds an upload if that changes in the future.
2020-06-01 11:30:04 +02:00
Andrea Maria Piana ee0a83fdc4 Load identicon & alias in chat.
Why make the changes?

Mainly performance, those fields are almost always present in the
database but they are re-calculated on load by the client as it does not
have necessarily access to it.

What has changed?
- Remove `_legacy` persistence namespaces as it's a vestige of the
initial move frmo status-react to status-go
- Pulling chats is now a join with contacts to add contact & alias
2020-05-25 14:00:04 +02:00