diff --git a/appinfo/info.xml b/appinfo/info.xml index 803a42acbb..952b62fe75 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -73,13 +73,9 @@ And in the works for the [coming versions](https://github.com/nextcloud/spreed/m OCA\Talk\Migration\FixNamespaceInDatabaseTables - OCA\Talk\Migration\CreateHelpCommand OCA\Talk\Migration\ClearResourceAccessCache OCA\Talk\Migration\CacheUserDisplayNames - - OCA\Talk\Migration\CreateHelpCommand - @@ -89,11 +85,6 @@ And in the works for the [coming versions](https://github.com/nextcloud/spreed/m OCA\Talk\Command\Bot\State OCA\Talk\Command\Bot\Setup OCA\Talk\Command\Bot\Uninstall - OCA\Talk\Command\Command\Add - OCA\Talk\Command\Command\AddSamples - OCA\Talk\Command\Command\Delete - OCA\Talk\Command\Command\ListCommand - OCA\Talk\Command\Command\Update OCA\Talk\Command\Developer\UpdateDocs OCA\Talk\Command\Monitor\Calls OCA\Talk\Command\Monitor\HasActiveCalls diff --git a/appinfo/routes.php b/appinfo/routes.php index be859e962e..3713ff1b20 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -31,7 +31,6 @@ return array_merge_recursive( include(__DIR__ . '/routes/routesCallController.php'), include(__DIR__ . '/routes/routesCertificateController.php'), include(__DIR__ . '/routes/routesChatController.php'), - include(__DIR__ . '/routes/routesCommandController.php'), include(__DIR__ . '/routes/routesFederationController.php'), include(__DIR__ . '/routes/routesFilesIntegrationController.php'), include(__DIR__ . '/routes/routesGuestController.php'), diff --git a/appinfo/routes/routesCommandController.php b/appinfo/routes/routesCommandController.php deleted file mode 100644 index 834032847d..0000000000 --- a/appinfo/routes/routesCommandController.php +++ /dev/null @@ -1,35 +0,0 @@ - - * - * @author Lukas Reschke - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - -$requirements = [ - 'apiVersion' => '(v1)', -]; - -return [ - 'ocs' => [ - /** @see \OCA\Talk\Controller\CommandController::index() */ - ['name' => 'Command#index', 'url' => '/api/{apiVersion}/command', 'verb' => 'GET', 'requirements' => $requirements], - ], -]; diff --git a/docs/commands.md b/docs/commands.md index 629abb682b..9af5115101 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -2,101 +2,4 @@ !!! warning - **Deprecation:** Commands are deprecated in favor of [Bots](bots.md). - ---- - -!!! note - - For security reasons commands can only be added via the - command line. `./occ talk:command:add --help` gives you - a short overview of the required arguments, but they are - explained here in more depth. - ---- - -## "Add command" arguments - -| Argument | Allowed chars | Description | -|------------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `cmd` | [a-z0-9] | The keyword the user has to type to run this command (min. 1, max. 64 characters) | -| `name` | * | The author name of the response that is posted by the command (min. 1, max. 64 characters) | -| `script` | * | Actual command that is being ran. The script must be executable by the user of your webserver and has to use absolute paths only! See the parameter table below for options. The script is invoked with `--help` as argument on set up, to check if it can be executed correctly. | -| `response` | 0-2 | Who should see the response: 0 - No one, 1 - User who executed the command, 2 - Everyone | -| `enabled` | 0-3 | Who can use the command: 0 - No one, 1 - Moderators of the room, 2 - Logged in users, 3 - Everyone | - -## Script parameter - -| Parameter | Description | -|---------------|----------------------------------------------------| -| `{ROOM}` | The token of the room the command was used in | -| `{USER}` | ID of the user that called the command | -| `{ARGUMENTS}` | Everything the user write after the actual command | - -## Example - -### Create `/path/to/calc.sh` - -``` - while test $# -gt 0; do - case "$1" in - --help) - echo "/calc - A Nextcloud Talk chat wrapper for gnome-calculator" - echo " " - echo "Simple equations: /calc 3 + 4 * 5" - echo "Complex equations: /calc sin(3) + 3^3 * sqrt(5)" - exit 0 - ;; - *) - break - ;; - esac - done - - set -f - echo "$@ =" - echo $(gnome-calculator --solve="$@") -``` - -Please note, that your command should also understand the argument `--help`. -It should return a useful description, the first line is also displayed in a list of all commands when the user just types `/help`. - -### Register command - - -Make sure to use the absolute path to your script when registering the command: - -``` -./occ talk:command:add calculator calculator "/path/to/calc.sh {ARGUMENTS} {ROOM} {USER}" 1 3 -``` - -### Explanation -* User input by user `my user id` in the chat of room `index.php/call/4tf349j`: - - ``` - /calculator 1 + 2 + 3 + "hello" - ``` - - -* Executed shell command: - - ``` - /path/to/calc.sh '1 + 2 + 3 + "hello"' '4tf349j' 'my user id' - ``` - -## Aliases - -It is also possible to define an alias for a command. This allows e.g. to get the `/help` command also with the german word `/hilfe`. - -An alias for the `/calculator` command from above could be created using the following command: - -``` -./occ talk:command:add calc calculator "alias:calculator" 1 3 -``` - -Now `/calculator 1 + 2 + 3` and `/calc 1 + 2 + 3` result in the same message. - - -!!! note - - The enabled and response flag of the alias are ignored and the flags of the original command will be used and respected. + **Deprecation:** Commands have been removed in favor of [Bots](bots.md). diff --git a/docs/events.md b/docs/events.md index ea6bd421ec..f71b82fce1 100644 --- a/docs/events.md +++ b/docs/events.md @@ -156,17 +156,6 @@ listen to the `OCA\Talk\Events\SystemMessagesMultipleSentEvent` event instead. * Since: 18.0.0 * Since: 19.0.0 - Method `getParent()` was added -### Deprecated events - -These events were not using the typed-event mechanism and are therefore deprecated and will be removed in a future version. - -#### Command execution for apps - -* Event class: `OCA\Talk\Events\CommandEvent` -* Event name: `OCA\Talk\Chat\Command\Executor::EVENT_APP_EXECUTE` -* Since: 8.0.0 -* Deprecated: 17.0.0 - Commands are deprecated, please migrate to bots instead - ## Other events ### Turn servers get diff --git a/docs/index.md b/docs/index.md index 5d046a66e7..86c9fa97ce 100644 --- a/docs/index.md +++ b/docs/index.md @@ -17,7 +17,6 @@ * [Call experience](call-experience.md) * [Occ commands](occ.md) * [Bots](bot-list.md) -* [Commands (deprecated)](commands.md) * [Matterbridge integration](matterbridge.md) ## Developer documentation diff --git a/docs/occ.md b/docs/occ.md index 04dacdaf01..f6fe0b066e 100644 --- a/docs/occ.md +++ b/docs/occ.md @@ -106,83 +106,6 @@ Uninstall a bot from the server | `--output` | Output format (plain, json or json_pretty, default is plain) | yes | no | no | `'plain'` | | `--url` | The URL of the bot (required when no ID is given, ignored otherwise) | yes | yes | no | *Required* | -## talk:command:add - -Add a new command - -### Usage - -* `talk:command:add [--output [OUTPUT]] [--] - - diff --git a/src/components/MessagesList/MessagesList.vue b/src/components/MessagesList/MessagesList.vue index cb5bb0245b..32063b251d 100644 --- a/src/components/MessagesList/MessagesList.vue +++ b/src/components/MessagesList/MessagesList.vue @@ -499,7 +499,7 @@ export default { return false // Edited messages are not grouped } - if (message1.actorType === ATTENDEE.ACTOR_TYPE.BOTS // Don't group messages of commands and bots + if (message1.actorType === ATTENDEE.ACTOR_TYPE.BOTS // Don't group messages of bots && message1.actorId !== ATTENDEE.CHANGELOG_BOT_ID) { // Apart from the changelog bot return false } diff --git a/src/store/conversationsStore.js b/src/store/conversationsStore.js index a09ebf4e27..1c35d10ae3 100644 --- a/src/store/conversationsStore.js +++ b/src/store/conversationsStore.js @@ -693,8 +693,7 @@ const actions = { /** * Only use the last message as lastMessage when: * 1. It's not a command reply - * 2. It's not a temporary message starting with "/" which is a user posting a command - * 3. It's not a reaction or deletion of a reaction + * 2. It's not a reaction or deletion of a reaction * 3. It's not a deletion of a message */ if ((lastMessage.actorType !== ATTENDEE.ACTOR_TYPE.BOTS @@ -704,10 +703,7 @@ const actions = { && lastMessage.systemMessage !== 'reaction_deleted' && lastMessage.systemMessage !== 'reaction_revoked' && lastMessage.systemMessage !== 'message_deleted' - && lastMessage.systemMessage !== 'message_edited' - && !(typeof lastMessage.id.startsWith === 'function' - && lastMessage.id.startsWith('temp-') - && lastMessage.message.startsWith('/'))) { + && lastMessage.systemMessage !== 'message_edited') { commit('updateConversationLastMessage', { token, lastMessage }) } }, diff --git a/src/store/conversationsStore.spec.js b/src/store/conversationsStore.spec.js index 534252c393..d8038b9097 100644 --- a/src/store/conversationsStore.spec.js +++ b/src/store/conversationsStore.spec.js @@ -1202,28 +1202,6 @@ describe('conversationsStore', () => { const changedConversation = store.getters.conversation(testToken) expect(changedConversation.lastMessage).toBe(testLastMessage) }) - - test('ignore update from temporary if posting a command', () => { - const testLastMessage = { - actorType: 'users', - actorId: 'admin', - systemMessage: '', - id: 'temp-42', - message: '/quit', - } - - testConversation.lastMessage = previousLastMessage - - store.dispatch('addConversation', testConversation) - - store.dispatch('updateConversationLastMessage', { - token: testToken, - lastMessage: testLastMessage, - }) - - const changedConversation = store.getters.conversation(testToken) - expect(changedConversation.lastMessage).toBe(previousLastMessage) - }) }) describe('creating conversations', () => { diff --git a/src/views/AdminSettings.vue b/src/views/AdminSettings.vue index fe686c2f7d..345d39c484 100644 --- a/src/views/AdminSettings.vue +++ b/src/views/AdminSettings.vue @@ -27,7 +27,6 @@ - @@ -43,7 +42,6 @@ import { getCapabilities } from '@nextcloud/capabilities' import AllowedGroups from '../components/AdminSettings/AllowedGroups.vue' import BotsSettings from '../components/AdminSettings/BotsSettings.vue' -import Commands from '../components/AdminSettings/Commands.vue' import Federation from '../components/AdminSettings/Federation.vue' import GeneralSettings from '../components/AdminSettings/GeneralSettings.vue' import HostedSignalingServer from '../components/AdminSettings/HostedSignalingServer.vue' @@ -63,7 +61,6 @@ export default { components: { AllowedGroups, BotsSettings, - Commands, Federation, GeneralSettings, HostedSignalingServer, diff --git a/templates/settings/admin-settings.php b/templates/settings/admin-settings.php index e8a5a911ad..26ebf39523 100644 --- a/templates/settings/admin-settings.php +++ b/templates/settings/admin-settings.php @@ -14,14 +14,6 @@

t('Users that cannot use Talk anymore will still be listed as participants in their previous conversations and also their chat messages will be kept.')); ?>

-
-

t('Commands')) ?>

-

t('Specify commands the users can use in chats')); ?>

- -
-
-
-

t('STUN servers')) ?>

t('A STUN server is used to determine the public IP address of participants behind a router.')); ?>

diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index 0339a1a5d9..b2776efd89 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -1,44 +1,39 @@ - + - BeforeTemplateRenderedEvent - BeforeTemplateRenderedEvent + + - SchemaWrapper + - NullCache + - $guestNames + - \OC_Util + - - - - - - null + - Filesystem + @@ -48,7 +43,7 @@ - $fileId + @@ -56,7 +51,7 @@ tokenProvider]]> tokenProvider]]> tokenProvider]]> - private + @@ -73,30 +68,30 @@ - BeforeTemplateRenderedEvent + - BeforeTemplateRenderedEvent + - Filesystem - \OC_Image + + - $recordingFolder + - Folder + - NoUserException - NoUserException + + @@ -104,20 +99,20 @@ getView()]]> getView()]]> getView()]]> - $view - $view - $view - Filesystem + + + + - Cache + - NoUserException +