Commit Graph

735 Commits

Author SHA1 Message Date
Patryk Osmaczko f915fc6df4 feat: make any member able to edit group chat properties
closes: #2824
2022-09-13 12:16:14 +02:00
Patryk Osmaczko c01316524c feat: make any member able to add new users to group chat
closes: #2823, #2825
2022-09-13 12:16:14 +02:00
Patryk Osmaczko eee112738b chore: move group chat logic to separate file 2022-09-13 12:16:14 +02:00
Stefan 9db69df9a0 feat: updated migrations for merging favourites with saved addresses
Required by #6546
2022-09-12 13:46:04 +02:00
Samuel Hawksby-Robinson 15f4f8956f Resolved gosec issue calling http.Get() from package default client 2022-09-09 15:07:48 +01:00
Samuel Hawksby-Robinson 505ef579eb Refactor to urls to try to remove http client use in tests
shelfing it at the moment, if it becomes a problem in the future then may be we can address it then. For the moment I've just left the refactoring I already did.
2022-09-09 15:07:48 +01:00
Samuel Hawksby-Robinson 41cb9d7bea Added httptest.NewServer to DecodeFromURL and CryptoOnRamp tests 2022-09-09 15:07:48 +01:00
Patryk Osmaczko 65be6f2b96 feat: add and distribute `chatIdentity.FirstMessageTimestamp`
`FirstMessageTimestamp` enables members of the community to determine if
there are any messages they can fetch on the community channel(chat).

`FirstMessageTimestamp` is advertised by admin for each community chat
through `CommunityDescription`. It assumes admin is online frequently
enough to capture the first channel message.

For existing communities admin determines first message timestamp by
finding oldest chat message in its local database.

task: status-im/status-desktop#6731
2022-09-09 08:59:39 +02:00
Roman Volosovskyi 0ecbb5e8d7
[#13855] Fix contact request decision status on Sync All 2022-09-08 17:42:21 +02:00
Richard Ramos 37d3f9f612
chore: hardcode optimism testnet for retrieving communities portal (#2810) 2022-09-06 14:07:22 -04:00
Roman Volosovskyi e5408fa993
[#13855] Sync last contact request decisions on Sync All 2022-09-06 18:57:23 +02:00
Samuel Hawksby-Robinson 45b287370a Implemented more comprehensive file compression to handle large files 2022-09-05 16:06:04 +01:00
Stefan bc00836df2 feat: add tenor domains to LinkPreviewWhitelist
Also forward the tenor URLs as previews

Updates: #6829
2022-09-05 12:32:11 +02:00
Michal Iskierko c277e8addc fix: change migration timestamp of group chat add image feature 2022-09-01 17:55:46 +02:00
Michal Iskierko e3f451cd79 feat: Handle image in group chat
Add image_payload column to chats table.
Add Base64Image to chat struct.
Add ImageChange event to propagate image.
Change EditChat API - use CroppedImage.
Process and crop image in EditGroupChat.
2022-09-01 12:19:01 +02:00
Roman Volosovskyi b87ecb206e
Ignore group chat color when not specified (#2830) 2022-08-31 18:13:18 +02:00
Michał b5cc14f302
fix(chats): mark 1-1 chat as active when contact is mutually approved (#2822) 2022-08-26 18:50:41 +02:00
Patryk Osmaczko 614f0b988c fix: prevent tests segfault 2022-08-26 11:25:33 +02:00
Patryk Osmaczko 78747889ab chore: add tests for leaving and rejoining community
covers: #2812
2022-08-26 11:25:33 +02:00
Patryk Osmaczko 7e25a6125f feat: introduce and distribute RequestToLeave community
closes: #2812
2022-08-26 11:25:33 +02:00
Samuel Hawksby-Robinson 26b33aa09d Added AccountType to enforce strict typing on Accounts
Also a tpyo was fixed, probably introduced by me.
2022-08-25 22:01:43 +01:00
Pascal Precht 9b04633bb7 feat(communities): introduce `publish` flag in community manager APIs
This is so that we can control whether we want to publish the community
when it, or it's categories and channels, are created.

This is needed for the discord import so that we can create communities,
channels and categories without publishing the community and have it
show up in UIs too early.
2022-08-25 12:59:30 +02:00
Pascal Precht 16feb64671 fix(message_persistence): ensure discord message author id is stored correctly 2022-08-25 11:51:50 +02:00
Pascal Precht 3f987cc565 fix(messenger): don't remove inactive chats when syncing
This commit ensures we're relying on `chat.DeletedAtClockValue` instead
of `chat.Active` to know whether or not we need to remove the chat from
paired devices.

Because we were relying on `Active != true`, we ended up with a serious
but that would result in deactivating all chats on paired devices.

The reason the chats would disappear on paired devices is because, when
setting up a new device by importing a seedphrase, chances are this
device will receive `HandleBackUp` signals (which original from other
devices with the same account that backed up contacts etc).

When backups are handled, we create chats for every contact that's part
of the backup signal. Those chats are set to `Active = false` because
the signal handling shouldn't cause those chats to show up in the UI.

However, because those are set to `Active = false`, the next time the
user tries to sync from this devices, all those chats are considered as
"removed", hence sending "chat removed" signals when syncing (which then
causes those chats to disappear on all paired devices.

We need to rely on `DeletedAtClockValue` to know whether a chat was
indeed removed and only then emit such a signal.
2022-08-25 11:51:01 +02:00
Samuel Hawksby-Robinson a6757762af fix weird import quirirk 🤔 2022-08-24 23:30:09 +01:00
Roman Volosovskyi f43f43cc30
[#13672] Sync contact request decision 2022-08-24 16:08:41 +02:00
Ibrahem Khalil 5949ed2a44
Issue 13813 -- Use messenger ns for browser CRUD (#2801)
* Move browser CRUD to messenger ns

* Remove tests

* Create new endpoints for browsers CRUD

* Move tests to correct ns

* Lintil soup

* Fix tests

* Lint

* Bump status-go

Co-authored-by: Ibrahem Khalil <33176106+vampirekiddo@users.noreply.github.com>
2022-08-24 16:05:35 +02:00
Richard Ramos 1f64bf1cfe
feat: log raw messages to csv for debugging (only if explicitly enabled) (#2737) 2022-08-24 08:06:48 -04:00
Samuel Hawksby-Robinson 5eb8e5a34f Added payload reset on PayloadManager level 2022-08-22 13:27:59 +01:00
Samuel Hawksby-Robinson 344458d74a Added multiaccounts.Database tests for new funcs 2022-08-22 13:27:59 +01:00
Samuel Hawksby-Robinson 38c8e8a1fe Added payload marshal and unmarshal to/from protobuf 2022-08-22 13:27:59 +01:00
Michal Iskierko e6a3f63ec7 feat: Add DeclinedRequestsToJoinForCommunity to API
Issue #6279
2022-08-22 13:43:26 +02:00
siddarthkay 924820c14a Implement wallet connect session CRUD API 2022-08-19 12:32:00 +01:00
Patryk Osmaczko 9cf61d205f chore: remove name redundancy TransformToProtobuf -> ToProtobuf 2022-08-16 14:29:00 +02:00
Patryk Osmaczko 78d4d86f68 chore: add bio and social links validation 2022-08-16 14:29:00 +02:00
Patryk Osmaczko b711b61fb9 feat: add bio
closes: #2782
2022-08-16 14:29:00 +02:00
Patryk Osmaczko 4143de3816 feat: add social links
iterates: #2782
2022-08-16 14:29:00 +02:00
Pascal Precht 081974da1e feat: add `discord_messages` table and persistence APIs
This adds a new `discord_messages` table and extends the persistence
APIs such that `MessagesByID` and `MessageByID` will return user
messages that include their discord message payload.

It also adds APIs to save individual discord messages.
2022-08-11 10:49:23 +02:00
Pascal Precht d0e0deac95 feat: introduce `discord_message_authors` persistence APIs
This introduces a new table to store discord message authors.
The main reason this table is being introduce is so that we don't have
to duplicate discord message author information in the `user_messages`
table when importing discord communities (ongoing work).

In addition to the table there are also two new APIs on the messenger
persistence layer (which are later used in the import logic):

- `HasDiscordMessageAuthor`
- `SaveDiscordMessageAuthor`

Closes #2759
2022-08-10 10:13:55 +02:00
Pascal Precht eda6d10ce5 fix: adjust error codes for discord import
There are two types of errors "non-critical" (or "warning") and "critical".
These map to error codes `1` and `2` respectively.

The current error codes are a left-over of initial experimenting.
2022-08-08 19:37:19 +02:00
Mikhail Rogachev cd91b19737
feat: add optional inviteMessage to share-community request (#2776) 2022-08-08 13:49:39 +03:00
Michal Iskierko 31671ea040 feat: distribute color info when creating group chat or changing chat color
Regenerating protocol protobuf files - membership_update_message.proto change.

Issue #5982
2022-08-08 10:33:38 +02:00
Pascal Precht 9c568c58cf feat: introduce messenger APIs to extract discord channels
As part of the new Discord <-> Status Community Import functionality,
we're adding an API that extracts all discord categories and channels
from a previously exported discord export file.

These APIs can be used in clients to show the user what categories and
channels will be imported later on.

There are two APIs:

1. `Messenger.ExtractDiscordCategoriesAndChannels(filesToimport
   []string) (*MessengerResponse, map[string]*discord.ImportError)`

   This takes a list of exported discord export (JSON) files (typically one per
   channel), reads them, and extracts the categories and channels into
   dedicated data structures (`[]DiscordChannel` and `[]DiscordCategory`)

   It also returns the oldest message timestamp found in all extracted
   channels.

   The API is synchronous and returns the extracted data as
   a `*MessengerResponse`. This allows to make the API available
   status-go's RPC interface.

   The error case is a `map[string]*discord.ImportError` where each key
   is a file path of a JSON file that we tried to extract data from, and
   the value a `discord.ImportError` which holds an error message and an
   error code, allowing for distinguishing between "critical" errors and
   "non-critical" errors.

2. `Messenger.RequestExtractDiscordCategoriesAndChannels(filesToImport
   []string)`

   This is the asynchronous counterpart to
   `ExtractDiscordCategoriesAndChannels`. The reason this API has been
   added is because discord servers can have a lot of message and
   channel data, which causes `ExtractDiscordCategoriesAndChannels` to
   block the thread for too long, making apps potentially feel like they
   are stuck.

   This API runs inside a go routine, eventually calls
   `ExtractDiscordCategoriesAndChannels`, and then emits a newly
   introduced `DiscordCategoriesAndChannelsExtractedSignal` that clients
   can react to.

   Failure of extraction has to be determined by the
   `discord.ImportErrors` emitted by the signal.

**A note about exported discord history files**

We expect users to export their discord histories via the
[DiscordChatExporter](https://github.com/Tyrrrz/DiscordChatExporter/wiki/GUI%2C-CLI-and-Formats-explained#exportguild)
tool. The tool allows to export the data in different formats, such as
JSON, HTML and CSV.

We expect users to have their data exported as JSON.

Closes: https://github.com/status-im/status-desktop/issues/6690
2022-08-04 14:34:23 +02:00
Roman Volosovskyi 0135cc155b
[#13647] Avoid rewriting of `response.Settings` on new acc sync 2022-08-03 12:12:53 +02:00
Parvesh Monu 60a49fc7d9
Timeout automatic status updates (#2757) 2022-08-03 04:38:01 +05:30
Pascal Precht 1ac88975b0 feat(messenger): add `createDefaultChannel` flag to `CreateCommunity` API
This introduces a flag to configure whether `Messenger.CreateCommunity`
should create a default channel.

As discussed in https://github.com/status-im/status-go/issues/2758, this
is needed for the upcoming functionality to import discord communities.

Closes #2758
2022-07-26 10:23:49 +02:00
audriu 4aa341395c
Fix sync of blocked contacts (#2764) 2022-07-22 14:59:32 +03:00
Patryk Osmaczko e5e07408e2 feat: share image/username on separate topic on a community
closes: #2707
2022-07-20 10:35:19 +02:00
Vitaliy Vlasov 28b76ce4ca Fix DeleteAccount 2022-07-19 21:29:12 +03:00
Andrea Maria Piana 897bd0f58f Dont send notification to our own devices 2022-07-18 17:17:20 +01:00
Jakub Sokołowski 530f3c7a3a
rename status-react to status-mobile
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-07-17 15:37:14 +02:00
Michal Iskierko a8c8604745 fix: DismissLatestContactRequestForContact - set default request id
Issue #6395
2022-07-15 15:08:53 +02:00
Pascal Precht f6c9ec7838 refactor: Require request access for all communities
This commit introduces a few changes regarding users accessing
communities:

While the APIs still exist, community invites should no longer be
used, instead communities should merely be "shared".
Sharing a community to users allows users to "join" the community,
which in reality makes them request access to that community.
This means, users have to request access to any community, even if
the community has permissions set to NO_MEMBERSHIP
Only difference between ON_REQUEST and NO_MEMBERSHIP is that
ON_REQUEST communities require manual approval of the owner/admin
to access a community. NO_MEMBERSHIP communities accept
automatically (as soon as owner/admin receives the request).
This also implies that users are no longer optimistically added to the
member list of communities, but only after they have been accepted.

This introduces a bit of a message ping-pong for users to know that
someone is now part of a community
2022-07-08 13:16:12 +02:00
Andrea Maria Piana 0078e39e3d Reduce max keep in tests 2022-07-07 13:35:12 +01:00
Audrius Molis d17b076bc2
Remove remote contact when removing localy (#2735) 2022-07-07 11:49:52 +03:00
Vitaliy Vlasov 3dee94e505 Wallet sync for generated accounts 2022-07-06 19:24:43 +03:00
Boris Melnik 3e65e36fa6
feat: Add mute category methods (#2736) 2022-07-06 19:16:19 +03:00
frank 76e2d843a6 Cache community link previews 2022-07-06 11:44:14 +01:00
Richard Ramos 0322ac497b
feat: contact verification request (#2586)
fix: add verification request to response

fix: code review

add missing functions and simplify timestamp usage

fix: sync verification requests

feat: add endpoint to fetch all received verification requests

feat: add signal when trusting verification request

Co-authored-by: Jonathan Rainville <rainville.jonathan@gmail.com>
2022-07-05 15:49:44 -04:00
Mikhail Rogachev 7ad0057003
feat(@communities): Add saving tags on community edit (#2739) 2022-07-04 16:56:00 +03:00
Michal Iskierko 72d2a97449 feat: unban user in community
Issue #2724
2022-07-04 09:02:33 +02:00
Andrea Maria Piana 54b9b0e8af Handle default contact request in accept-latest 2022-06-27 09:38:06 +01:00
Richard Ramos 2873e65a61
feat: community tags (#2708)
Signed-off-by: Richard Ramos <info@richardramos.me>

Co-authored-by: MishkaRogachev <mishkarogachev@gmail.com>
2022-06-24 09:40:12 -04:00
Richard Ramos 31feea9f15
fix: missing display name when requesting to join a community (#2725) 2022-06-22 14:02:44 -04:00
Boris Melnik 8063152657
fix(community-edit): Save permissions when community edited (#2720)
Part of: https://github.com/status-im/status-desktop/issues/6073
2022-06-21 13:43:49 -04:00
flexsurfer 1c77f2ed6e
fix offline messages marked as seen (#2713) 2022-06-21 18:31:15 +02:00
Samuel Hawksby-Robinson 366c088ec5 Fix cycle import and added private key to Client 2022-06-20 15:33:09 +01:00
Andrea Maria Piana 22669d0423 Add default contact request
If a contact update or a legacy contact request is sent, we create a
notification for the user in the activity center so it can be replied
to.
If at a later date a new contact request is received from the same user,
this will replace it, so the proper message can be displayed.
2022-06-20 10:44:08 +01:00
Vitaliy Vlasov 4f722b6fe8 Communities encryption integration 2022-06-17 21:24:39 +03:00
Andrea Maria Piana 961526556b
Accept/Dismiss LastestContactRequestForContact endpoint (#2702) 2022-06-17 12:20:43 -04:00
Pascal Precht c855272340 feat: add garbage collection for soft deleted bookmarks
This introduces a simple garbage collection which checks for all soft
deleted bookmarks (`removed = 1`) which have been marked for garbage
collection more than 30 days ago from the time of bootstapping the
messenger.

Closes #2705
2022-06-17 14:21:21 +02:00
Pascal Precht f3af6aa4dc feat: introduce `AddBookmark` and `RemoveBookmark` APIs to messenger
These APIs are being introduced to address #2706 and #2704, provided
that clients will move to using these APIs instead of the currently
provided equivalent APIs in the browser service.

The `bookmarks` table is being extended with a `deleted_at` field which
can later be used for garbage collection, as "removing" a bookmark is
merely soft deletion and doesn't actually remove the data from the
database.

In addition to those APIs adding and soft deleting bookmark entries,
they also automatically perform a sync operation to ensure that
bookmarks are synced in real-time (#2704).

Closes #2706, #2704
2022-06-17 12:29:03 +02:00
Pascal Precht 9d5bcc3c60 feat: sync `CommunitySettings` across paired devices
This commit introduces a new `clock` field in the
`communities_settings` table so that it can be leveraged for syncing
community settings across devices.

It alsoe exends existing `syncCommunity` APIs to generate
`SyncCommunitySettings` as well, avoiding sending additional sync messages
for community settings.

When editing communities however, we still sync community settings
explicitly are we aren't syncing the community itself in that case.
2022-06-16 12:45:05 +02:00
Samuel Hawksby-Robinson 7f149f93c1
Get preferred network IP and refactor server package to increase reusability (#2626)
* Added function to get preffered network IP

Also done some refactor work oon server package to make a lot more reusable

* Added server.Option and simplified handler funcs

* Added serial number deterministically generated from pk

* Debugging TLS server connection

* Implemented configurable server ip

When accessing over the network the server needs to listen on the network port and not localhost or 127.0.0.1 . Also the cert can now have a dedicated IP

* Refactor of URL funcs to use the url package

* Removed redundant Options pattern in favour of config param

* Added full server test using GetOutboundIP

* Remove references and usage of Server.port

The application does not need to set the port, we rely on the net.Listener to pick a port.

* Version bump

* Added ToECDSA func and improved cert testing

* Added error check in test

* Split Server types, embedding raw Server funcs into specialised server types

* localhost

* Implemented DNS and IP based cert gen

ios doesn't allow for restricted ip addresses to be used in a valid tls cert

* Replace listener handling with original port store

Also added handlers as a parameter of the Server
2022-06-15 15:49:31 +01:00
Andrea Maria Piana f9ac629b2a Enable contact request settings 2022-06-13 13:46:45 +01:00
Richard Ramos 9430f494be
fix: handle nil descriptions in communities for chat_getChats (#2694) 2022-06-08 08:46:52 -04:00
Andrea Maria Piana 09ba88c19d Join group on accepting activity center notification 2022-06-08 11:48:45 +01:00
Patryk Osmaczko 5df5d6b519 feat: remove explicit group chat join
relates: #status-im/status-desktop/5717
2022-06-08 11:48:45 +01:00
Andrea Maria Piana d25c0fa1b8 Resize chat message images 2022-06-07 12:56:24 +01:00
Richard Ramos c3b0582cc9
feat: fetch curated communities from smart contract on optimism (#2685) 2022-06-02 08:17:52 -04:00
Patryk Osmaczko ee7025a573 feat: add intro/outro message to communities 2022-05-31 11:41:26 +02:00
flexsurfer 888dd0e3e7
improve MarkAllRead performance (#2698) 2022-05-31 10:18:48 +02:00
Andrea Maria Piana 1bfde4c4cc Initial support for mutual contact requests 2022-05-31 09:12:36 +01:00
Stefan 63e58ba035 feat: add banner support for communities
Add banner image as a special `IdentityImage` beside "thumbnail" and "large"

Banner input cropped image processing

- Resize to keep in the limits of `BannerDim`
- Encode to match the file size limits define for banner
- Don't scale up. This can be done efficiently in the UI

Changes to `images` module

- Refactor `EncodeToBestSize` as `EncodeToLimits` to accept arbitrary dimensions
  and allow for custom size
- Define `DimensionLimits` for banner not to exceed 450 KB and a rough estimate
  for the ideal size
2022-05-27 14:42:14 +03:00
Vitaliy Vlasov 011238b1d1 Wallet sync 2022-05-18 15:25:20 +03:00
Pascal Precht 714c03c635 feat: introduce `CommunityAdminSettings` in `CommunityDescription`
This allows to store community admin settings that are meant to be propagated
to community members (as opposed to the already existing
`CommunitySettings` which are considered local to every account).

The first setting introduced as part of this commit is one that enables
community admins to configure whether or not members of the community
are allowed to pin messages in community channels.

Prior to this commit, this was not restricted at all on the protocol
level and only enforced by clients via UI (e.g. members don't see an
option to pin messages, although they could).

This config setting now ensures that:

1. If turned off, members cannot send a pin message
2. If turned off, pin messages from members are not handled/processed

This is needed by https://github.com/status-im/status-desktop/issues/5662
2022-05-18 09:58:11 +02:00
Anthony Laibe 997708bc82 fix: flakey test with order of chats 2022-05-13 16:17:24 +02:00
Richard Ramos 2be7e53a89 fix: community was not updated when creating general chat 2022-05-13 16:17:24 +02:00
Sale Djenic b4fd62df58 tests update 2022-05-13 16:17:24 +02:00
Audrius Molis a244d77657 Enable currency settings and sticker pack synchronization 2022-05-11 16:59:12 +03:00
Andrea Maria Piana 4d15ae8a85 Upgrade to go 1.18 2022-05-11 12:39:54 +01:00
Anthony Laibe 6b9f9a896a
feat: create General channel with community creation (#2662) 2022-05-10 15:25:08 +02:00
Pascal Precht d11290ef4a fix: only dispatch magnetlink when owner of community 2022-05-10 11:27:31 +02:00
Pascal Precht 43d6305157 Handle history archive magnetlink messages
This introduces the ability for status notes to handle community
history archive magnetlinks. To make this work, a few things are needed:

1. A new database table has been introduced to store message archive
   hashes. This is necessary so status nodes can determine whether or
   not they need to download a certain archive
2. The messenger's `handleRetrievedMessages()` has been exteded to take
   magnetlink messages into account
3. New APIs were added to download torrent data given a magnetlink and
   also to extract messages from downloaded archives, which are then
   later fed to `handleRetrievedMessages`

Closes #2568
2022-05-10 11:27:31 +02:00
Richard Ramos 0048aaebcc
feat: add IPFS rate limiter for downloading stickers and use http server for retrieving stickers (#2611) 2022-05-09 09:07:57 -04:00
Roman Volosovskyi c531bf2ca1
Fix syncing of adding contact after removal 2022-04-25 11:02:49 +02:00
Vitaliy Vlasov 16197dc807 Sync profile picture 2022-04-21 19:50:31 +03:00
Roman Volosovskyi 9de4eb3c8a
Backup deleted communities 2022-04-14 18:01:07 +02:00
Sale Djenic 10d0133974 fix: set only blocked flag to blocked contact for desktop app 2022-04-12 09:42:43 +02:00
Pascal Precht 631907839a Enable history archive support for all non-admin communities
Previously, we've turned archive support off by default, this means,
community member nodes won't try to download torrent data when they
receive a magnetlink.

This commit ensures that communities joined in the future will have
this setting on, and also all existing communities that the node
isn't admin of will have this feature enabled.
2022-04-11 15:41:36 +02:00