Repository navigation
[MIM-2278] Add auto-unarchive broadcast functionality for inbox messages - #4610
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4610 +/- ##
==========================================
+ Coverage 86.03% 86.08% +0.04%
==========================================
Files 563 563
Lines 33752 33773 +21
==========================================
+ Hits 29039 29072 +33
+ Misses 4713 4701 -12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| Children = build_entry_result_elements(Props, CurrentTS), | ||
| X = #xmlel{name = <<"x">>, | ||
| attrs = #{<<"xmlns">> => ?NS_ESL_INBOX_CONVERSATION, | ||
| <<"jid">> => RemoteBareJidBin}, | ||
| children = Children}, | ||
| Msg = #xmlel{name = <<"message">>, | ||
| attrs = #{<<"id">> => mongoose_bin:gen_from_timestamp()}, | ||
| children = [X]}, |
There was a problem hiding this comment.
Maybe mod_inbox_entries:forward_result could be reused somehow here?
There was a problem hiding this comment.
This is not addressed, we may avoid some code duplication here.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
chrzaszcz
left a comment
There was a problem hiding this comment.
Looks good in general. I added some minor suggestions.
| Children = build_entry_result_elements(Props, CurrentTS), | ||
| X = #xmlel{name = <<"x">>, | ||
| attrs = #{<<"xmlns">> => ?NS_ESL_INBOX_CONVERSATION, | ||
| <<"jid">> => RemoteBareJidBin}, | ||
| children = Children}, | ||
| Msg = #xmlel{name = <<"message">>, | ||
| attrs = #{<<"id">> => mongoose_bin:gen_from_timestamp()}, | ||
| children = [X]}, |
0524aec to
c4420fb
Compare
This comment was marked as outdated.
This comment was marked as outdated.
| {Broadcast, ChatMessage} = | ||
| case is_broadcast_stanza(Stanza1) of | ||
| true -> {Stanza1, Stanza2}; | ||
| false -> {Stanza2, Stanza1} | ||
| end, |
There was a problem hiding this comment.
Whole point of using escalus:assert_many is to avoid this part and incorporate the lines below into the predicates provided to the assert_many.
This comment was marked as outdated.
This comment was marked as outdated.
c163597 to
c75b5f3
Compare
This comment was marked as outdated.
This comment was marked as outdated.
c75b5f3 to
9ed6215
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
CircleCI results for d45bce7 elasticsearch_and_cassandra_28 / elasticsearch_and_cassandra_mnesia / d45bce7 small_tests_28 / small_tests / d45bce7 small_tests_27 / small_tests / d45bce7 small_tests_28_arm64 / small_tests / d45bce7 ldap_mnesia_27 / ldap_mnesia / d45bce7 ldap_mnesia_28 / ldap_mnesia / d45bce7 dynamic_domains_pgsql_mnesia_27 / pgsql_mnesia / d45bce7 dynamic_domains_mysql_redis_28 / mysql_redis / d45bce7 rdbms_SUITE:global_rdbms_queries:test_failed_wrapper_transaction{error,{{assertEqual,[{module,rdbms_SUITE},
{line,589},
{expression,"rpc ( mim ( ) , meck , history , [ supervisor ] )"},
{expected,[]},
{value,[{<10570.91517.0>,
{supervisor,count_children,[<10570.42956.0>]},
[{specs,1},
{active,0},
{supervisors,0},
{workers,0}]},
{<10570.91517.0>,
{supervisor,count_children,[<10570.42957.0>]},
[{specs,1},
{active,0},
{supervisors,0},
{workers,0}]},
{<10570.91517.0>,
{supervisor,count_children,[<10570.42958.0>]},
[{specs,1},
{active,0},
{supervisors,0},
{workers,0}]},
{<10570.91517.0>,
{supervisor,count_children,[<10570.42959.0>]},
[{specs,1},
{active,0},
{supervisors,0},
{workers,0}]},
{<10570.91517.0>,
{supervisor,count_children,[<10570.42960.0>]},
[{specs,1},
{active,0},
{supervisors,0},
{workers,0}]},
{<10570.91517.0>,
{supervisor,count_children,[<10570.42961.0>]},
[{specs,1},
{active,0},
{supervisors,0},
{workers,0}]},
...dynamic_domains_pgsql_mnesia_28 / pgsql_mnesia / d45bce7 internal_mnesia_28 / internal_mnesia / d45bce7 pgsql_mnesia_27 / pgsql_mnesia / d45bce7 cockroachdb_cets_28 / cockroachdb_cets / d45bce7 pubsub_SUITE:dag+last_item_cache:send_last_published_item_no_items_test{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"alice_send_last_published_item_no_items_test_3679@localhost/res1">>,
escalus_tcp,<0.115546.0>,
[{event_manager,<0.115535.0>},
{server,<<"localhost">>},
{username,
<<"alicE_send_last_published_item_no_items_test_3679">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.115535.0>},
{server,<<"localhost">>},
{username,
<<"alicE_send_last_published_item_no_items_test_3679">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,
<<"alice_send_last_published_item_no_items_test_3679">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,fun escalus_auth:auth_plain/2},
{wspath,undefined},
{username,
<<"alicE_send_last_published_item_no_items_test_3679">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"a9f1eed8308c9750">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,444}]},
{pubsub_tools,receive_and_c...pubsub_SUITE:dag+last_item_cache:send_last_published_item_no_items_test{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"alice_send_last_published_item_no_items_test_3682@localhost/res1">>,
escalus_tcp,<0.115623.0>,
[{event_manager,<0.115612.0>},
{server,<<"localhost">>},
{username,
<<"alicE_send_last_published_item_no_items_test_3682">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.115612.0>},
{server,<<"localhost">>},
{username,
<<"alicE_send_last_published_item_no_items_test_3682">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,
<<"alice_send_last_published_item_no_items_test_3682">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,fun escalus_auth:auth_plain/2},
{wspath,undefined},
{username,
<<"alicE_send_last_published_item_no_items_test_3682">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"c4f67f0fb587a380">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,444}]},
{pubsub_tools,receive_and_c...mysql_redis_28 / mysql_redis / d45bce7 acc_e2e_SUITE:message:one_message{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,<<"bob_one_message_18@localhost/res1">>,escalus_tcp,
<0.892.0>,
[{event_manager,<0.890.0>},
{server,<<"localhost">>},
{username,<<"bOb_one_message_18">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.890.0>},
{server,<<"localhost">>},
{username,<<"bOb_one_message_18">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,<<"bob_one_message_18">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,fun escalus_auth:auth_plain/2},
{wspath,undefined},
{username,<<"bOb_one_message_18">>},
{server,<<"localhost">>},
{password,<<"makrolika">>},
{stream_id,<<"082c2e852c656cf7">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{acc_e2e_SUITE,'-one_message/1-fun-0-',2,
[{file,
"/home/circleci/project/big_tests/tests/acc_e2e_SUITE.erl"},
{line,124}]},
{escalus_story,story,4,
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_story.erl"},
{line,75}]},
{test_server,ts_tc,3,[{file,"test_server.erl"},{line,1796}]},
{test_serve...pgsql_mnesia_28 / pgsql_mnesia / d45bce7 pgsql_cets_28 / pgsql_cets / d45bce7 |
d45bce7 to
c63b1d0
Compare
|
CircleCI results for c63b1d0 elasticsearch_and_cassandra_28 / elasticsearch_and_cassandra_mnesia / c63b1d0 small_tests_27 / small_tests / c63b1d0 small_tests_28 / small_tests / c63b1d0 small_tests_28_arm64 / small_tests / c63b1d0 ldap_mnesia_27 / ldap_mnesia / c63b1d0 ldap_mnesia_28 / ldap_mnesia / c63b1d0 dynamic_domains_pgsql_mnesia_27 / pgsql_mnesia / c63b1d0 dynamic_domains_mysql_redis_28 / mysql_redis / c63b1d0 internal_mnesia_28 / internal_mnesia / c63b1d0 dynamic_domains_pgsql_mnesia_28 / pgsql_mnesia / c63b1d0 pgsql_cets_28 / pgsql_cets / c63b1d0 cockroachdb_cets_28 / cockroachdb_cets / c63b1d0 pubsub_SUITE:dag+last_item_cache:send_last_published_item_no_items_test{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"alice_send_last_published_item_no_items_test_3672@localhost/res1">>,
escalus_tcp,<0.115536.0>,
[{event_manager,<0.115533.0>},
{server,<<"localhost">>},
{username,
<<"alicE_send_last_published_item_no_items_test_3672">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.115533.0>},
{server,<<"localhost">>},
{username,
<<"alicE_send_last_published_item_no_items_test_3672">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,
<<"alice_send_last_published_item_no_items_test_3672">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,fun escalus_auth:auth_plain/2},
{wspath,undefined},
{username,
<<"alicE_send_last_published_item_no_items_test_3672">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"08a0f1c05343ead2">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,444}]},
{pubsub_tools,receive_and_c...pgsql_mnesia_28 / pgsql_mnesia / c63b1d0 pgsql_mnesia_27 / pgsql_mnesia / c63b1d0 mysql_redis_28 / mysql_redis / c63b1d0 |
chrzaszcz
left a comment
There was a problem hiding this comment.
Looks good. I only found a very minor thing.
|
CircleCI results for 2cc8b52 elasticsearch_and_cassandra_28 / elasticsearch_and_cassandra_mnesia / 2cc8b52 small_tests_27 / small_tests / 2cc8b52 small_tests_28 / small_tests / 2cc8b52 small_tests_28_arm64 / small_tests / 2cc8b52 ldap_mnesia_27 / ldap_mnesia / 2cc8b52 ldap_mnesia_28 / ldap_mnesia / 2cc8b52 dynamic_domains_pgsql_mnesia_27 / pgsql_mnesia / 2cc8b52 internal_mnesia_28 / internal_mnesia / 2cc8b52 pgsql_cets_28 / pgsql_cets / 2cc8b52 dynamic_domains_pgsql_mnesia_28 / pgsql_mnesia / 2cc8b52 dynamic_domains_mysql_redis_28 / mysql_redis / 2cc8b52 cockroachdb_cets_28 / cockroachdb_cets / 2cc8b52 pubsub_SUITE:dag+basic:request_all_items_test{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,<<"alice_request_all_items_test_3664@localhost/res1">>,
escalus_tcp,<0.114719.0>,
[{event_manager,<0.114632.0>},
{server,<<"localhost">>},
{username,<<"alicE_request_all_items_test_3664">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.114632.0>},
{server,<<"localhost">>},
{username,<<"alicE_request_all_items_test_3664">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,<<"alice_request_all_items_test_3664">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,fun escalus_auth:auth_plain/2},
{wspath,undefined},
{username,<<"alicE_request_all_items_test_3664">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"6fadecd9a5da6b4b">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,444}]},
{pubsub_tools,receive_and_check_response,4,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,435}]},
{pubsub_SUITE,'-request_all_it...pubsub_SUITE:dag+basic:subscribe_unsubscribe_test{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"alice_subscribe_unsubscribe_test_3654@localhost/res1">>,
escalus_tcp,<0.114716.0>,
[{event_manager,<0.114539.0>},
{server,<<"localhost">>},
{username,<<"alicE_subscribe_unsubscribe_test_3654">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.114539.0>},
{server,<<"localhost">>},
{username,<<"alicE_subscribe_unsubscribe_test_3654">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,<<"alice_subscribe_unsubscribe_test_3654">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,fun escalus_auth:auth_plain/2},
{wspath,undefined},
{username,<<"alicE_subscribe_unsubscribe_test_3654">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"11a58a77717842a1">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,444}]},
{pubsub_tools,receive_and_check_response,4,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,435}]},
...pubsub_SUITE:dag+node_affiliations:deny_no_owner_test{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,<<"alice_deny_no_owner_test_3705@localhost/res1">>,
escalus_tcp,<0.115658.0>,
[{event_manager,<0.115647.0>},
{server,<<"localhost">>},
{username,<<"alicE_deny_no_owner_test_3705">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.115647.0>},
{server,<<"localhost">>},
{username,<<"alicE_deny_no_owner_test_3705">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,<<"alice_deny_no_owner_test_3705">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,fun escalus_auth:auth_plain/2},
{wspath,undefined},
{username,<<"alicE_deny_no_owner_test_3705">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"a43578b8833c9971">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,444}]},
{pubsub_tools,receive_and_check_response,4,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,435}]},
{escalus_story,story,4,
[{file,
"...pubsub_SUITE:dag+last_item_cache:send_last_published_item_no_items_test{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"alice_send_last_published_item_no_items_test_3740@localhost/res1">>,
escalus_tcp,<0.116451.0>,
[{event_manager,<0.116449.0>},
{server,<<"localhost">>},
{username,
<<"alicE_send_last_published_item_no_items_test_3740">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.116449.0>},
{server,<<"localhost">>},
{username,
<<"alicE_send_last_published_item_no_items_test_3740">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,
<<"alice_send_last_published_item_no_items_test_3740">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,fun escalus_auth:auth_plain/2},
{wspath,undefined},
{username,
<<"alicE_send_last_published_item_no_items_test_3740">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"549fcb1a8e9289f8">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,444}]},
{pubsub_tools,receive_and_c...pubsub_SUITE:tree+last_item_cache:send_last_published_item_no_items_test{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"alice_send_last_published_item_no_items_test_3793@localhost/res1">>,
escalus_tcp,<0.117733.0>,
[{event_manager,<0.117714.0>},
{server,<<"localhost">>},
{username,
<<"alicE_send_last_published_item_no_items_test_3793">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.117714.0>},
{server,<<"localhost">>},
{username,
<<"alicE_send_last_published_item_no_items_test_3793">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,
<<"alice_send_last_published_item_no_items_test_3793">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,fun escalus_auth:auth_plain/2},
{wspath,undefined},
{username,
<<"alicE_send_last_published_item_no_items_test_3793">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"b660a7b9e6cb97f7">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,444}]},
{pubsub_tools,receive_and_c...pubsub_SUITE:tree+last_item_cache:send_last_published_item_no_items_test{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"alice_send_last_published_item_no_items_test_3797@localhost/res1">>,
escalus_tcp,<0.117810.0>,
[{event_manager,<0.117800.0>},
{server,<<"localhost">>},
{username,
<<"alicE_send_last_published_item_no_items_test_3797">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.117800.0>},
{server,<<"localhost">>},
{username,
<<"alicE_send_last_published_item_no_items_test_3797">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,
<<"alice_send_last_published_item_no_items_test_3797">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,fun escalus_auth:auth_plain/2},
{wspath,undefined},
{username,
<<"alicE_send_last_published_item_no_items_test_3797">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"788ac274f4168553">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,444}]},
{pubsub_tools,receive_and_c...pubsub_SUITE:tree+last_item_cache:send_last_published_item_no_items_test{error,
{timeout_when_waiting_for_stanza,
[{escalus_client,wait_for_stanza,
[{client,
<<"alice_send_last_published_item_no_items_test_3801@localhost/res1">>,
escalus_tcp,<0.117889.0>,
[{event_manager,<0.117887.0>},
{server,<<"localhost">>},
{username,
<<"alicE_send_last_published_item_no_items_test_3801">>},
{resource,<<"res1">>}],
[{event_client,
[{event_manager,<0.117887.0>},
{server,<<"localhost">>},
{username,
<<"alicE_send_last_published_item_no_items_test_3801">>},
{resource,<<"res1">>}]},
{resource,<<"res1">>},
{username,
<<"alice_send_last_published_item_no_items_test_3801">>},
{server,<<"localhost">>},
{host,<<"localhost">>},
{port,5222},
{auth,fun escalus_auth:auth_plain/2},
{wspath,undefined},
{username,
<<"alicE_send_last_published_item_no_items_test_3801">>},
{server,<<"localhost">>},
{password,<<"matygrysa">>},
{stream_id,<<"47a25184828151f0">>}]},
5000],
[{file,
"/home/circleci/project/big_tests/_build/default/lib/escalus/src/escalus_client.erl"},
{line,136}]},
{pubsub_tools,receive_response,3,
[{file,"/home/circleci/project/big_tests/tests/pubsub_tools.erl"},
{line,444}]},
{pubsub_tools,receive_and_c...pgsql_mnesia_27 / pgsql_mnesia / 2cc8b52 mysql_redis_28 / mysql_redis / 2cc8b52 pgsql_mnesia_28 / pgsql_mnesia / 2cc8b52 |
Problem
When an archived conversation received a new message, it moved to inbox in the DB, but connected clients didn't receive an immediate update. This caused UI desyncs where conversations remained hidden/archived until a manual refresh.
Solution
Detect when a message write forces a conversation from archive to inbox. When this happens, broadcast an inbox update stanza () to the user, syncing the new box state and unread_count immediately.