Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chat team MVP4 part 1: block user #7170

Merged
merged 2 commits into from
Feb 5, 2019
Merged

Chat team MVP4 part 1: block user #7170

merged 2 commits into from
Feb 5, 2019

Conversation

yenda
Copy link
Contributor

@yenda yenda commented Dec 21, 2018

partially fixes #7157

Summary:

block

  • user can block other users from their profile page
  • all messages from blocked user are deleted and future ones are ignored
  • chats are updated accordingly, updating last-message and unread counter that are denormalized and recomputing message groups of affected chats

Currently the user can only been unblocked before you leave the profile. Later we will reintroduce contact list with a list of blocked users so that users can be unblocked

Testing notes:

Platforms

  • Android
  • iOS

Areas that maybe impacted (optional)

Functional

  • 1-1 chats
  • public chats
  • group chats

status: ready

@yenda yenda added the chat label Dec 21, 2018
@yenda yenda self-assigned this Dec 21, 2018
@ghost
Copy link

ghost commented Dec 21, 2018

Pull Request Checklist

  • Have you updated the documentation, if impacted (e.g. docs.status.im)?

@status-im-auto
Copy link
Member

status-im-auto commented Dec 21, 2018

Jenkins Builds

Click to see older builds (68)
Commit #️⃣ Finished (UTC) Duration Platform Result
c9b7c38c #1 2018-12-21 16:24:17 ~3 min 41 sec macos 📄 build log
c9b7c38c #1 2018-12-21 16:24:56 ~4 min 22 sec ios 📄 build log
c9b7c38c #1 2018-12-21 16:25:05 ~4 min 35 sec android-e2e 📄 build log
c9b7c38c #1 2018-12-21 16:25:34 ~5 min 1 sec ios-e2e 📄 build log
c9b7c38c #1 2018-12-21 16:26:28 ~5 min 51 sec windows 📄 build log
c9b7c38c #1 2018-12-21 16:28:25 ~7 min 54 sec android 📄 build log
c9b7c38c #1 2018-12-21 16:29:02 ~8 min 28 sec linux 📄 build log
0657808 #2 2018-12-21 16:31:27 ~3 min 40 sec macos 📄 build log
0657808 #2 2018-12-21 16:31:57 ~4 min 12 sec ios 📄 build log
0657808 #2 2018-12-21 16:32:05 ~4 min 21 sec ios-e2e 📄 build log
0657808 #2 2018-12-21 16:32:07 ~4 min 26 sec android-e2e 📄 build log
0657808 #2 2018-12-21 16:32:30 ~4 min 42 sec windows 📄 build log
0657808 #2 2018-12-21 16:33:55 ~4 min 44 sec linux 📄 build log
0657808 #2 2018-12-21 16:35:14 ~6 min 46 sec android 📄 build log
✔️ bb8b7edd #3 2018-12-21 17:27:36 ~12 min macos 📦 package
✔️ bb8b7edd #3 2018-12-21 17:28:35 ~13 min android-e2e 📦 package
✔️ bb8b7edd #3 2018-12-21 17:31:41 ~16 min windows 📦 package
✔️ bb8b7edd #3 2018-12-21 17:31:54 ~16 min ios-e2e 📦 package
✔️ bb8b7edd #3 2018-12-21 17:32:55 ~17 min ios 📦 package
✔️ bb8b7edd #3 2018-12-21 17:35:06 ~19 min linux 📦 package
✔️ bb8b7edd #3 2018-12-21 17:35:30 ~20 min android 📦 package
✔️ fd392cfa #4 2018-12-22 12:20:12 ~12 min macos 📦 package
✔️ fd392cfa #4 2018-12-22 12:20:16 ~13 min android-e2e 📦 package
✔️ fd392cfa #4 2018-12-22 12:20:38 ~13 min android 📦 package
✔️ fd392cfa #4 2018-12-22 12:22:13 ~14 min ios-e2e 📦 package
✔️ fd392cfa #4 2018-12-22 12:22:54 ~15 min ios 📦 package
✔️ fd392cfa #4 2018-12-22 12:23:59 ~16 min windows 📦 package
✔️ fd392cfa #4 2018-12-22 12:36:18 ~29 min linux 📦 package
b9bac18 #5 2018-12-22 17:45:03 ~11 min macos 📄 build log
✔️ b9bac18 #5 2018-12-22 17:46:35 ~12 min android 📦 package
✔️ b9bac18 #5 2018-12-22 17:48:26 ~14 min ios-e2e 📦 package
✔️ b9bac18 #5 2018-12-22 17:50:09 ~16 min windows 📦 package
✔️ b9bac18 #5 2018-12-22 17:51:03 ~17 min ios 📦 package
✔️ b9bac18 #5 2018-12-22 17:52:19 ~18 min android-e2e 📦 package
✔️ b9bac18 #5 2018-12-22 17:53:13 ~19 min linux 📦 package
✔️ b9bac18 #6 2018-12-22 23:51:29 ~12 min macos 📦 package
✔️ 4228713 #7 2019-01-09 12:33:26 ~14 min macos 📦 package
✔️ 4228713 #6 2019-01-09 12:34:44 ~15 min windows 📦 package
✔️ 4228713 #1 2019-01-09 12:35:09 ~16 min ios-e2e 📦 package
✔️ 4228713 #6 2019-01-09 12:35:53 ~16 min linux 📦 package
✔️ 4228713 #1 2019-01-09 12:36:16 ~17 min android-e2e 📦 package
✔️ 4228713 #1 2019-01-09 12:37:10 ~18 min ios 📦 package
✔️ 4228713 #1 2019-01-09 12:51:56 ~32 min android 📦 package
✔️ 7f5f0dd #2 2019-01-14 13:51:55 ~14 min android-e2e 📦 package
✔️ 7f5f0dd #8 2019-01-14 13:57:07 ~19 min macos 📦 package
✔️ 7f5f0dd #2 2019-01-14 13:59:36 ~22 min android 📦 package
✔️ 7f5f0dd #2 2019-01-14 14:00:34 ~23 min ios-e2e 📦 package
✔️ 7f5f0dd #2 2019-01-14 14:03:32 ~25 min ios 📦 package
✔️ 7f5f0dd #7 2019-01-14 14:07:29 ~29 min windows 📦 package
✔️ 6a4aac0 #3 2019-01-14 14:09:36 ~17 min android-e2e 📦 package
✔️ 6a4aac0 #3 2019-01-14 14:23:36 ~23 min android 📦 package
✔️ 6a4aac0 #9 2019-01-14 14:35:03 ~37 min macos 📦 package
✔️ 6a4aac0 #8 2019-01-14 14:40:51 ~33 min windows 📦 package
✔️ 6a4aac0 #8 2019-01-14 14:41:54 ~28 min linux 📦 package
✔️ 2578773 #4 2019-01-14 14:42:50 ~24 min ios-e2e 📦 package
✔️ 2578773 #4 2019-01-14 14:43:51 ~20 min android 📦 package
✔️ 2578773 #4 2019-01-14 14:44:20 ~26 min ios 📦 package
✔️ 2578773 #4 2019-01-14 14:45:07 ~28 min android-e2e 📦 package
2578773 #10 2019-01-14 15:01:54 ~26 min macos 📄 build log
✔️ 2578773 #9 2019-01-14 15:10:43 ~29 min windows 📦 package
✔️ 2578773 #9 2019-01-14 15:12:25 ~30 min linux 📦 package
✔️ f675aa4 #5 2019-01-14 16:08:09 ~23 min android-e2e 📦 package
✔️ f675aa4 #5 2019-01-14 16:10:03 ~24 min android 📦 package
f675aa4 #11 2019-01-14 16:22:13 ~37 min macos 📄 build log
✔️ f675aa4 #5 2019-01-14 16:22:52 ~37 min ios-e2e 📦 package
✔️ f675aa4 #10 2019-01-14 16:27:34 ~42 min windows 📦 package
✔️ f675aa4 #10 2019-01-14 16:27:43 ~42 min linux 📦 package
✔️ f675aa4 #5 2019-01-14 16:29:00 ~43 min ios 📦 package
Commit #️⃣ Finished (UTC) Duration Platform Result
ecc883f #6 2019-01-16 23:18:21 ~51 sec ios-e2e 📄 build log
✔️ ecc883f #12 2019-01-16 23:29:58 ~12 min macos 📦 package
✔️ ecc883f #6 2019-01-16 23:31:25 ~13 min android 📦 package
✔️ ecc883f #6 2019-01-16 23:31:34 ~14 min android-e2e 📦 package
ecc883f #6 2019-01-16 23:32:47 ~15 min ios 📄 build log
✔️ ecc883f #11 2019-01-16 23:34:19 ~16 min windows 📦 package
✔️ ecc883f #11 2019-01-16 23:35:56 ~18 min linux 📦 package
✔️ 4d6a7e9 #13 2019-01-17 14:21:42 ~13 min macos 📦 package
✔️ 4d6a7e9 #7 2019-01-17 14:22:04 ~14 min ios-e2e 📦 package
✔️ 4d6a7e9 #7 2019-01-17 14:22:59 ~15 min ios 📦 package
✔️ 4d6a7e9 #7 2019-01-17 14:24:06 ~16 min android-e2e 📦 package
✔️ 4d6a7e9 #12 2019-01-17 14:29:14 ~21 min windows 📦 package
✔️ 4d6a7e9 #12 2019-01-17 14:30:30 ~22 min linux 📦 package
✔️ 4d6a7e9 #7 2019-01-17 14:32:58 ~25 min android 📦 package

@yenda yenda force-pushed the mvp4-1-block-user branch 2 times, most recently from 0657808 to bb8b7ed Compare December 21, 2018 17:15
src/status_im/contact/core.cljs Outdated Show resolved Hide resolved
src/status_im/contact/core.cljs Outdated Show resolved Hide resolved
src/status_im/contact/core.cljs Outdated Show resolved Hide resolved
src/status_im/contact/core.cljs Outdated Show resolved Hide resolved
src/status_im/data_store/contacts.cljs Outdated Show resolved Hide resolved
{:messages (core/all-clj (core/get-by-field @core/account-realm
:message :from public-key)
:message)
:chat (core/single-clj (core/get-by-field @core/account-realm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as long as :chat is not used later probably no need to execute this query here

src/status_im/data_store/contacts.cljs Outdated Show resolved Hide resolved
src/status_im/data_store/contacts.cljs Outdated Show resolved Hide resolved
src/status_im/contact/db.cljs Outdated Show resolved Hide resolved
@rasom
Copy link
Contributor

rasom commented Dec 22, 2018

We can also simulate some kind of spam attack and check how these changes are useful in that case.

@yenda yenda force-pushed the mvp4-1-block-user branch from bb8b7ed to fd392cf Compare December 22, 2018 12:07
[message-ids]
(-> @core/account-realm
(.objects "messages")
(.filtered (str "(" (core/in-query "message-id" message-ids) ")"))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is query is going to be slower than fetching each separate entry using .objectForPrimaryKey

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll leave that kind of optimization for later this is a mvp and at that point the visible effects of blocking are already applied so perf doesn't matter that much.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i agree, but also i would at least consider adding activity indicator because it took 10s on my slower device to block the user which already has sent 1000 messages.

Copy link
Contributor

@rasom rasom Dec 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6s for removing 6 messages from 7 chats with ~2000 messages in total.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What takes 10s is it the realm part or the whole thing. I would think recomputing the message groups of the affected chats is more expensive. Also this is the MVP of the MVP so I'm not really concerned about slow devices at that point

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

most likely realm, because otherwise, each incoming message would have a similar effect. I doubt that those subs have any serious impact here.

It is 1.2-1.5s on galaxy s9 which is not a slow device, that's when removing messages 6 messages with 6 chats and ~2000 messages in total. A realistic test would require 20-30 chats, 15-20k messages in the realm db and removing dozens of messages from different chats. I suppose it might be up to 2.5-3s.

Well if that's not necessary from UX pov then no problem.

@yenda yenda force-pushed the mvp4-1-block-user branch from fd392cf to b9bac18 Compare December 22, 2018 17:33
@rasom
Copy link
Contributor

rasom commented Dec 23, 2018

In general, what's the goal of this particular PR: to give the user an ability to mute an annoying user or to protect from some kind of dos attacks?

@yenda
Copy link
Contributor Author

yenda commented Dec 23, 2018

@rasom for now it's to block the kind of spam we had a couple of time already with someone posting useless huge messages.

@rasom
Copy link
Contributor

rasom commented Dec 23, 2018

@yenda with the assumption that it will be hard for this person to automate account creation and to send N messages per acc? It's kind of easy thing to implement and in this case, this functionality will be useless. If we just want to introduce user blocking functionality then fine, but we if need spam protection this thing isn't a big obstacle.

@yenda
Copy link
Contributor Author

yenda commented Dec 23, 2018

Yes it's just to block a user

@ghost
Copy link

ghost commented Jan 7, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@ghost ghost added the stale label Jan 7, 2019
Copy link
Contributor

@vitvly vitvly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yenda I've noticed that there is no desktop support yet - is this for future versions of this feature? (desktop's profile screen code hasn't been changed https://github.com/status-im/status-react/blob/b56fd2e29fae97c47a8274449adaa70526665e3b/src/status_im/ui/screens/desktop/main/chat/views.cljs#L348)

@ghost ghost removed the stale label Jan 9, 2019
@yenda
Copy link
Contributor Author

yenda commented Jan 9, 2019

@siphiuel yes it's for a future iteration

@yenda yenda force-pushed the mvp4-1-block-user branch from b9bac18 to 4228713 Compare January 9, 2019 12:18
@yenda yenda force-pushed the mvp4-1-block-user branch from a22e382 to ccd6e9f Compare February 4, 2019 16:29
@churik
Copy link
Member

churik commented Feb 4, 2019

@yenda please rebase to include #7412

@yenda
Copy link
Contributor Author

yenda commented Feb 4, 2019

already done

@statustestbot
Copy link

98% of end-end tests have passed

Total executed tests: 58
Failed tests: 1
Passed tests: 57

Failed tests (1)

Click to expand
1. test_add_contact_from_public_chat

Device 1: Tap on StartNewChatButton
Device 1: Looking for an element by text: 'Poised Unfinished Ibisbill'

ProfileAddressText

Device sessions

Passed tests (57)

Click to expand
1. test_create_account
Device sessions

2. test_user_can_switch_network
Device sessions

3. test_filters_from_daap
Device sessions

4. test_copy_and_paste_messages
Device sessions

5. test_send_transaction_from_daap
Device sessions

6. test_request_and_receive_tokens_in_1_1_chat
Device sessions

7. test_delete_cut_and_paste_messages
Device sessions

8. test_deploy_contract_from_daap
Device sessions

9. test_offline_login
Device sessions

10. test_pass_phrase_validation
Device sessions

11. test_public_chat_messaging
Device sessions

12. test_password_in_logcat_sign_in
Device sessions

13. test_set_profile_picture
Device sessions

14. test_text_message_1_1_chat
Device sessions

15. test_add_to_contacts
Device sessions

16. test_unread_messages_counter_1_1_chat
Device sessions

17. test_logcat_send_transaction_from_daap
Device sessions

18. test_onboarding_screen_when_requesting_tokens_for_new_account
Device sessions

19. test_logcat_send_transaction_from_wallet
Device sessions

20. test_send_token_with_7_decimals
Device sessions

21. test_modify_transaction_fee_values
Device sessions

22. test_token_with_more_than_allowed_decimals
Device sessions

23. test_send_eth_from_wallet_to_address
Device sessions

24. test_send_transaction_details_in_1_1_chat
Device sessions

25. test_manage_assets
Device sessions

26. test_wallet_set_up
Device sessions

27. test_logcat_send_transaction_in_1_1_chat
Device sessions

28. test_request_and_receive_eth_in_1_1_chat
Device sessions

29. test_swipe_to_delete_public_chat
Device sessions

30. test_passphrase_whitespaces_ignored_while_recovering_access
Device sessions

31. test_send_emoji
Device sessions

32. test_add_contact_by_pasting_public_key
Device sessions

33. test_logcat_recovering_account
Device sessions

34. test_messaging_in_different_networks
Device sessions

35. test_send_tokens_in_1_1_chat
Device sessions

36. test_network_mismatch_for_send_request_commands
Device sessions

37. test_logcat_sign_message_from_daap
Device sessions

38. test_swipe_to_delete_1_1_chat
Device sessions

39. test_switch_users_and_add_new_account
Device sessions

40. test_send_stt_from_wallet
Device sessions

41. test_send_eth_in_1_1_chat
Device sessions

42. test_login_with_new_account
Device sessions

43. test_send_eth_from_wallet_to_contact
Device sessions

44. test_send_request_not_enabled_tokens
Device sessions

45. test_send_message_to_newly_added_contact
Device sessions

46. test_password_in_logcat_creating_account
Device sessions

47. test_backup_recovery_phrase
Device sessions

48. test_offline_status
Device sessions

49. test_open_google_com_via_open_dapp
Device sessions

50. test_unread_messages_counter_public_chat
Device sessions

51. test_sign_message_from_daap
Device sessions

52. test_user_can_remove_profile_picture
Device sessions

53. test_share_contact_code_and_wallet_address
Device sessions

54. test_request_eth_in_wallet
Device sessions

55. test_refresh_button_browsing_app_webview
Device sessions

56. test_backup_recovery_phrase_warning_from_wallet
Device sessions

57. test_recover_account
Device sessions

@statustestbot
Copy link

100% of end-end tests have passed

Total executed tests: 1
Failed tests: 0
Passed tests: 1

Passed tests (1)

Click to expand
1. test_add_contact_from_public_chat
Device sessions

@status-im status-im deleted a comment from statustestbot Feb 5, 2019
@status-im status-im deleted a comment from statustestbot Feb 5, 2019
@churik
Copy link
Member

churik commented Feb 5, 2019

@yenda @rachelhamlin
1) if user tap on PN from blocked user it will be redirected to "Unknown" chat, from where you can navigate to Unknown user profile and even add Unknown to Contacts. And if you continue work with this Unknown contact, for example block him -> eventually you will see TypeError: null is not an object error
12345546

123567

2) In public chat: after blocking user and hiding his messages, "No messages" is shown on "Home" screen
home3

3) Can add blocked users to a group chat
But when blocked user will send a message, you will not receive it.
Will add this to known issues for part1 ?

@rachelhamlin
Copy link
Contributor

@churik yes please. I imagine this function is most useful for removing users from public chats at this point, so it's okay to fix 1:1 issues in next iteration.

@churik
Copy link
Member

churik commented Feb 5, 2019

Tested:

  • blocking user which have messages in 1-1, public, group chat -> send messages to all of them and reopening app - no messages are appeared;
  • blocking user from public, 1-1, group info and Contacts screen;
  • send message from blocked contact from different devices;
  • checking that impossible to receive invite to group chat from blocked user -> but user will receive invite when other user will join public chat;
  • changing networks/fleets;
  • checked blocking user and hiding all messages from him if chat has > 24h history
  • blocking user from release 0.9.32;
  • restore account with blocked users and pairing between several devices (no sync for blocked users now) and blocking the same user on each device;
  • add user while it is blocked;
  • PNs from blocked users (known issue);
  • Blocking-unblocking users several times;
  • /send and /request commands
  • upgrade from 0.9.32 with group chat, 1-1, several users in contact list, "Add to contact" in 1-1 - can use blocking feature after upgrade

@churik
Copy link
Member

churik commented Feb 5, 2019

So known behavior for now:

  • no sync of "Blocked users" across devices
  • no desktop support
  • If some user A blocks by User B -> then User B creates a chat and invite User A and User C -> User A will receive an invite after User C will send the first message to a chat
  • if you manually try to add blocked user as a contact after you had chat with him -> you will be redirected to chat with own messages only
  • if you block user from "Blocked contacts" screen -> instead of profile you'll be redirected to Home screen
  • you'll receive PNs from blocked user and if you open it - "Unknown" chat is shown
  • In public chat: after blocking user and hiding his messages, "No messages" is shown on "Home" screen
    home3
  • can add blocked users to a group chat. But when blocked user will send a message, you will not receive it.

@yenda
Copy link
Contributor Author

yenda commented Feb 5, 2019

@churik so we can merge this?
I will prioritize the PN problem, I tried to reproduce the "no messages" in public chat but couldn't, is there further steps to take?

@churik
Copy link
Member

churik commented Feb 5, 2019

@yenda yes, you can merge it!
I can create existing issues to keep track on them with separate label, i.e. "block", would it be helpful?

@yenda
Copy link
Contributor Author

yenda commented Feb 5, 2019

@churik yeah sure but please create them in pivotal as well since we are traking progress there now

- dapp related fields are removed since it is not used anymore
- blocked? field is added for futur block user feature
@yenda yenda force-pushed the mvp4-1-block-user branch from ccd6e9f to 3645f82 Compare February 5, 2019 15:29
- add block/unblock action to user profile
- blocking deletes all messages from user and ignores future messages
- unblocking stops ignoring new messages from user but doesn't recover past ones

[feature] add contact list

[tests] added scroll to BackupRecoveryPhraseButton

[tests] added scroll to public key

Signed-off-by: yenda <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

MVP 4 Block users
10 participants