Slash command autocomplete data is filtered based on the user's role and command's specified role. However, the default value of the empty string is not handled in Mattermost server code, thus causing such a slash command to never be displayed for a system user.
RoleID./ in the message box to bring up the list of auto complete slash command suggestions. Notice that your slash command is not in the list.Slash command autocomplete data with no role specified should be assumed to be for the system user role. It should only be required to specify a role when the developer needs to restrict it.
Slash command autocomplete data with no role specified works only for system admins, not for system users.
In the function getSuggestions() at this line -
we check if roleID == "", instead we should be checking for command.RoleID == "". The current check of roleID == "" will never succeed because at this line -
we always set it to something, so it can never be empty string.
I am able to reproduce this. @amyblais, can you confirm if this is a valid issue so I can fix this?
@haardikdharma10 I haven't tested it but it sounds like a valid issue. Would you like me to assign this to you?
Yes, sounds good:)
Ticket for reference: https://mattermost.atlassian.net/browse/MM-31625