* Fix initialism errors

* Fix check-mocks test

* Revert mlog and filestore packages

* Update plugin_hooks_test.go

* Update opentracinglayer.go

* Regenerate mocks and check store layers

* Revert plugin's context changes

* Update context.go

* Update plugin_requests.go

* Update plugin_hooks_test.go

* Regenerate mocks

* Regenerate mocks and store layers

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Haardik Dharma
2021-04-03 12:43:22 +05:30
коммит произвёл GitHub
родитель db01f2a91b
Коммит 343c51830f
49 изменённых файлов: 1542 добавлений и 1542 удалений

Просмотреть файл

@@ -6,17 +6,17 @@ package plugin_api_tests
import "reflect"
type BasicConfig struct {
BasicChannelId string
BasicChannelID string
BasicChannelName string
BasicPostId string
BasicPostID string
BasicPostMessage string
BasicTeamDisplayName string
BasicTeamId string
BasicTeamID string
BasicTeamName string
BasicUser2Email string
BasicUser2Id string
BasicUserEmail string
BasicUserId string
BasicUserID string
}
func IsEmpty(object interface{}) bool {

Просмотреть файл

@@ -23,14 +23,14 @@ func (p *MyPlugin) OnConfigurationChange() error {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
channels, err := p.API.GetChannelsForTeamForUser(p.configuration.BasicTeamId, p.configuration.BasicUserId, false)
channels, err := p.API.GetChannelsForTeamForUser(p.configuration.BasicTeamID, p.configuration.BasicUserID, false)
if err != nil {
return nil, err.Error()
}
if len(channels) != 3 {
return nil, "Returned invalid number of channels"
}
channels, err = p.API.GetChannelsForTeamForUser("invalidid", p.configuration.BasicUserId, false)
channels, err = p.API.GetChannelsForTeamForUser("invalidid", p.configuration.BasicUserID, false)
if err == nil {
return nil, "Expected to get an error while retrieving channels for invalid id"
}

Просмотреть файл

@@ -22,7 +22,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
}
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
dm1, err := p.API.GetDirectChannel(p.configuration.BasicUserId, p.configuration.BasicUser2Id)
dm1, err := p.API.GetDirectChannel(p.configuration.BasicUserID, p.configuration.BasicUser2Id)
if err != nil {
return nil, err.Error()
}
@@ -30,7 +30,7 @@ func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model
return nil, "dm1 is empty"
}
dm2, err := p.API.GetDirectChannel(p.configuration.BasicUserId, p.configuration.BasicUserId)
dm2, err := p.API.GetDirectChannel(p.configuration.BasicUserID, p.configuration.BasicUserID)
if err != nil {
return nil, err.Error()
}
@@ -38,7 +38,7 @@ func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model
return nil, "dm2 is empty"
}
dm3, err := p.API.GetDirectChannel(p.configuration.BasicUserId, model.NewId())
dm3, err := p.API.GetDirectChannel(p.configuration.BasicUserID, model.NewId())
if err == nil {
return nil, "Expected to get error while fetching incorrect channel"
}

Просмотреть файл

@@ -24,7 +24,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
// check existing user first
data, err := p.API.GetProfileImage(p.configuration.BasicUserId)
data, err := p.API.GetProfileImage(p.configuration.BasicUserID)
if err != nil {
return nil, err.Error()
}

Просмотреть файл

@@ -22,13 +22,13 @@ func (p *MyPlugin) OnConfigurationChange() error {
}
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
channelMembers, err := p.API.GetChannelMembersForUser(p.configuration.BasicTeamId, p.configuration.BasicUserId, 0, 10)
channelMembers, err := p.API.GetChannelMembersForUser(p.configuration.BasicTeamID, p.configuration.BasicUserID, 0, 10)
if err != nil {
return nil, err.Error() + "failed to get channel members"
} else if len(channelMembers) != 3 {
return nil, "Invalid number of channel members"
} else if channelMembers[0].UserId != p.configuration.BasicUserId {
} else if channelMembers[0].UserId != p.configuration.BasicUserID {
return nil, "Invalid user id returned"
}

Просмотреть файл

@@ -22,12 +22,12 @@ func (p *MyPlugin) OnConfigurationChange() error {
}
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
teamMembers, err := p.API.GetTeamMembersForUser(p.configuration.BasicUserId, 0, 10)
teamMembers, err := p.API.GetTeamMembersForUser(p.configuration.BasicUserID, 0, 10)
if err != nil {
return nil, err.Error() + "failed to get team members"
} else if len(teamMembers) != 1 {
return nil, "Invalid number of team members"
} else if teamMembers[0].UserId != p.configuration.BasicUserId || teamMembers[0].TeamId != p.configuration.BasicTeamId {
} else if teamMembers[0].UserId != p.configuration.BasicUserID || teamMembers[0].TeamId != p.configuration.BasicTeamID {
return nil, "Invalid user or team id returned"
}
return nil, "OK"

Просмотреть файл

@@ -23,7 +23,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
channels, err := p.API.SearchChannels(p.configuration.BasicTeamId, p.configuration.BasicChannelName)
channels, err := p.API.SearchChannels(p.configuration.BasicTeamID, p.configuration.BasicChannelName)
if err != nil {
return nil, err.Error()
}

Просмотреть файл

@@ -32,25 +32,25 @@ func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model
}{
{
"nil params",
p.configuration.BasicTeamId,
p.configuration.BasicTeamID,
nil,
0,
},
{
"empty params",
p.configuration.BasicTeamId,
p.configuration.BasicTeamID,
[]*model.SearchParams{},
0,
},
{
"doesn't match any posts",
p.configuration.BasicTeamId,
p.configuration.BasicTeamID,
model.ParseSearchParams("bad message", 0),
0,
},
{
"matched posts",
p.configuration.BasicTeamId,
p.configuration.BasicTeamID,
model.ParseSearchParams(p.configuration.BasicPostMessage, 0),
1,
},

Просмотреть файл

@@ -41,12 +41,12 @@ func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model
dataBytes := buf.Bytes()
// Set the user profile image
if err := p.API.SetProfileImage(p.configuration.BasicUserId, dataBytes); err != nil {
if err := p.API.SetProfileImage(p.configuration.BasicUserID, dataBytes); err != nil {
return nil, err.Error()
}
// Get the user profile image to check
imageProfile, err := p.API.GetProfileImage(p.configuration.BasicUserId)
imageProfile, err := p.API.GetProfileImage(p.configuration.BasicUserID)
if err != nil {
return nil, err.Error()
}

Просмотреть файл

@@ -22,7 +22,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
}
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
uid := p.configuration.BasicUserId
uid := p.configuration.BasicUserID
if err := p.API.UpdateUserActive(uid, true); err != nil {
return nil, err.Error()
}

Просмотреть файл

@@ -24,7 +24,7 @@ func (p *MyPlugin) OnConfigurationChange() error {
}
func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) {
uid := p.configuration.BasicUserId
uid := p.configuration.BasicUserID
statuses := []string{model.STATUS_ONLINE, model.STATUS_AWAY, model.STATUS_DND, model.STATUS_OFFLINE}