Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
RocketChat
Rocket.Chat.ReactNative
Commits
4a63cb01
Unverified
Commit
4a63cb01
authored
Feb 14, 2020
by
Diego Mello
Committed by
GitHub
Feb 14, 2020
Browse files
[FIX] Delete slash commands (#1723)
parent
f1bf2bb2
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/lib/methods/getSlashCommands.js
View file @
4a63cb01
...
...
@@ -28,6 +28,8 @@ export default function() {
// filter slash commands
let
slashCommandsToCreate
=
commands
.
filter
(
i1
=>
!
allSlashCommandsRecords
.
find
(
i2
=>
i1
.
command
===
i2
.
id
));
let
slashCommandsToUpdate
=
allSlashCommandsRecords
.
filter
(
i1
=>
commands
.
find
(
i2
=>
i1
.
id
===
i2
.
command
));
let
slashCommandsToDelete
=
allSlashCommandsRecords
.
filter
(
i1
=>
!
slashCommandsToCreate
.
find
(
i2
=>
i2
.
command
===
i1
.
id
)
&&
!
slashCommandsToUpdate
.
find
(
i2
=>
i2
.
id
===
i1
.
id
));
// Create
slashCommandsToCreate
=
slashCommandsToCreate
.
map
(
command
=>
slashCommandsCollection
.
prepareCreate
(
protectedFunction
((
s
)
=>
{
...
...
@@ -43,9 +45,13 @@ export default function() {
}));
});
// Delete
slashCommandsToDelete
=
slashCommandsToDelete
.
map
(
command
=>
command
.
prepareDestroyPermanently
());
const
allRecords
=
[
...
slashCommandsToCreate
,
...
slashCommandsToUpdate
...
slashCommandsToUpdate
,
...
slashCommandsToDelete
];
try
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment