Commit Graph

1045 Commits

Author SHA1 Message Date
Patryk Osmaczko 783a6b9153 fix: remove rekeying unencrypted communities 2023-06-23 16:33:58 +02:00
MishkaRogachev ecf493e6cd chore: less flaky AccountManagerMock for community tests 2023-06-23 14:54:44 +01:00
Andrea Maria Piana 6e19098dee Run tests separately, make sure messenger is shutdown, fix torrent test 2023-06-23 11:30:04 +01:00
Jonathan Rainville 9c596343be
feat(communities): enable selecting addresses to pass when joining (#3656)
Improve `RequestToJoinCommunity`  to accept `Addresses` in the request. If `Addresses` is not empty, we then only pass to the owner the selected addresses. The others are ignored.
Does not validate that the addresses in the slice are part of the user's wallet. Those not part of the wallet are just ignored.
2023-06-22 14:59:07 -04:00
Boris Melnik 3e7d1a5f34
fix(migration): Fixes mute_till migration (#3653) 2023-06-22 18:49:58 +03:00
Ibrahem Khalil d3e650d5e5
Make chat muting only works on one chat and not to completely block PNs from a user (#3647) 2023-06-22 08:06:32 +03:00
Mikhail Rogachev 2fb87b5f0d
Chore: improve mocking for community tests (#3637)
* chore: different wallet addresses for different users in community tests

* chore: fix naming for account.Manager interface
2023-06-21 16:13:31 +04:00
frank fee033fadb
support mention Non-Latin nickname (#3641)
* support mention non-Latin nickname

* use IndexRune instead of Index

* fix mobile issue #15524

* add another test case
2023-06-21 14:42:14 +08:00
Pascal Precht bf64f97d5a feat: introduce `CheckAllCommunityChannelsPermissions()` API
This API is used to get a permission status of all channels of a given
community.

Clients can use this API to get the provided information for all
community channels with a single RPC call instead of doing one call
for each channel separately.
2023-06-20 10:06:44 +02:00
Pascal Precht 7938297606 feat: introduce `CheckChannelPermissions` API
Similar to `CheckPermissionToJoin()` we now get
a `CheckChannelPermissions()` API.

It will rely on the same `PermissionResponse` types, but gives
information about both `ViewOnlyPermissions` and
`ViewAndPostPermissions`.
2023-06-20 09:42:10 +02:00
Pascal Precht f702b54d08 fix: don't check permissions if revealed accounts aren't legit
This seems to be a bug that was introduced when two features, admin
permissions and "always reveal wallet accounts" where merged.

We need to make sure we **first** check the revealed accounts and only
**then** do we perform permission checks on them. Otherwise we can run
into scenarios where fake addresses are used and users will be accepted
to the community.
2023-06-19 15:27:10 +02:00
Pascal Precht a36202ff30 fix: don't return with error in permissions check when no chain IDs are
found

Turns out that, when we return with an error, instead of
a non-statisfied check permissions response, we can run into cases where
members that should be kicked are not kicked.
2023-06-19 15:26:42 +02:00
Pascal Precht 05e67b1838 fix: add missing private field when converting permission request 2023-06-19 15:26:42 +02:00
frank 0fcf3abd83
Improve/mention input segments (#3631)
* improve calculate input segments relate to mention feature

* bump version

* rename variable
2023-06-19 19:08:45 +08:00
Boris Melnik 1eb92a19a2
feat(communities): Adds muting interval to community (#3549) 2023-06-17 11:19:05 +03:00
frank 9e7f1338f0
refactor function diffText (#3615) 2023-06-16 23:09:37 +08:00
Mikhail Rogachev 51e3d800bb
fix: save revealed accounts regardless of permissions granted (#3609) 2023-06-16 11:10:32 +04:00
Michal Iskierko ccde92377d feat(BurnCollectibles): Add burn collectibles functionality
Change smart contract with new API.
Update gas amount for deployment.
Add Burn() and EstimateBurn() functions.
Add RemainingSupply() functions.

Issue #10816
2023-06-15 15:38:19 +02:00
Andrea Maria Piana 8015cc3e3b Handle race condition when sending envelopes
It happens that an envelope is sent before it's tracked, resulting in
long delays before the envelope is marked as sent.
This commit changes the behavior of the code so that order is now
irrelevant.
2023-06-15 11:28:19 +01:00
Mykhailo Prakhov e058b50a2e
feat: community admin permission functionality (#3569)
* feat: community admin implementation

* fix: code review fixes

* chore: request admin permissions in CheckPermissionToJoin, unit test fix
2023-06-14 10:15:46 -04:00
Pascal Precht 3f231f53e3 Ensure `ChatIds` are handled by token permission requests 2023-06-13 13:42:48 +02:00
mprakhov 83ed3e5ede fix: allow to set token permission as a private 2023-06-13 13:42:48 +02:00
mprakhov 6bc8765d39 chore: new CommunityTokenPermission types 2023-06-13 13:42:48 +02:00
Patryk Osmaczko a402b28b9f chore: resume archives import with delay
closes: status-im/status-desktop#10937
2023-06-13 08:38:15 +02:00
Andrea Maria Piana 37653638bc Make sure the image URL is returned when a replied message is deleted
When we reply to our own message with an image, we didn't set the URL of
the image of the message, which resulted in the image not being
displayed correctly.
2023-06-12 19:22:26 +01:00
Pascal Precht 1a2ca21070 Add chainIds to revealed accounts in memberhsip requests
This commit does a few things:

- Adds a migration that adds chainids to communities_request_to_join_revealed_addresses
- Removes RevealedAddress in favor of RevealedAccount which is now a struct that contains the revealed address, as well as the signature and a list of chain IDs on which to check for user funds
- Changes the logic of sending requests to join a community, such that after creating address signatures, the user node will also check which of the addresses has funds on which networks for the community's token permissions, and add the chainds to the RevealedAccount
- Updates checkPermissionToJoin() such that only relevant chainids are used when checking user's funds. Chain IDs are retrieved from RevealedAccounts and matched against token permission criteria chain IDs
2023-06-12 10:49:29 +02:00
Pascal Precht 511faad0ec fix: don't unsubscribe from community when kicked
There's two scenarios in which we're leaving a community:
We either get kicked or we leave ourselves.

In case of leaving ourselves it's fine to unsubscribe from further
community updates be cause we deliberately chose to leave.

In case of being kicked however, this is different.
Say I'm kicked from a community because its token permissions have
changed, in this case we don't want clients to manually re-subscribe to
the community to get informed when there were further changes.
status-go should rather not unsubscribe if we know for sure we've been
kicked by someone else.
2023-06-12 09:37:12 +02:00
Ibrahem Khalil 47711c4f15
Show mention notification/AC once for a message with multiple images (#3485) 2023-06-10 12:57:40 +04:00
frank b6d4e75cf1
Feat/sync activity center notification (#3535)
fix flaky test: TestRetrieveBlockedContact

resolve conflict when rebase origin/develop

Feat/sync activity center notification (#3581)

* feat: sync activity center notification

* add test

* fix lint issue

* fix failed test

* addressed feedback from sale

* fix failed test

* addressed feedback from ilmotta

go generate ./protocol/migrations/sqlite/...

feat: add updated_at for syncing activity center notification
2023-06-10 10:00:17 +08:00
Sale Djenic 56cad423f0 chore: `forceFetchingBackup` param added to `RequestAllHistoricMessages` and `RequestAllHistoricMessagesWithRetries` functions 2023-06-09 17:42:11 +02:00
Mikhail Rogachev 8589a525a5
Add system message for mutual contact state updates (#3519)
* feat: add mutual state update system message

* feat: send mutual state update on accepting CR

* feat: send mutual state update when removing a contact

* fix: don't send MutualStateUpdateMessage over wire

* fix: mutual state update message text fixed

* fix: new clock to ensure system message after CR and add chat to the response

* feat: add AC notification for contact removal

* feat: replace "sent" mutual state system message with "added"
2023-06-08 16:00:19 +04:00
Stefan 5b6f7226bb feat(wallet) extract json blobs and add custom migration support
Extended the migration process with a generic way of applying custom
migration code on top of the SQL files. The implementation provides
a safer way to run GO code along with the SQL migrations and possibility
of rolling back the changes in case of failure to keep the database
consistent.
This custom GO migration is needed to extract the status from
the JSON blob receipt and store it in transfers table.

Other changes:
- Add NULL DB value tracking to JSONBlob helper
- Index status column on transfers table
- Remove unnecessary panic calls
- Move log_parser to wallet's common package and use to extract token
  identity from the logs

Notes:
- there is already an index on transfers table, sqlite creates one for
  each unique constraint therefore add only status to a new index
- the planned refactoring and improvements to the database have been
  postponed due to time constraints. Got the time to migrate the data
  though, extracting it can be done later for a more efficient
  implementation

Update status-desktop #10746
2023-06-08 13:54:40 +02:00
frank 9e0a12cb32
fix: Mention is not resolved if username or nickname of one is a substring of another (#3571)
* fix mobile issue #16099

* bump version
2023-06-08 14:47:38 +08:00
Patryk Osmaczko 46768e624a feat: add and populate IdentityImage::LocalURL
part of: status-im/status-desktop#10886
2023-06-07 22:32:50 +02:00
Alex Jbanca e8c4b7647f
chore(upgradeSQLCipher): Upgrading SQLCipher to version 5.4.5 (#3559)
* chore(upgradeSQLCipher): Upgrading SQLCipher to version 5.4.5

Changes:
### github.com/mutecomm/go-sqlcipher
1. The improved crypto argorighms from go-sqlcipher v3 are merged in v4
	Tags:
	v4.4.2-status.1 - merge `burn_stack` improvement
	v4.4.2-status.2 - merge `SHA1` improvement
	v4.4.2-status.4- merge 'AES' improvement
2. Fixed `go-sqlcipher` to support v3 database in compatibility mode (`sqlcipher` already supports this) (Tag: v4.4.2-status.3)
3. Upgrade `sqlcipher` to v5.4.5 (Tag: v4.5.4-status.1)

### github.com/status-im/migrate/v4
1. Upgrade `go-sqlcipher` version in `github.com/status-im/migrate/v4`

### status-go
1. Upgrade `go-sqlcipher` and `migrate` modules in status-go
2. Configure the DB connections to open the DB in v3 compatibility mode

* chore(upgradeSQLCipher): Use sqlcipher v3 configuration to encrypt a plain text database

* chore(upgradeSQLCipher): Scanning NULL BLOB value should return nil

Fixing failing tests: TestSyncDeviceSuite/TestPairingSyncDeviceClientAsReceiver;  TestSyncDeviceSuite/TestPairingSyncDeviceClientAsSender

Considering the following configuration:
1. Table with BLOB column has 1 NULL value
2. Query the value
3. Rows.Scan(&dest sql.NullString)

Expected: dest.Valid == false; dest.String == nil
Actual: dest.Valid == true; dest.String == ""

* chore: Bump go-sqlcipher version to include NULL BLOB fix
2023-06-07 08:58:01 +03:00
Sale Djenic 874a0656db fix: profile social links, fix older clock error 2023-06-06 17:05:55 +02:00
Omar Basem 1d4fa29f8e
feat: add images count to reply (#3574)
* feat: add images count to reply
2023-06-06 15:52:07 +04:00
Sale Djenic cff7d2f693 fix: profile social links updated 2023-06-06 09:59:12 +02:00
Patryk Osmaczko 15d2b4fe80 feat: add configurable throttling mechanism for importing msgs
part of: status-im/status-desktop#10815
2023-06-06 08:49:02 +02:00
Pascal Precht ffc1006953 Add permission checks for ENS token permissions
Also add tests for creating and editing token permissions
as well as a test for checking ENS ownership.
2023-06-05 13:10:48 +02:00
Icaro Motta 92b5d831fe
Support unfurling more websites (#3530)
Add support for unfurling a wider range of websites. Most code changes are
related to the implementation of a new Unfurler, an OEmbedUnfurler, which is
necessary to get metadata for Reddit URLs using oEmbed, since Reddit does not
support OpenGraph meta tags. The new unfurler will also be useful for other
websites, like Twitter. Also the user agent was changed, and now more websites
consider status-go reasonably human.

Related to issue https://github.com/status-im/status-mobile/issues/15918

Example hostnames that are now unfurleable: reddit.com, open.spotify.com,
music.youtube.com

Other improvements:

- Better error handling, especially because I wasn't wrapping errors correctly.
  I also removed the unnecessary custom error UnfurlErr.
- I made tests truly deterministic by parameterizing the http.Client instance
  and by customizing its Transport field (except for some failing conditions
  where it's even good to hit the real servers).
2023-06-05 07:46:17 -03:00
Sale Djenic c6192bd26c fix: issues caused by wrong `pairing.proto` fixed 2023-06-05 09:29:34 +02:00
Khushboo-dev-cpp 8b91e3aaaf
chore: Add ColorId for Wallet accounts that can be shared with mobile (#3521) 2023-06-02 17:06:51 +02:00
Boris Melnik 5935339c19
feat(categories): Add muted type to category muting shortcut (#3534) 2023-06-02 14:25:32 +03:00
Jonathan Rainville 3f00869e1f
fix(contacts): add contact to ban and unban responses (#3558) 2023-06-01 13:26:12 -04:00
Boris Melnik af1327f95d
fix(mute): Fix time calculation and skip empty response sending (#3557) 2023-06-01 17:17:42 +03:00
Andrea Maria Piana 7fd9fefdef Add LoginAccount endpoint
This commit adds LoginAccount endpoint.
This makes it consistent with CreateAccount and RestoreAccount as they
use similar config.

The notable difference with the previous endpoint is the API, which is
the same as CreateAccount/RestoreAccount, and the fact that it will
override your networks configuration.

Storing them in the config is now not needed anymore, as that's always
driven from the backend, and we won't allow custom networks in the new
wallet.
2023-06-01 10:05:11 +01:00
Jonathan Rainville b701005f3b
fix(pins): prepare content of pin messages so stickers work (#3523) 2023-05-30 15:05:38 -04:00
Jonathan Rainville b68853c53e
fix(messenger_handler): fix group chat not being set as active (#3545)
Fixes an issue where if a group chat was first received from a non-contact, and later received from a contact, it still wouldn't save it as active.

That's because we checked if we were **newly** added instead of just if we were added. That meant that in the case I described above, the chat would then never have the chance to be set active.
2023-05-30 09:49:46 -04:00
Jonathan Rainville a6285cc827
Fix chats reseting when a Sync signal comes for communities (#3539)
* fix(community): stop re-joining comm when receiving a sync community msg

Fixes an issue with chats being reset. Since joining a community resaves the chats with the synced default value, it resets the sate of the chats, losing the unread messages, the muted state and more.
The solution is to block the re-joining of the community. In the case of the sync, we catch that error and just continue on.

* fix(import): fix HandleImport not saving the chat

Doesn't change much, but it could have caused issues in the future, so since we might have modified the chat, we make sure to save them
Also adds a test

* fix tests
2023-05-29 13:57:05 -04:00