Skip to content
This repository has been archived by the owner on Apr 7, 2023. It is now read-only.

chat:removeSuggestion does not allow re-adding the same command #33

Open
captain828 opened this issue Sep 24, 2018 · 0 comments
Open

chat:removeSuggestion does not allow re-adding the same command #33

captain828 opened this issue Sep 24, 2018 · 0 comments

Comments

@captain828
Copy link

As seen here:

ON_SUGGESTION_REMOVE({ name }) {
if(this.removedSuggestions.indexOf(name) <= -1) {
this.removedSuggestions.push(name);
}
},

and here:
computed: {
suggestions() {
return this.backingSuggestions.filter((el) => this.removedSuggestions.indexOf(el.name) <= -1);
},
},

this method actually blacklists a chat command suggestion, it doesn't remove it as mentioned in the docs: https://docs.fivem.net/events/client-events/#chat-events-resource-events

So once the chat:removeSuggestion method is called, trying to re-add the same suggestion later basically does nothing as there is a check to avoid adding the same suggestion back (since it was never removed from the this.backingSuggestions array).

This case prevents being able to set up "context sensitive" suggestions based on some state.

I would recommend one of the following:

  • rename the current method to something more akin to what it's currently doing (blacklist?) and add a chat:removeSuggestion that would work as described in the docs
  • change the current method to work as described in the docs

IMHO, I don't think anyone has a need for "blacklisting" a chat command so I would go with the second option.

Let me know what you think.

Happy to make a PR once we agree on something.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant