-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GH-42] Adds functionality to allows a team admin or system admin to adjust a dynamic team-welcome message #143
base: master
Are you sure you want to change the base?
[GH-42] Adds functionality to allows a team admin or system admin to adjust a dynamic team-welcome message #143
Conversation
…lugin-welcomebot into MM-381
} | ||
} | ||
|
||
return "" | ||
} | ||
|
||
func (p *Plugin) validatePreviewPrivileges(teamID string, args *model.CommandArgs) (bool, error) { | ||
if _, err := p.API.GetTeamMember(teamID, args.UserId); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we use p.client
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ayusht2810 If we use p.client we will lose the access to status code, which is required here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated at other places
@ayusht2810 Fixed the comments added by you |
Note: This PR contains all the changes from #81, we just fixed the review comments and merge conflicts here
Summary
This Pull Request adds new functionality that allows a team admin or system admin to adjust a dynamic team-welcome message. Previously, the only way a team message could be set was to adjust the config.json, and then redeploy the instance of mattermost. This has caused certain team admins over at Platform 1 to seek out a resolution that allows for the dynamic ability to set their team welcome message without adjusting the config.json.
With this new functionality, we have added 3 new slash commands that allow a user with the appropriate credentials to set, get, and delete what we are calling
dynamic team messages
with the following commands:get_team_welcome
- Grabs the stored dynamic team message (if it exists), or retrieves the config.json message set.set_team_welcome [new message]
- Stores internally a new KV pair where the key is the team id joined with the prefix: "teammsg_", and where the value is the message. This does not override the config.json value though.delete_team_welcome
- This deletes the KV pair set for the team without ever touching the config.json message (if it exists).If a dynamic team message is found, then the get call will retrieve that first. If a user ever wanted to resort back to the config.json message, they will just need to delete the dynamic message. All values will defer to the config.json message if no dynamic message is found.
This new functionality also allows appropriate team admins to have access to the above slash commands, rather than permitting only system admins.
Also, on line 115, I fixed a misspelling of the word 'welcome.'
Please let me know if this is the direction you would like to pursue regarding the solution to issue 42! If there is anything that I left out of this PR, I would be more than happy to add that necessary information! Thank you!
Ticket Link
Fixes #42