Skip to content

[MM-382] Add feature to use struct fields in the channel welcome message#130

Open
ayusht2810 wants to merge 2 commits into
masterfrom
MM-382
Open

[MM-382] Add feature to use struct fields in the channel welcome message#130
ayusht2810 wants to merge 2 commits into
masterfrom
MM-382

Conversation

@ayusht2810

@ayusht2810 ayusht2810 commented Apr 16, 2024

Copy link
Copy Markdown
Contributor

Summary

  • Added feature to use struct fields in the channel welcome message
  • Updated readme regarding the above feature

Screenshot

image

Ticket Link

Fixes #96
Fixes #55

What to test?

  • Create a welcome message for a channel while using struct fields (eg: {{.UserDisplayName}}
  • Join the channel in which welcome message is created
  • Check for the words replaced by the struct fields

Checklist

  • Completed dev testing
  • make test Ran test cases and ensured they are passing
  • make check-style Ran style check and ensured both webapp and server pass the checks

@ayusht2810
ayusht2810 requested a review from mickmister as a code owner April 16, 2024 10:16
@ayusht2810 ayusht2810 self-assigned this Apr 16, 2024
@ayusht2810 ayusht2810 added the 2: Dev Review Requires review by a core committer label Apr 16, 2024
Comment thread README.md Outdated
Comment thread README.md
Comment thread server/welcomebot.go Outdated
Comment thread server/welcomebot.go Outdated
Comment thread server/welcomebot.go
Comment on lines +66 to +76
if len(channelID) > 0 {
data.Channel, err = p.API.GetChannel(channelID)
if err != nil {
p.API.LogError("failed to query channel", "ChannelID", channelID)
return nil
}
}

data.UserDisplayName = data.User.GetDisplayName(model.ShowNicknameFullName)

return data

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it the case that channelID will always be provided and non-empty? Is it the case that this function must return a fully populated ChannelMessageTemplate?

If that's the case, we should return an error if necessary passed in data is not available. Not sure about the situation here though

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it is not necessary to pass the channel ID here. Also, the function doesn't need to return a fully populated ChannelMessageTemplate.

@ayusht2810 ayusht2810 added the 3: QA Review Requires review by a QA tester label Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't use {{.UserDisplayName}} in channel welcome message Allow mentioning user in the channel welcome messages

3 participants