[GH-42] Adds functionality to allows a team admin or system admin to adjust a dynamic team-welcome message#143
Open
raghavaggarwal2308 wants to merge 19 commits into
Open
Conversation
…lugin-welcomebot into MM-381
Closed
ayusht2810
reviewed
Jul 25, 2024
| } | ||
|
|
||
| func (p *Plugin) validatePreviewPrivileges(teamID string, args *model.CommandArgs) (bool, error) { | ||
| if _, err := p.API.GetTeamMember(teamID, args.UserId); err != nil { |
Contributor
There was a problem hiding this comment.
can't we use p.client here?
Author
There was a problem hiding this comment.
@ayusht2810 If we use p.client we will lose the access to status code, which is required here
Author
There was a problem hiding this comment.
Updated at other places
Author
|
@ayusht2810 Fixed the comments added by you |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 messageswith 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