From 6a91ebdb0c6614004ed4afb33b1164dfd495632e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Jaussoin?= Date: Wed, 28 Oct 2020 19:51:32 +0100 Subject: [PATCH] Improve Bookmarks handling Fix Rooms refresh on edit and addition --- app/widgets/Chat/Chat.php | 13 ++- app/widgets/Rooms/Rooms.php | 9 +- composer.lock | 115 +++++++++---------------- lib/moxl/src/Xec/Payload/Bookmark2.php | 3 +- 4 files changed, 57 insertions(+), 83 deletions(-) diff --git a/app/widgets/Chat/Chat.php b/app/widgets/Chat/Chat.php index 1a5f455fa..27bd7bdb9 100644 --- a/app/widgets/Chat/Chat.php +++ b/app/widgets/Chat/Chat.php @@ -107,10 +107,6 @@ class Chat extends \Movim\Widget\Base return; } - if (!$message->encrypted) { - $this->rpc('Chat.appendMessagesWrapper', $this->prepareMessage($message, $from)); - } - if ($message->file) { $rawbody = (typeIsPicture($message->file['type'])) ? '🖼️ ' . $this->__('chats.picture') @@ -165,12 +161,21 @@ class Chat extends \Movim\Widget\Base $this->route('chat', [$contact->jid, 'room']) ); } elseif ($message->type == 'groupchat') { + if ($conference && $conference->notify == 0) { + $message->seen = true; + $message->save(); + } + $chatStates->clearState($from, $message->resource); } $this->onChatState($chatStates->getState($from)); } + if (!$message->encrypted) { + $this->rpc('Chat.appendMessagesWrapper', $this->prepareMessage($message, $from)); + } + $this->event('chat_counter', $this->user->unreads()); } diff --git a/app/widgets/Rooms/Rooms.php b/app/widgets/Rooms/Rooms.php index 68700e030..da62da047 100644 --- a/app/widgets/Rooms/Rooms.php +++ b/app/widgets/Rooms/Rooms.php @@ -9,7 +9,6 @@ use Movim\Session; use Movim\ChatStates; use Movim\Widget\Base; -use App\PresenceBuffer; use App\Conference; use Respect\Validation\Validator; @@ -111,7 +110,12 @@ class Rooms extends Base } Toast::send($this->__('bookmarks.updated')); - $this->ajaxHttpGet(); + + if ($conference) { + $this->onPresence($conference->conference); + } else { + $this->ajaxHttpGet(); + } } private function setState(string $room, bool $composing) @@ -265,7 +269,6 @@ class Rooms extends Base } // We clear the presences from the buffer cache and then the DB - $pb = PresenceBuffer::getInstance(); $this->user->session->conferences() ->where('conference', $room) ->first()->presences()->delete(); diff --git a/composer.lock b/composer.lock index 7f4cd45b2..7597f23f3 100644 --- a/composer.lock +++ b/composer.lock @@ -910,16 +910,16 @@ }, { "name": "embed/embed", - "version": "v3.4.8", + "version": "v3.4.9", "source": { "type": "git", "url": "https://github.com/oscarotero/Embed.git", - "reference": "96aab555e399769b9d12c3c362a4232563ccbe76" + "reference": "43da4ebcae61f4acf44e1b89436c2912a4b38f60" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/oscarotero/Embed/zipball/96aab555e399769b9d12c3c362a4232563ccbe76", - "reference": "96aab555e399769b9d12c3c362a4232563ccbe76", + "url": "https://api.github.com/repos/oscarotero/Embed/zipball/43da4ebcae61f4acf44e1b89436c2912a4b38f60", + "reference": "43da4ebcae61f4acf44e1b89436c2912a4b38f60", "shasum": "" }, "require": { @@ -960,7 +960,7 @@ "opengraph", "twitter cards" ], - "time": "2020-07-03T15:04:01+00:00" + "time": "2020-10-27T21:42:10+00:00" }, { "name": "evenement/evenement", @@ -3161,16 +3161,16 @@ }, { "name": "symfony/config", - "version": "v5.1.7", + "version": "v5.1.8", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "6ad8be6e1280f6734150d8a04a9160dd34ceb191" + "reference": "11baeefa4c179d6908655a7b6be728f62367c193" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/6ad8be6e1280f6734150d8a04a9160dd34ceb191", - "reference": "6ad8be6e1280f6734150d8a04a9160dd34ceb191", + "url": "https://api.github.com/repos/symfony/config/zipball/11baeefa4c179d6908655a7b6be728f62367c193", + "reference": "11baeefa4c179d6908655a7b6be728f62367c193", "shasum": "" }, "require": { @@ -3194,11 +3194,6 @@ "symfony/yaml": "To use the yaml reference dumper" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Config\\": "" @@ -3237,20 +3232,20 @@ "type": "tidelift" } ], - "time": "2020-09-02T16:23:27+00:00" + "time": "2020-10-24T12:01:57+00:00" }, { "name": "symfony/console", - "version": "v5.1.7", + "version": "v5.1.8", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "ae789a8a2ad189ce7e8216942cdb9b77319f5eb8" + "reference": "e0b2c29c0fa6a69089209bbe8fcff4df2a313d0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/ae789a8a2ad189ce7e8216942cdb9b77319f5eb8", - "reference": "ae789a8a2ad189ce7e8216942cdb9b77319f5eb8", + "url": "https://api.github.com/repos/symfony/console/zipball/e0b2c29c0fa6a69089209bbe8fcff4df2a313d0e", + "reference": "e0b2c29c0fa6a69089209bbe8fcff4df2a313d0e", "shasum": "" }, "require": { @@ -3287,11 +3282,6 @@ "symfony/process": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Console\\": "" @@ -3330,7 +3320,7 @@ "type": "tidelift" } ], - "time": "2020-09-18T14:27:32+00:00" + "time": "2020-10-24T12:01:57+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3398,16 +3388,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.1.7", + "version": "v5.1.8", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "1a8697545a8d87b9f2f6b1d32414199cc5e20aae" + "reference": "df08650ea7aee2d925380069c131a66124d79177" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/1a8697545a8d87b9f2f6b1d32414199cc5e20aae", - "reference": "1a8697545a8d87b9f2f6b1d32414199cc5e20aae", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/df08650ea7aee2d925380069c131a66124d79177", + "reference": "df08650ea7aee2d925380069c131a66124d79177", "shasum": "" }, "require": { @@ -3415,11 +3405,6 @@ "symfony/polyfill-ctype": "~1.8" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Filesystem\\": "" @@ -3458,20 +3443,20 @@ "type": "tidelift" } ], - "time": "2020-09-27T14:02:37+00:00" + "time": "2020-10-24T12:01:57+00:00" }, { "name": "symfony/http-foundation", - "version": "v5.1.7", + "version": "v5.1.8", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "353b42e7b4fd1c898aab09a059466c9cea74039b" + "reference": "a2860ec970404b0233ab1e59e0568d3277d32b6f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/353b42e7b4fd1c898aab09a059466c9cea74039b", - "reference": "353b42e7b4fd1c898aab09a059466c9cea74039b", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/a2860ec970404b0233ab1e59e0568d3277d32b6f", + "reference": "a2860ec970404b0233ab1e59e0568d3277d32b6f", "shasum": "" }, "require": { @@ -3490,11 +3475,6 @@ "symfony/mime": "To use the file extension guesser" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\HttpFoundation\\": "" @@ -3533,7 +3513,7 @@ "type": "tidelift" } ], - "time": "2020-09-27T14:14:57+00:00" + "time": "2020-10-24T12:01:57+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4005,16 +3985,16 @@ }, { "name": "symfony/routing", - "version": "v5.1.7", + "version": "v5.1.8", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "720348c2ae011f8c56964c0fc3e992840cb60ccf" + "reference": "d6ceee2a37b61b41079005207bf37746d1bfe71f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/720348c2ae011f8c56964c0fc3e992840cb60ccf", - "reference": "720348c2ae011f8c56964c0fc3e992840cb60ccf", + "url": "https://api.github.com/repos/symfony/routing/zipball/d6ceee2a37b61b41079005207bf37746d1bfe71f", + "reference": "d6ceee2a37b61b41079005207bf37746d1bfe71f", "shasum": "" }, "require": { @@ -4044,11 +4024,6 @@ "symfony/yaml": "For using the YAML loader" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Routing\\": "" @@ -4093,7 +4068,7 @@ "type": "tidelift" } ], - "time": "2020-10-02T13:05:43+00:00" + "time": "2020-10-24T12:01:57+00:00" }, { "name": "symfony/service-contracts", @@ -4173,16 +4148,16 @@ }, { "name": "symfony/string", - "version": "v5.1.7", + "version": "v5.1.8", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "4a9afe9d07bac506f75bcee8ed3ce76da5a9343e" + "reference": "a97573e960303db71be0dd8fda9be3bca5e0feea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/4a9afe9d07bac506f75bcee8ed3ce76da5a9343e", - "reference": "4a9afe9d07bac506f75bcee8ed3ce76da5a9343e", + "url": "https://api.github.com/repos/symfony/string/zipball/a97573e960303db71be0dd8fda9be3bca5e0feea", + "reference": "a97573e960303db71be0dd8fda9be3bca5e0feea", "shasum": "" }, "require": { @@ -4200,11 +4175,6 @@ "symfony/var-exporter": "^4.4|^5.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\String\\": "" @@ -4254,20 +4224,20 @@ "type": "tidelift" } ], - "time": "2020-09-15T12:23:47+00:00" + "time": "2020-10-24T12:01:57+00:00" }, { "name": "symfony/translation", - "version": "v5.1.7", + "version": "v5.1.8", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "e3cdd5119b1b5bf0698c351b8ee20fb5a4ea248b" + "reference": "27980838fd261e04379fa91e94e81e662fe5a1b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/e3cdd5119b1b5bf0698c351b8ee20fb5a4ea248b", - "reference": "e3cdd5119b1b5bf0698c351b8ee20fb5a4ea248b", + "url": "https://api.github.com/repos/symfony/translation/zipball/27980838fd261e04379fa91e94e81e662fe5a1b6", + "reference": "27980838fd261e04379fa91e94e81e662fe5a1b6", "shasum": "" }, "require": { @@ -4303,11 +4273,6 @@ "symfony/yaml": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Translation\\": "" @@ -4346,7 +4311,7 @@ "type": "tidelift" } ], - "time": "2020-09-27T03:44:28+00:00" + "time": "2020-10-24T12:01:57+00:00" }, { "name": "symfony/translation-contracts", diff --git a/lib/moxl/src/Xec/Payload/Bookmark2.php b/lib/moxl/src/Xec/Payload/Bookmark2.php index b14c0dc7d..5f3f54973 100644 --- a/lib/moxl/src/Xec/Payload/Bookmark2.php +++ b/lib/moxl/src/Xec/Payload/Bookmark2.php @@ -8,7 +8,8 @@ class Bookmark2 extends Payload { public function handle($stanza, $parent = false) { - if (current(explode('/', (string)$parent->attributes()->from)) != \App\User::me()->id) return; + if (current(explode('/', (string)$parent->attributes()->from)) != \App\User::me()->id + || (string)$parent->attributes()->from == (string)$parent->attributes()->to) return; if ($stanza->items->retract) { \App\User::me()->session