Revert "Fix initialism errors (PR-3) (#17062)" (#17202)

This reverts commit ea61458f16. This was causing panic in the plugins because the client and the plugin API changed with this PR
Этот коммит содержится в:
Mario de Frutos Dieguez
2021-03-23 10:32:54 +01:00
коммит произвёл GitHub
родитель 26b86cb3ef
Коммит c0971970e9
26 изменённых файлов: 1146 добавлений и 1146 удалений

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

@@ -62,7 +62,7 @@ func (api *API) InitGroup() {
// GET /api/v4/users/:user_id/groups?page=0&per_page=100
api.BaseRoutes.Users.Handle("/{user_id:[A-Za-z0-9]+}/groups",
api.ApiSessionRequired(getGroupsByUserID)).Methods("GET")
api.ApiSessionRequired(getGroupsByUserId)).Methods("GET")
// GET /api/v4/channels/:channel_id/groups?page=0&per_page=100
api.BaseRoutes.Channels.Handle("/{channel_id:[A-Za-z0-9]+}/groups",
@@ -569,7 +569,7 @@ func getGroupStats(c *Context, w http.ResponseWriter, r *http.Request) {
w.Write(b)
}
func getGroupsByUserID(c *Context, w http.ResponseWriter, r *http.Request) {
func getGroupsByUserId(c *Context, w http.ResponseWriter, r *http.Request) {
c.RequireUserId()
if c.Err != nil {
return
@@ -585,7 +585,7 @@ func getGroupsByUserID(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
groups, err := c.App.GetGroupsByUserID(c.Params.UserId)
groups, err := c.App.GetGroupsByUserId(c.Params.UserId)
if err != nil {
c.Err = err
return

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

@@ -963,7 +963,7 @@ func TestGetGroups(t *testing.T) {
assert.Equal(t, groups[0].Id, th.Group.Id)
}
func TestGetGroupsByUserID(t *testing.T) {
func TestGetGroupsByUserId(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()

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

@@ -93,7 +93,7 @@ type AppIface interface {
//
DefaultChannelNames() []string
// DeleteBotIconImage deletes LHS icon for a bot.
DeleteBotIconImage(botUserID string) *model.AppError
DeleteBotIconImage(botUserId string) *model.AppError
// DeleteChannelScheme deletes a channels scheme and sets its SchemeId to nil.
DeleteChannelScheme(channel *model.Channel) (*model.Channel, *model.AppError)
// DeleteGroupConstrainedMemberships deletes team and channel memberships of users who aren't members of the allowed
@@ -137,9 +137,9 @@ type AppIface interface {
// filter.
GetAllLdapGroupsPage(page int, perPage int, opts model.LdapGroupSearchOpts) ([]*model.Group, int, *model.AppError)
// GetBot returns the given bot.
GetBot(botUserID string, includeDeleted bool) (*model.Bot, *model.AppError)
GetBot(botUserId string, includeDeleted bool) (*model.Bot, *model.AppError)
// GetBotIconImage retrieves LHS icon for a bot.
GetBotIconImage(botUserID string) ([]byte, *model.AppError)
GetBotIconImage(botUserId string) ([]byte, *model.AppError)
// GetBots returns the requested page of bots.
GetBots(options *model.BotGetOptions) (model.BotList, *model.AppError)
// GetChannelGroupUsers returns the users who are associated to the channel via GroupChannels and GroupMembers.
@@ -243,7 +243,7 @@ type AppIface interface {
// so that it points to the URL (relative) of the emoji - static if emoji is default, /api if custom.
OverrideIconURLIfEmoji(post *model.Post)
// PatchBot applies the given patch to the bot and corresponding user.
PatchBot(botUserID string, botPatch *model.BotPatch) (*model.Bot, *model.AppError)
PatchBot(botUserId string, botPatch *model.BotPatch) (*model.Bot, *model.AppError)
// PatchChannelModerationsForChannel Updates a channels scheme roles based on a given ChannelModerationPatch, if the permissions match the higher scoped role the scheme is deleted.
PatchChannelModerationsForChannel(channel *model.Channel, channelModerationsPatch []*model.ChannelModerationPatch) ([]*model.ChannelModeration, *model.AppError)
// Perform an HTTP POST request to an integration's action endpoint.
@@ -251,7 +251,7 @@ type AppIface interface {
// For internal requests, requests are routed directly to a plugin ServerHTTP hook
DoActionRequest(rawURL string, body []byte) (*http.Response, *model.AppError)
// PermanentDeleteBot permanently deletes a bot and its corresponding user.
PermanentDeleteBot(botUserID string) *model.AppError
PermanentDeleteBot(botUserId string) *model.AppError
// PromoteGuestToUser Convert user's roles and all his mermbership's roles from
// guest roles to regular user roles.
PromoteGuestToUser(user *model.User, requestorId string) *model.AppError
@@ -285,9 +285,9 @@ type AppIface interface {
// SessionIsRegistered determines if a specific session has been registered
SessionIsRegistered(session model.Session) bool
// SetBotIconImage sets LHS icon for a bot.
SetBotIconImage(botUserID string, file io.ReadSeeker) *model.AppError
SetBotIconImage(botUserId string, file io.ReadSeeker) *model.AppError
// SetBotIconImageFromMultiPartFile sets LHS icon for a bot.
SetBotIconImageFromMultiPartFile(botUserID string, imageData *multipart.FileHeader) *model.AppError
SetBotIconImageFromMultiPartFile(botUserId string, imageData *multipart.FileHeader) *model.AppError
// SetSessionExpireInDays sets the session's expiry the specified number of days
// relative to either the session creation date or the current time, depending
// on the `ExtendSessionOnActivity` config setting.
@@ -320,9 +320,9 @@ type AppIface interface {
// This to be used for places we check the users password when they are already logged in
DoubleCheckPassword(user *model.User, password string) *model.AppError
// UpdateBotActive marks a bot as active or inactive, along with its corresponding user.
UpdateBotActive(botUserID string, active bool) (*model.Bot, *model.AppError)
UpdateBotActive(botUserId string, active bool) (*model.Bot, *model.AppError)
// UpdateBotOwner changes a bot's owner to the given value.
UpdateBotOwner(botUserID, newOwnerID string) (*model.Bot, *model.AppError)
UpdateBotOwner(botUserId, newOwnerId string) (*model.Bot, *model.AppError)
// UpdateChannel updates a given channel by its Id. It also publishes the CHANNEL_UPDATED event.
UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError)
// UpdateChannelScheme saves the new SchemeId of the channel passed.
@@ -500,7 +500,7 @@ type AppIface interface {
DoPostActionWithCookie(postID, actionId, userID, selectedOption string, cookie *model.PostActionCookie) (string, *model.AppError)
DoSystemConsoleRolesCreationMigration()
DoUploadFile(now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, *model.AppError)
DoUploadFileExpectModification(now time.Time, rawTeamID string, rawChannelID string, rawUserID string, rawFilename string, data []byte) (*model.FileInfo, []byte, *model.AppError)
DoUploadFileExpectModification(now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, []byte, *model.AppError)
DownloadFromURL(downloadURL string) ([]byte, error)
EnableUserAccessToken(token *model.UserAccessToken) *model.AppError
EnvironmentConfig() map[string]interface{}
@@ -595,7 +595,7 @@ type AppIface interface {
GetGroupsByChannel(channelID string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, int, *model.AppError)
GetGroupsByIDs(groupIDs []string) ([]*model.Group, *model.AppError)
GetGroupsBySource(groupSource model.GroupSource) ([]*model.Group, *model.AppError)
GetGroupsByUserID(userID string) ([]*model.Group, *model.AppError)
GetGroupsByUserId(userID string) ([]*model.Group, *model.AppError)
GetHubForUserId(userID string) *Hub
GetIncomingWebhook(hookID string) (*model.IncomingWebhook, *model.AppError)
GetIncomingWebhooksForTeamPage(teamID string, page, perPage int) ([]*model.IncomingWebhook, *model.AppError)

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

@@ -21,7 +21,7 @@ func TestCheckIfRolesGrantPermission(t *testing.T) {
cases := []struct {
roles []string
permissionID string
permissionId string
shouldGrant bool
}{
{[]string{model.SYSTEM_ADMIN_ROLE_ID}, model.PERMISSION_MANAGE_SYSTEM.Id, true},
@@ -35,7 +35,7 @@ func TestCheckIfRolesGrantPermission(t *testing.T) {
}
for _, testcase := range cases {
require.Equal(t, th.App.RolesGrantPermission(testcase.roles, testcase.permissionID), testcase.shouldGrant)
require.Equal(t, th.App.RolesGrantPermission(testcase.roles, testcase.permissionId), testcase.shouldGrant)
}
}

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

@@ -149,15 +149,15 @@ func (a *App) getOrCreateWarnMetricsBot(botDef *model.Bot) (*model.Bot, *model.A
}
// PatchBot applies the given patch to the bot and corresponding user.
func (a *App) PatchBot(botUserID string, botPatch *model.BotPatch) (*model.Bot, *model.AppError) {
bot, err := a.GetBot(botUserID, true)
func (a *App) PatchBot(botUserId string, botPatch *model.BotPatch) (*model.Bot, *model.AppError) {
bot, err := a.GetBot(botUserId, true)
if err != nil {
return nil, err
}
bot.Patch(botPatch)
user, nErr := a.Srv().Store.User().Get(context.Background(), botUserID)
user, nErr := a.Srv().Store.User().Get(context.Background(), botUserId)
if nErr != nil {
var nfErr *store.ErrNotFound
switch {
@@ -209,8 +209,8 @@ func (a *App) PatchBot(botUserID string, botPatch *model.BotPatch) (*model.Bot,
}
// GetBot returns the given bot.
func (a *App) GetBot(botUserID string, includeDeleted bool) (*model.Bot, *model.AppError) {
bot, err := a.Srv().Store.Bot().Get(botUserID, includeDeleted)
func (a *App) GetBot(botUserId string, includeDeleted bool) (*model.Bot, *model.AppError) {
bot, err := a.Srv().Store.Bot().Get(botUserId, includeDeleted)
if err != nil {
var nfErr *store.ErrNotFound
switch {
@@ -233,8 +233,8 @@ func (a *App) GetBots(options *model.BotGetOptions) (model.BotList, *model.AppEr
}
// UpdateBotActive marks a bot as active or inactive, along with its corresponding user.
func (a *App) UpdateBotActive(botUserID string, active bool) (*model.Bot, *model.AppError) {
user, nErr := a.Srv().Store.User().Get(context.Background(), botUserID)
func (a *App) UpdateBotActive(botUserId string, active bool) (*model.Bot, *model.AppError) {
user, nErr := a.Srv().Store.User().Get(context.Background(), botUserId)
if nErr != nil {
var nfErr *store.ErrNotFound
switch {
@@ -249,7 +249,7 @@ func (a *App) UpdateBotActive(botUserID string, active bool) (*model.Bot, *model
return nil, err
}
bot, nErr := a.Srv().Store.Bot().Get(botUserID, true)
bot, nErr := a.Srv().Store.Bot().Get(botUserId, true)
if nErr != nil {
var nfErr *store.ErrNotFound
switch {
@@ -289,8 +289,8 @@ func (a *App) UpdateBotActive(botUserID string, active bool) (*model.Bot, *model
}
// PermanentDeleteBot permanently deletes a bot and its corresponding user.
func (a *App) PermanentDeleteBot(botUserID string) *model.AppError {
if err := a.Srv().Store.Bot().PermanentDelete(botUserID); err != nil {
func (a *App) PermanentDeleteBot(botUserId string) *model.AppError {
if err := a.Srv().Store.Bot().PermanentDelete(botUserId); err != nil {
var invErr *store.ErrInvalidInput
switch {
case errors.As(err, &invErr):
@@ -300,7 +300,7 @@ func (a *App) PermanentDeleteBot(botUserID string) *model.AppError {
}
}
if err := a.Srv().Store.User().PermanentDelete(botUserID); err != nil {
if err := a.Srv().Store.User().PermanentDelete(botUserId); err != nil {
return model.NewAppError("PermanentDeleteBot", "app.user.permanent_delete.app_error", nil, err.Error(), http.StatusInternalServerError)
}
@@ -308,8 +308,8 @@ func (a *App) PermanentDeleteBot(botUserID string) *model.AppError {
}
// UpdateBotOwner changes a bot's owner to the given value.
func (a *App) UpdateBotOwner(botUserID, newOwnerID string) (*model.Bot, *model.AppError) {
bot, err := a.Srv().Store.Bot().Get(botUserID, true)
func (a *App) UpdateBotOwner(botUserId, newOwnerId string) (*model.Bot, *model.AppError) {
bot, err := a.Srv().Store.Bot().Get(botUserId, true)
if err != nil {
var nfErr *store.ErrNotFound
switch {
@@ -320,7 +320,7 @@ func (a *App) UpdateBotOwner(botUserID, newOwnerID string) (*model.Bot, *model.A
}
}
bot.OwnerId = newOwnerID
bot.OwnerId = newOwnerId
bot, err = a.Srv().Store.Bot().Update(bot)
if err != nil {
@@ -500,7 +500,7 @@ func (a *App) ConvertUserToBot(user *model.User) (*model.Bot, *model.AppError) {
}
// SetBotIconImageFromMultiPartFile sets LHS icon for a bot.
func (a *App) SetBotIconImageFromMultiPartFile(botUserID string, imageData *multipart.FileHeader) *model.AppError {
func (a *App) SetBotIconImageFromMultiPartFile(botUserId string, imageData *multipart.FileHeader) *model.AppError {
file, err := imageData.Open()
if err != nil {
return model.NewAppError("SetBotIconImage", "api.bot.set_bot_icon_image.open.app_error", nil, err.Error(), http.StatusBadRequest)
@@ -508,12 +508,12 @@ func (a *App) SetBotIconImageFromMultiPartFile(botUserID string, imageData *mult
defer file.Close()
file.Seek(0, 0)
return a.SetBotIconImage(botUserID, file)
return a.SetBotIconImage(botUserId, file)
}
// SetBotIconImage sets LHS icon for a bot.
func (a *App) SetBotIconImage(botUserID string, file io.ReadSeeker) *model.AppError {
bot, err := a.GetBot(botUserID, true)
func (a *App) SetBotIconImage(botUserId string, file io.ReadSeeker) *model.AppError {
bot, err := a.GetBot(botUserId, true)
if err != nil {
return err
}
@@ -524,7 +524,7 @@ func (a *App) SetBotIconImage(botUserID string, file io.ReadSeeker) *model.AppEr
// Set icon
file.Seek(0, 0)
if _, err = a.WriteFile(file, getBotIconPath(botUserID)); err != nil {
if _, err = a.WriteFile(file, getBotIconPath(botUserId)); err != nil {
return model.NewAppError("SetBotIconImage", "api.bot.set_bot_icon_image.app_error", nil, err.Error(), http.StatusInternalServerError)
}
@@ -541,24 +541,24 @@ func (a *App) SetBotIconImage(botUserID string, file io.ReadSeeker) *model.AppEr
return model.NewAppError("SetBotIconImage", "app.bot.patchbot.internal_error", nil, err.Error(), http.StatusInternalServerError)
}
}
a.invalidateUserCacheAndPublish(botUserID)
a.invalidateUserCacheAndPublish(botUserId)
return nil
}
// DeleteBotIconImage deletes LHS icon for a bot.
func (a *App) DeleteBotIconImage(botUserID string) *model.AppError {
bot, err := a.GetBot(botUserID, true)
func (a *App) DeleteBotIconImage(botUserId string) *model.AppError {
bot, err := a.GetBot(botUserId, true)
if err != nil {
return err
}
// Delete icon
if err = a.RemoveFile(getBotIconPath(botUserID)); err != nil {
if err = a.RemoveFile(getBotIconPath(botUserId)); err != nil {
return model.NewAppError("DeleteBotIconImage", "api.bot.delete_bot_icon_image.app_error", nil, err.Error(), http.StatusInternalServerError)
}
if nErr := a.Srv().Store.User().UpdateLastPictureUpdate(botUserID); nErr != nil {
if nErr := a.Srv().Store.User().UpdateLastPictureUpdate(botUserId); nErr != nil {
mlog.Warn(nErr.Error())
}
@@ -576,18 +576,18 @@ func (a *App) DeleteBotIconImage(botUserID string) *model.AppError {
}
}
a.invalidateUserCacheAndPublish(botUserID)
a.invalidateUserCacheAndPublish(botUserId)
return nil
}
// GetBotIconImage retrieves LHS icon for a bot.
func (a *App) GetBotIconImage(botUserID string) ([]byte, *model.AppError) {
if _, err := a.GetBot(botUserID, true); err != nil {
func (a *App) GetBotIconImage(botUserId string) ([]byte, *model.AppError) {
if _, err := a.GetBot(botUserId, true); err != nil {
return nil, err
}
data, err := a.ReadFile(getBotIconPath(botUserID))
data, err := a.ReadFile(getBotIconPath(botUserId))
if err != nil {
return nil, model.NewAppError("GetBotIconImage", "api.bot.get_bot_icon_image.read.app_error", nil, err.Error(), http.StatusNotFound)
}
@@ -595,6 +595,6 @@ func (a *App) GetBotIconImage(botUserID string) ([]byte, *model.AppError) {
return data, nil
}
func getBotIconPath(botUserID string) string {
return fmt.Sprintf("bots/%v/icon.svg", botUserID)
func getBotIconPath(botUserId string) string {
return fmt.Sprintf("bots/%v/icon.svg", botUserId)
}

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

@@ -273,13 +273,13 @@ func TestGetBots(t *testing.T) {
th := Setup(t)
defer th.TearDown()
OwnerID1 := model.NewId()
OwnerID2 := model.NewId()
OwnerId1 := model.NewId()
OwnerId2 := model.NewId()
bot1, err := th.App.CreateBot(&model.Bot{
Username: "username",
Description: "a bot",
OwnerId: OwnerID1,
OwnerId: OwnerId1,
})
require.Nil(t, err)
defer th.App.PermanentDeleteBot(bot1.UserId)
@@ -287,7 +287,7 @@ func TestGetBots(t *testing.T) {
deletedBot1, err := th.App.CreateBot(&model.Bot{
Username: "username4",
Description: "a deleted bot",
OwnerId: OwnerID1,
OwnerId: OwnerId1,
})
require.Nil(t, err)
deletedBot1, err = th.App.UpdateBotActive(deletedBot1.UserId, false)
@@ -297,7 +297,7 @@ func TestGetBots(t *testing.T) {
bot2, err := th.App.CreateBot(&model.Bot{
Username: "username2",
Description: "a second bot",
OwnerId: OwnerID1,
OwnerId: OwnerId1,
})
require.Nil(t, err)
defer th.App.PermanentDeleteBot(bot2.UserId)
@@ -305,7 +305,7 @@ func TestGetBots(t *testing.T) {
bot3, err := th.App.CreateBot(&model.Bot{
Username: "username3",
Description: "a third bot",
OwnerId: OwnerID1,
OwnerId: OwnerId1,
})
require.Nil(t, err)
defer th.App.PermanentDeleteBot(bot3.UserId)
@@ -313,7 +313,7 @@ func TestGetBots(t *testing.T) {
bot4, err := th.App.CreateBot(&model.Bot{
Username: "username5",
Description: "a fourth bot",
OwnerId: OwnerID2,
OwnerId: OwnerId2,
})
require.Nil(t, err)
defer th.App.PermanentDeleteBot(bot4.UserId)
@@ -321,7 +321,7 @@ func TestGetBots(t *testing.T) {
deletedBot2, err := th.App.CreateBot(&model.Bot{
Username: "username6",
Description: "a deleted bot",
OwnerId: OwnerID2,
OwnerId: OwnerId2,
})
require.Nil(t, err)
deletedBot2, err = th.App.UpdateBotActive(deletedBot2.UserId, false)
@@ -420,7 +420,7 @@ func TestGetBots(t *testing.T) {
bots, err := th.App.GetBots(&model.BotGetOptions{
Page: 0,
PerPage: 10,
OwnerId: OwnerID1,
OwnerId: OwnerId1,
IncludeDeleted: false,
})
require.Nil(t, err)
@@ -431,7 +431,7 @@ func TestGetBots(t *testing.T) {
bots, err := th.App.GetBots(&model.BotGetOptions{
Page: 0,
PerPage: 10,
OwnerId: OwnerID2,
OwnerId: OwnerId2,
IncludeDeleted: false,
})
require.Nil(t, err)
@@ -442,7 +442,7 @@ func TestGetBots(t *testing.T) {
bots, err := th.App.GetBots(&model.BotGetOptions{
Page: 0,
PerPage: 10,
OwnerId: OwnerID1,
OwnerId: OwnerId1,
IncludeDeleted: true,
})
require.Nil(t, err)
@@ -453,7 +453,7 @@ func TestGetBots(t *testing.T) {
bots, err := th.App.GetBots(&model.BotGetOptions{
Page: 0,
PerPage: 10,
OwnerId: OwnerID2,
OwnerId: OwnerId2,
IncludeDeleted: true,
})
require.Nil(t, err)
@@ -525,8 +525,8 @@ func TestDisableUserBots(t *testing.T) {
th := Setup(t)
defer th.TearDown()
OwnerID1 := model.NewId()
OwnerID2 := model.NewId()
ownerId1 := model.NewId()
ownerId2 := model.NewId()
bots := []*model.Bot{}
defer func() {
@@ -539,7 +539,7 @@ func TestDisableUserBots(t *testing.T) {
bot, err := th.App.CreateBot(&model.Bot{
Username: fmt.Sprintf("username%v", i),
Description: "a bot",
OwnerId: OwnerID1,
OwnerId: ownerId1,
})
require.Nil(t, err)
bots = append(bots, bot)
@@ -549,12 +549,12 @@ func TestDisableUserBots(t *testing.T) {
u2bot1, err := th.App.CreateBot(&model.Bot{
Username: "username_nodisable",
Description: "a bot",
OwnerId: OwnerID2,
OwnerId: ownerId2,
})
require.Nil(t, err)
defer th.App.PermanentDeleteBot(u2bot1.UserId)
err = th.App.disableUserBots(OwnerID1)
err = th.App.disableUserBots(ownerId1)
require.Nil(t, err)
// Check all bots and corrensponding users are disabled for creator 1

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

@@ -158,12 +158,12 @@ func (a *App) muteChannelsForUpdatedCategories(userID string, updatedCategories
return result
}
updatedCategoriesByID := makeCategoryMap(updatedCategories)
originalCategoriesByID := makeCategoryMap(originalCategories)
updatedCategoriesById := makeCategoryMap(updatedCategories)
originalCategoriesById := makeCategoryMap(originalCategories)
for channelID, diff := range channelsDiff {
fromCategory := originalCategoriesByID[diff.fromCategoryID]
toCategory := updatedCategoriesByID[diff.toCategoryID]
fromCategory := originalCategoriesById[diff.fromCategoryId]
toCategory := updatedCategoriesById[diff.toCategoryId]
if toCategory.Muted && !fromCategory.Muted {
channelsToMute = append(channelsToMute, channelID)
@@ -197,8 +197,8 @@ func (a *App) muteChannelsForUpdatedCategories(userID string, updatedCategories
}
type categoryChannelDiff struct {
fromCategoryID string
toCategoryID string
fromCategoryId string
toCategoryId string
}
func diffChannelsBetweenCategories(updatedCategories []*model.SidebarCategoryWithChannels, originalCategories []*model.SidebarCategoryWithChannels) map[string]*categoryChannelDiff {
@@ -220,11 +220,11 @@ func diffChannelsBetweenCategories(updatedCategories []*model.SidebarCategoryWit
// Check for any channels that have changed categories. Note that we don't worry about any channels that have moved
// outside of these categories since that heavily complicates things and doesn't currently happen in our apps.
channelsDiff := make(map[string]*categoryChannelDiff)
for channelID, originalCategoryID := range originalChannelIdsMap {
updatedCategoryID := updatedChannelIdsMap[channelID]
for channelID, originalCategoryId := range originalChannelIdsMap {
updatedCategoryId := updatedChannelIdsMap[channelID]
if originalCategoryID != updatedCategoryID && updatedCategoryID != "" {
channelsDiff[channelID] = &categoryChannelDiff{originalCategoryID, updatedCategoryID}
if originalCategoryId != updatedCategoryId && updatedCategoryId != "" {
channelsDiff[channelID] = &categoryChannelDiff{originalCategoryId, updatedCategoryId}
}
}

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

@@ -588,20 +588,20 @@ func TestDiffChannelsBetweenCategories(t *testing.T) {
t,
map[string]*categoryChannelDiff{
"channel1": {
fromCategoryID: "category1",
toCategoryID: "category3",
fromCategoryId: "category1",
toCategoryId: "category3",
},
"channel2": {
fromCategoryID: "category1",
toCategoryID: "category2",
fromCategoryId: "category1",
toCategoryId: "category2",
},
"channel3": {
fromCategoryID: "category1",
toCategoryID: "category3",
fromCategoryId: "category1",
toCategoryId: "category3",
},
"channel4": {
fromCategoryID: "category2",
toCategoryID: "category3",
fromCategoryId: "category2",
toCategoryId: "category3",
},
},
channelsDiff,
@@ -649,8 +649,8 @@ func TestDiffChannelsBetweenCategories(t *testing.T) {
t,
map[string]*categoryChannelDiff{
"channel3": {
fromCategoryID: "category2",
toCategoryID: "category1",
fromCategoryId: "category2",
toCategoryId: "category1",
},
},
channelsDiff,

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

@@ -266,8 +266,8 @@ func TestJoinDefaultChannelsCreatesChannelMemberHistoryRecordTownSquare(t *testi
// figure out the initial number of users in town square
channel, err := th.App.Srv().Store.Channel().GetByName(th.BasicTeam.Id, "town-square", true)
require.NoError(t, err)
townSquareChannelID := channel.Id
users, nErr := th.App.Srv().Store.ChannelMemberHistory().GetUsersInChannelDuring(model.GetMillis()-100, model.GetMillis()+100, townSquareChannelID)
townSquareChannelId := channel.Id
users, nErr := th.App.Srv().Store.ChannelMemberHistory().GetUsersInChannelDuring(model.GetMillis()-100, model.GetMillis()+100, townSquareChannelId)
require.NoError(t, nErr)
initialNumTownSquareUsers := len(users)
@@ -276,13 +276,13 @@ func TestJoinDefaultChannelsCreatesChannelMemberHistoryRecordTownSquare(t *testi
th.App.JoinDefaultChannels(th.BasicTeam.Id, user, false, "")
// there should be a ChannelMemberHistory record for the user
histories, nErr := th.App.Srv().Store.ChannelMemberHistory().GetUsersInChannelDuring(model.GetMillis()-100, model.GetMillis()+100, townSquareChannelID)
histories, nErr := th.App.Srv().Store.ChannelMemberHistory().GetUsersInChannelDuring(model.GetMillis()-100, model.GetMillis()+100, townSquareChannelId)
require.NoError(t, nErr)
assert.Len(t, histories, initialNumTownSquareUsers+1)
found := false
for _, history := range histories {
if user.Id == history.UserId && townSquareChannelID == history.ChannelId {
if user.Id == history.UserId && townSquareChannelId == history.ChannelId {
found = true
break
}
@@ -297,8 +297,8 @@ func TestJoinDefaultChannelsCreatesChannelMemberHistoryRecordOffTopic(t *testing
// figure out the initial number of users in off-topic
channel, err := th.App.Srv().Store.Channel().GetByName(th.BasicTeam.Id, "off-topic", true)
require.NoError(t, err)
offTopicChannelID := channel.Id
users, nErr := th.App.Srv().Store.ChannelMemberHistory().GetUsersInChannelDuring(model.GetMillis()-100, model.GetMillis()+100, offTopicChannelID)
offTopicChannelId := channel.Id
users, nErr := th.App.Srv().Store.ChannelMemberHistory().GetUsersInChannelDuring(model.GetMillis()-100, model.GetMillis()+100, offTopicChannelId)
require.NoError(t, nErr)
initialNumTownSquareUsers := len(users)
@@ -307,13 +307,13 @@ func TestJoinDefaultChannelsCreatesChannelMemberHistoryRecordOffTopic(t *testing
th.App.JoinDefaultChannels(th.BasicTeam.Id, user, false, "")
// there should be a ChannelMemberHistory record for the user
histories, nErr := th.App.Srv().Store.ChannelMemberHistory().GetUsersInChannelDuring(model.GetMillis()-100, model.GetMillis()+100, offTopicChannelID)
histories, nErr := th.App.Srv().Store.ChannelMemberHistory().GetUsersInChannelDuring(model.GetMillis()-100, model.GetMillis()+100, offTopicChannelId)
require.NoError(t, nErr)
assert.Len(t, histories, initialNumTownSquareUsers+1)
found := false
for _, history := range histories {
if user.Id == history.UserId && offTopicChannelID == history.ChannelId {
if user.Id == history.UserId && offTopicChannelId == history.ChannelId {
found = true
break
}
@@ -440,15 +440,15 @@ func TestCreateDirectChannelCreatesChannelMemberHistoryRecord(t *testing.T) {
require.NoError(t, nErr)
assert.Len(t, histories, 2)
historyID0 := histories[0].UserId
historyID1 := histories[1].UserId
switch historyID0 {
historyId0 := histories[0].UserId
historyId1 := histories[1].UserId
switch historyId0 {
case user1.Id:
assert.Equal(t, user2.Id, historyID1)
assert.Equal(t, user2.Id, historyId1)
case user2.Id:
assert.Equal(t, user1.Id, historyID1)
assert.Equal(t, user1.Id, historyId1)
default:
require.Fail(t, "Unexpected user id in ChannelMemberHistory table", historyID0)
require.Fail(t, "Unexpected user id in ChannelMemberHistory table", historyId0)
}
}
@@ -468,15 +468,15 @@ func TestGetDirectChannelCreatesChannelMemberHistoryRecord(t *testing.T) {
require.NoError(t, nErr)
assert.Len(t, histories, 2)
historyID0 := histories[0].UserId
historyID1 := histories[1].UserId
switch historyID0 {
historyId0 := histories[0].UserId
historyId1 := histories[1].UserId
switch historyId0 {
case user1.Id:
assert.Equal(t, user2.Id, historyID1)
assert.Equal(t, user2.Id, historyId1)
case user2.Id:
assert.Equal(t, user1.Id, historyID1)
assert.Equal(t, user1.Id, historyId1)
default:
require.Fail(t, "Unexpected user id in ChannelMemberHistory table", historyID0)
require.Fail(t, "Unexpected user id in ChannelMemberHistory table", historyId0)
}
}
@@ -581,9 +581,9 @@ func TestAddChannelMemberNoUserRequestor(t *testing.T) {
groupUserIds = append(groupUserIds, user.Id)
channel := th.createChannel(th.BasicTeam, model.CHANNEL_OPEN)
userRequestorID := ""
postRootID := ""
_, err = th.App.AddChannelMember(user.Id, channel, userRequestorID, postRootID)
userRequestorId := ""
postRootId := ""
_, err = th.App.AddChannelMember(user.Id, channel, userRequestorId, postRootId)
require.Nil(t, err, "Failed to add user to channel.")
// there should be a ChannelMemberHistory record for the user
@@ -692,11 +692,11 @@ func TestFillInChannelProps(t *testing.T) {
require.Nil(t, err)
defer th.App.PermanentDeleteChannel(channelPrivate)
otherTeamID := model.NewId()
otherTeamId := model.NewId()
otherTeam := &model.Team{
DisplayName: "dn_" + otherTeamID,
Name: "name" + otherTeamID,
Email: "success+" + otherTeamID + "@simulator.amazonses.com",
DisplayName: "dn_" + otherTeamId,
Name: "name" + otherTeamId,
Email: "success+" + otherTeamId + "@simulator.amazonses.com",
Type: model.TEAM_OPEN,
}
otherTeam, err = th.App.CreateTeam(otherTeam)
@@ -952,9 +952,9 @@ func TestGetChannelMembersTimezones(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
userRequestorID := ""
postRootID := ""
_, err := th.App.AddChannelMember(th.BasicUser2.Id, th.BasicChannel, userRequestorID, postRootID)
userRequestorId := ""
postRootId := ""
_, err := th.App.AddChannelMember(th.BasicUser2.Id, th.BasicChannel, userRequestorId, postRootId)
require.Nil(t, err, "Failed to add user to channel.")
user := th.BasicUser

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

@@ -191,19 +191,19 @@ func (a *App) ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *
}
trigger = strings.TrimPrefix(trigger, "/")
clientTriggerID, triggerID, appErr := model.GenerateTriggerId(args.UserId, a.AsymmetricSigningKey())
clientTriggerId, triggerId, appErr := model.GenerateTriggerId(args.UserId, a.AsymmetricSigningKey())
if appErr != nil {
mlog.Warn("error occurred in generating trigger Id for a user ", mlog.Err(appErr))
}
args.TriggerId = triggerID
args.TriggerId = triggerId
// Plugins can override built in and custom commands
cmd, response, appErr := a.tryExecutePluginCommand(args)
if appErr != nil {
return nil, appErr
} else if cmd != nil && response != nil {
response.TriggerId = clientTriggerID
response.TriggerId = clientTriggerId
return a.HandleCommandResponse(cmd, args, response, true)
}
@@ -212,7 +212,7 @@ func (a *App) ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *
if appErr != nil {
return nil, appErr
} else if cmd != nil && response != nil {
response.TriggerId = clientTriggerID
response.TriggerId = clientTriggerId
return a.HandleCommandResponse(cmd, args, response, false)
}
@@ -229,7 +229,7 @@ func (a *App) ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *
func (a *App) MentionsToTeamMembers(message, teamID string) model.UserMentionMap {
type mentionMapItem struct {
Name string
ID string
Id string
}
possibleMentions := model.PossibleAtMentions(message)
@@ -290,7 +290,7 @@ func (a *App) MentionsToTeamMembers(message, teamID string) model.UserMentionMap
atMentionMap := make(model.UserMentionMap)
for mention := range mentionChan {
atMentionMap[mention.Name] = mention.ID
atMentionMap[mention.Name] = mention.Id
}
return atMentionMap
@@ -301,7 +301,7 @@ func (a *App) MentionsToTeamMembers(message, teamID string) model.UserMentionMap
func (a *App) MentionsToPublicChannels(message, teamID string) model.ChannelMentionMap {
type mentionMapItem struct {
Name string
ID string
Id string
}
channelMentions := model.ChannelMentions(message)
@@ -330,7 +330,7 @@ func (a *App) MentionsToPublicChannels(message, teamID string) model.ChannelMent
channelMentionMap := make(model.ChannelMentionMap)
for mention := range mentionChan {
channelMentionMap[mention.Name] = mention.ID
channelMentionMap[mention.Name] = mention.Id
}
return channelMentionMap

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

@@ -31,8 +31,8 @@ func TestConfigListener(t *testing.T) {
listenerCalled = true
}
listenerID := th.App.AddConfigListener(listener)
defer th.App.RemoveConfigListener(listenerID)
listenerId := th.App.AddConfigListener(listener)
defer th.App.RemoveConfigListener(listenerId)
listener2Called := false
listener2 := func(oldConfig *model.Config, newConfig *model.Config) {

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

@@ -166,9 +166,9 @@ func (a *App) exportVersion(writer io.Writer) *model.AppError {
}
func (a *App) exportAllTeams(writer io.Writer) *model.AppError {
afterID := strings.Repeat("0", 26)
afterId := strings.Repeat("0", 26)
for {
teams, err := a.Srv().Store.Team().GetAllForExportAfter(1000, afterID)
teams, err := a.Srv().Store.Team().GetAllForExportAfter(1000, afterId)
if err != nil {
return model.NewAppError("exportAllTeams", "app.team.get_all.app_error", nil, err.Error(), http.StatusInternalServerError)
}
@@ -178,7 +178,7 @@ func (a *App) exportAllTeams(writer io.Writer) *model.AppError {
}
for _, team := range teams {
afterID = team.Id
afterId = team.Id
// Skip deleted.
if team.DeleteAt != 0 {
@@ -196,9 +196,9 @@ func (a *App) exportAllTeams(writer io.Writer) *model.AppError {
}
func (a *App) exportAllChannels(writer io.Writer) *model.AppError {
afterID := strings.Repeat("0", 26)
afterId := strings.Repeat("0", 26)
for {
channels, err := a.Srv().Store.Channel().GetAllChannelsForExportAfter(1000, afterID)
channels, err := a.Srv().Store.Channel().GetAllChannelsForExportAfter(1000, afterId)
if err != nil {
return model.NewAppError("exportAllChannels", "app.channel.get_all.app_error", nil, err.Error(), http.StatusInternalServerError)
@@ -209,7 +209,7 @@ func (a *App) exportAllChannels(writer io.Writer) *model.AppError {
}
for _, channel := range channels {
afterID = channel.Id
afterId = channel.Id
// Skip deleted.
if channel.DeleteAt != 0 {
@@ -227,9 +227,9 @@ func (a *App) exportAllChannels(writer io.Writer) *model.AppError {
}
func (a *App) exportAllUsers(writer io.Writer) *model.AppError {
afterID := strings.Repeat("0", 26)
afterId := strings.Repeat("0", 26)
for {
users, err := a.Srv().Store.User().GetAllAfter(1000, afterID)
users, err := a.Srv().Store.User().GetAllAfter(1000, afterId)
if err != nil {
return model.NewAppError("exportAllUsers", "app.user.get.app_error", nil, err.Error(), http.StatusInternalServerError)
@@ -240,7 +240,7 @@ func (a *App) exportAllUsers(writer io.Writer) *model.AppError {
}
for _, user := range users {
afterID = user.Id
afterId = user.Id
// Gathering here the exportable preferences to pass them on to ImportLineFromUser
exportedPrefs := make(map[string]*string)
@@ -381,10 +381,10 @@ func (a *App) buildUserNotifyProps(notifyProps model.StringMap) *UserNotifyProps
func (a *App) exportAllPosts(writer io.Writer, withAttachments bool) ([]AttachmentImportData, *model.AppError) {
var attachments []AttachmentImportData
afterID := strings.Repeat("0", 26)
afterId := strings.Repeat("0", 26)
for {
posts, nErr := a.Srv().Store.Post().GetParentsForExportAfter(1000, afterID)
posts, nErr := a.Srv().Store.Post().GetParentsForExportAfter(1000, afterId)
if nErr != nil {
return nil, model.NewAppError("exportAllPosts", "app.post.get_posts.app_error", nil, nErr.Error(), http.StatusInternalServerError)
}
@@ -394,7 +394,7 @@ func (a *App) exportAllPosts(writer io.Writer, withAttachments bool) ([]Attachme
}
for _, post := range posts {
afterID = post.Id
afterId = post.Id
// Skip deleted.
if post.DeleteAt != 0 {
@@ -562,14 +562,14 @@ func (a *App) exportCustomEmoji(writer io.Writer, outPath, exportDir string, exp
}
// Copies emoji files from 'data/emoji' dir to 'exported_emoji' dir
func (a *App) copyEmojiImages(emojiID string, emojiImagePath string, pathToDir string) error {
func (a *App) copyEmojiImages(emojiId string, emojiImagePath string, pathToDir string) error {
fromPath, err := os.Open(emojiImagePath)
if fromPath == nil || err != nil {
return errors.New("Error reading " + emojiImagePath + "file")
}
defer fromPath.Close()
emojiDir := pathToDir + "/" + emojiID
emojiDir := pathToDir + "/" + emojiId
if _, err = os.Stat(emojiDir); err != nil {
if !os.IsNotExist(err) {
@@ -596,9 +596,9 @@ func (a *App) copyEmojiImages(emojiID string, emojiImagePath string, pathToDir s
}
func (a *App) exportAllDirectChannels(writer io.Writer) *model.AppError {
afterID := strings.Repeat("0", 26)
afterId := strings.Repeat("0", 26)
for {
channels, err := a.Srv().Store.Channel().GetAllDirectChannelsForExportAfter(1000, afterID)
channels, err := a.Srv().Store.Channel().GetAllDirectChannelsForExportAfter(1000, afterId)
if err != nil {
return model.NewAppError("exportAllDirectChannels", "app.channel.get_all_direct.app_error", nil, err.Error(), http.StatusInternalServerError)
}
@@ -608,7 +608,7 @@ func (a *App) exportAllDirectChannels(writer io.Writer) *model.AppError {
}
for _, channel := range channels {
afterID = channel.Id
afterId = channel.Id
// Skip deleted.
if channel.DeleteAt != 0 {
@@ -627,9 +627,9 @@ func (a *App) exportAllDirectChannels(writer io.Writer) *model.AppError {
func (a *App) exportAllDirectPosts(writer io.Writer, withAttachments bool) ([]AttachmentImportData, *model.AppError) {
var attachments []AttachmentImportData
afterID := strings.Repeat("0", 26)
afterId := strings.Repeat("0", 26)
for {
posts, err := a.Srv().Store.Post().GetDirectPostParentsForExportAfter(1000, afterID)
posts, err := a.Srv().Store.Post().GetDirectPostParentsForExportAfter(1000, afterId)
if err != nil {
return nil, model.NewAppError("exportAllDirectPosts", "app.post.get_direct_posts.app_error", nil, err.Error(), http.StatusInternalServerError)
}
@@ -639,7 +639,7 @@ func (a *App) exportAllDirectPosts(writer io.Writer, withAttachments bool) ([]At
}
for _, post := range posts {
afterID = post.Id
afterId = post.Id
// Skip deleted.
if post.DeleteAt != 0 {

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

@@ -253,9 +253,9 @@ func (a *App) RemoveDirectory(path string) *model.AppError {
return nil
}
func (a *App) getInfoForFilename(post *model.Post, teamID, channelID, userID, oldID, filename string) *model.FileInfo {
func (a *App) getInfoForFilename(post *model.Post, teamID, channelID, userID, oldId, filename string) *model.FileInfo {
name, _ := url.QueryUnescape(filename)
pathPrefix := fmt.Sprintf("teams/%s/channels/%s/users/%s/%s/", teamID, channelID, userID, oldID)
pathPrefix := fmt.Sprintf("teams/%s/channels/%s/users/%s/%s/", teamID, channelID, userID, oldId)
path := pathPrefix + name
// Open the file and populate the fields of the FileInfo
@@ -959,11 +959,11 @@ func (t UploadFileTask) newAppError(id string, httpStatus int, extra ...interfac
return model.NewAppError("uploadFileTask", id, params, "", httpStatus)
}
func (a *App) DoUploadFileExpectModification(now time.Time, rawTeamID string, rawChannelID string, rawUserID string, rawFilename string, data []byte) (*model.FileInfo, []byte, *model.AppError) {
func (a *App) DoUploadFileExpectModification(now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, []byte, *model.AppError) {
filename := filepath.Base(rawFilename)
teamID := filepath.Base(rawTeamID)
channelID := filepath.Base(rawChannelID)
userID := filepath.Base(rawUserID)
teamID := filepath.Base(rawTeamId)
channelID := filepath.Base(rawChannelId)
userID := filepath.Base(rawUserId)
info, err := model.GetInfoForBytes(filename, bytes.NewReader(data), len(data))
if err != nil {

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

@@ -79,7 +79,7 @@ func BenchmarkUploadFile(b *testing.B) {
{fmt.Sprintf("zero-%dMb", mb(len(zero10M))), ".zero", zero10M},
}
fileBenchmarks := []struct {
file_benchmarks := []struct {
title string
f func(b *testing.B, n int, data []byte, ext string)
}{
@@ -184,7 +184,7 @@ func BenchmarkUploadFile(b *testing.B) {
}
for _, file := range files {
for _, fb := range fileBenchmarks {
for _, fb := range file_benchmarks {
b.Run(file.title+"-"+fb.title, func(b *testing.B) {
for i := 0; i < b.N; i++ {
fb.f(b, i, file.data, file.ext)

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

@@ -65,7 +65,7 @@ func (a *App) GetGroupsBySource(groupSource model.GroupSource) ([]*model.Group,
return groups, nil
}
func (a *App) GetGroupsByUserID(userID string) ([]*model.Group, *model.AppError) {
func (a *App) GetGroupsByUserId(userID string) ([]*model.Group, *model.AppError) {
groups, err := a.Srv().Store.Group().GetByUser(userID)
if err != nil {
return nil, model.NewAppError("GetGroupsByUserId", "app.select_error", nil, err.Error(), http.StatusInternalServerError)

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

@@ -2625,7 +2625,7 @@ func (a *OpenTracingAppLayer) DeleteAllKeysForPlugin(pluginID string) *model.App
return resultVar0
}
func (a *OpenTracingAppLayer) DeleteBotIconImage(botUserID string) *model.AppError {
func (a *OpenTracingAppLayer) DeleteBotIconImage(botUserId string) *model.AppError {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DeleteBotIconImage")
@@ -2637,7 +2637,7 @@ func (a *OpenTracingAppLayer) DeleteBotIconImage(botUserID string) *model.AppErr
}()
defer span.Finish()
resultVar0 := a.app.DeleteBotIconImage(botUserID)
resultVar0 := a.app.DeleteBotIconImage(botUserId)
if resultVar0 != nil {
span.LogFields(spanlog.Error(resultVar0))
@@ -3493,7 +3493,7 @@ func (a *OpenTracingAppLayer) DoUploadFile(now time.Time, rawTeamId string, rawC
return resultVar0, resultVar1
}
func (a *OpenTracingAppLayer) DoUploadFileExpectModification(now time.Time, rawTeamID string, rawChannelID string, rawUserID string, rawFilename string, data []byte) (*model.FileInfo, []byte, *model.AppError) {
func (a *OpenTracingAppLayer) DoUploadFileExpectModification(now time.Time, rawTeamId string, rawChannelId string, rawUserId string, rawFilename string, data []byte) (*model.FileInfo, []byte, *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.DoUploadFileExpectModification")
@@ -3505,7 +3505,7 @@ func (a *OpenTracingAppLayer) DoUploadFileExpectModification(now time.Time, rawT
}()
defer span.Finish()
resultVar0, resultVar1, resultVar2 := a.app.DoUploadFileExpectModification(now, rawTeamID, rawChannelID, rawUserID, rawFilename, data)
resultVar0, resultVar1, resultVar2 := a.app.DoUploadFileExpectModification(now, rawTeamId, rawChannelId, rawUserId, rawFilename, data)
if resultVar2 != nil {
span.LogFields(spanlog.Error(resultVar2))
@@ -4455,7 +4455,7 @@ func (a *OpenTracingAppLayer) GetAuthorizedAppsForUser(userID string, page int,
return resultVar0, resultVar1
}
func (a *OpenTracingAppLayer) GetBot(botUserID string, includeDeleted bool) (*model.Bot, *model.AppError) {
func (a *OpenTracingAppLayer) GetBot(botUserId string, includeDeleted bool) (*model.Bot, *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetBot")
@@ -4467,7 +4467,7 @@ func (a *OpenTracingAppLayer) GetBot(botUserID string, includeDeleted bool) (*mo
}()
defer span.Finish()
resultVar0, resultVar1 := a.app.GetBot(botUserID, includeDeleted)
resultVar0, resultVar1 := a.app.GetBot(botUserId, includeDeleted)
if resultVar1 != nil {
span.LogFields(spanlog.Error(resultVar1))
@@ -4477,7 +4477,7 @@ func (a *OpenTracingAppLayer) GetBot(botUserID string, includeDeleted bool) (*mo
return resultVar0, resultVar1
}
func (a *OpenTracingAppLayer) GetBotIconImage(botUserID string) ([]byte, *model.AppError) {
func (a *OpenTracingAppLayer) GetBotIconImage(botUserId string) ([]byte, *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetBotIconImage")
@@ -4489,7 +4489,7 @@ func (a *OpenTracingAppLayer) GetBotIconImage(botUserID string) ([]byte, *model.
}()
defer span.Finish()
resultVar0, resultVar1 := a.app.GetBotIconImage(botUserID)
resultVar0, resultVar1 := a.app.GetBotIconImage(botUserId)
if resultVar1 != nil {
span.LogFields(spanlog.Error(resultVar1))
@@ -5975,9 +5975,9 @@ func (a *OpenTracingAppLayer) GetGroupsByTeam(teamID string, opts model.GroupSea
return resultVar0, resultVar1, resultVar2
}
func (a *OpenTracingAppLayer) GetGroupsByUserID(userID string) ([]*model.Group, *model.AppError) {
func (a *OpenTracingAppLayer) GetGroupsByUserId(userID string) ([]*model.Group, *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetGroupsByUserID")
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetGroupsByUserId")
a.ctx = newCtx
a.app.Srv().Store.SetContext(newCtx)
@@ -5987,7 +5987,7 @@ func (a *OpenTracingAppLayer) GetGroupsByUserID(userID string) ([]*model.Group,
}()
defer span.Finish()
resultVar0, resultVar1 := a.app.GetGroupsByUserID(userID)
resultVar0, resultVar1 := a.app.GetGroupsByUserId(userID)
if resultVar1 != nil {
span.LogFields(spanlog.Error(resultVar1))
@@ -11006,7 +11006,7 @@ func (a *OpenTracingAppLayer) OverrideIconURLIfEmoji(post *model.Post) {
a.app.OverrideIconURLIfEmoji(post)
}
func (a *OpenTracingAppLayer) PatchBot(botUserID string, botPatch *model.BotPatch) (*model.Bot, *model.AppError) {
func (a *OpenTracingAppLayer) PatchBot(botUserId string, botPatch *model.BotPatch) (*model.Bot, *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.PatchBot")
@@ -11018,7 +11018,7 @@ func (a *OpenTracingAppLayer) PatchBot(botUserID string, botPatch *model.BotPatc
}()
defer span.Finish()
resultVar0, resultVar1 := a.app.PatchBot(botUserID, botPatch)
resultVar0, resultVar1 := a.app.PatchBot(botUserId, botPatch)
if resultVar1 != nil {
span.LogFields(spanlog.Error(resultVar1))
@@ -11204,7 +11204,7 @@ func (a *OpenTracingAppLayer) PermanentDeleteAllUsers() *model.AppError {
return resultVar0
}
func (a *OpenTracingAppLayer) PermanentDeleteBot(botUserID string) *model.AppError {
func (a *OpenTracingAppLayer) PermanentDeleteBot(botUserId string) *model.AppError {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.PermanentDeleteBot")
@@ -11216,7 +11216,7 @@ func (a *OpenTracingAppLayer) PermanentDeleteBot(botUserID string) *model.AppErr
}()
defer span.Finish()
resultVar0 := a.app.PermanentDeleteBot(botUserID)
resultVar0 := a.app.PermanentDeleteBot(botUserId)
if resultVar0 != nil {
span.LogFields(spanlog.Error(resultVar0))
@@ -13784,7 +13784,7 @@ func (a *OpenTracingAppLayer) SetAutoResponderStatus(user *model.User, oldNotify
a.app.SetAutoResponderStatus(user, oldNotifyProps)
}
func (a *OpenTracingAppLayer) SetBotIconImage(botUserID string, file io.ReadSeeker) *model.AppError {
func (a *OpenTracingAppLayer) SetBotIconImage(botUserId string, file io.ReadSeeker) *model.AppError {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.SetBotIconImage")
@@ -13796,7 +13796,7 @@ func (a *OpenTracingAppLayer) SetBotIconImage(botUserID string, file io.ReadSeek
}()
defer span.Finish()
resultVar0 := a.app.SetBotIconImage(botUserID, file)
resultVar0 := a.app.SetBotIconImage(botUserId, file)
if resultVar0 != nil {
span.LogFields(spanlog.Error(resultVar0))
@@ -13806,7 +13806,7 @@ func (a *OpenTracingAppLayer) SetBotIconImage(botUserID string, file io.ReadSeek
return resultVar0
}
func (a *OpenTracingAppLayer) SetBotIconImageFromMultiPartFile(botUserID string, imageData *multipart.FileHeader) *model.AppError {
func (a *OpenTracingAppLayer) SetBotIconImageFromMultiPartFile(botUserId string, imageData *multipart.FileHeader) *model.AppError {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.SetBotIconImageFromMultiPartFile")
@@ -13818,7 +13818,7 @@ func (a *OpenTracingAppLayer) SetBotIconImageFromMultiPartFile(botUserID string,
}()
defer span.Finish()
resultVar0 := a.app.SetBotIconImageFromMultiPartFile(botUserID, imageData)
resultVar0 := a.app.SetBotIconImageFromMultiPartFile(botUserId, imageData)
if resultVar0 != nil {
span.LogFields(spanlog.Error(resultVar0))
@@ -14813,7 +14813,7 @@ func (a *OpenTracingAppLayer) UpdateActive(user *model.User, active bool) (*mode
return resultVar0, resultVar1
}
func (a *OpenTracingAppLayer) UpdateBotActive(botUserID string, active bool) (*model.Bot, *model.AppError) {
func (a *OpenTracingAppLayer) UpdateBotActive(botUserId string, active bool) (*model.Bot, *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.UpdateBotActive")
@@ -14825,7 +14825,7 @@ func (a *OpenTracingAppLayer) UpdateBotActive(botUserID string, active bool) (*m
}()
defer span.Finish()
resultVar0, resultVar1 := a.app.UpdateBotActive(botUserID, active)
resultVar0, resultVar1 := a.app.UpdateBotActive(botUserId, active)
if resultVar1 != nil {
span.LogFields(spanlog.Error(resultVar1))
@@ -14835,7 +14835,7 @@ func (a *OpenTracingAppLayer) UpdateBotActive(botUserID string, active bool) (*m
return resultVar0, resultVar1
}
func (a *OpenTracingAppLayer) UpdateBotOwner(botUserID string, newOwnerID string) (*model.Bot, *model.AppError) {
func (a *OpenTracingAppLayer) UpdateBotOwner(botUserId string, newOwnerId string) (*model.Bot, *model.AppError) {
origCtx := a.ctx
span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.UpdateBotOwner")
@@ -14847,7 +14847,7 @@ func (a *OpenTracingAppLayer) UpdateBotOwner(botUserID string, newOwnerID string
}()
defer span.Finish()
resultVar0, resultVar1 := a.app.UpdateBotOwner(botUserID, newOwnerID)
resultVar0, resultVar1 := a.app.UpdateBotOwner(botUserId, newOwnerId)
if resultVar1 != nil {
span.LogFields(spanlog.Error(resultVar1))

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

@@ -537,7 +537,7 @@ func (api *PluginAPI) GetGroupByName(name string) (*model.Group, *model.AppError
}
func (api *PluginAPI) GetGroupsForUser(userID string) ([]*model.Group, *model.AppError) {
return api.app.GetGroupsByUserID(userID)
return api.app.GetGroupsByUserId(userID)
}
func (api *PluginAPI) CreatePost(post *model.Post) (*model.Post, *model.AppError) {

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

@@ -118,8 +118,8 @@ var _ Hooks = &hooksRPCClient{}
func (g *hooksRPCClient) Implemented() (impl []string, err error) {
err = g.client.Call("Plugin.Implemented", struct{}{}, &impl)
for _, hookName := range impl {
if hookID, ok := hookNameToId[hookName]; ok {
g.implemented[hookID] = true
if hookId, ok := hookNameToId[hookName]; ok {
g.implemented[hookId] = true
}
}
return
@@ -166,25 +166,25 @@ func (s *hooksRPCServer) Implemented(args struct{}, reply *[]string) error {
return encodableError(nil)
}
type ZOnActivateArgs struct {
APIMuxID uint32
type Z_OnActivateArgs struct {
APIMuxId uint32
}
type ZOnActivateReturns struct {
type Z_OnActivateReturns struct {
A error
}
func (g *hooksRPCClient) OnActivate() error {
muxID := g.muxBroker.NextId()
go g.muxBroker.AcceptAndServe(muxID, &apiRPCServer{
muxId := g.muxBroker.NextId()
go g.muxBroker.AcceptAndServe(muxId, &apiRPCServer{
impl: g.apiImpl,
muxBroker: g.muxBroker,
})
_args := &ZOnActivateArgs{
APIMuxID: muxID,
_args := &Z_OnActivateArgs{
APIMuxId: muxId,
}
_returns := &ZOnActivateReturns{}
_returns := &Z_OnActivateReturns{}
if err := g.client.Call("Plugin.OnActivate", _args, _returns); err != nil {
g.log.Error("RPC call to OnActivate plugin failed.", mlog.Err(err))
@@ -192,8 +192,8 @@ func (g *hooksRPCClient) OnActivate() error {
return _returns.A
}
func (s *hooksRPCServer) OnActivate(args *ZOnActivateArgs, returns *ZOnActivateReturns) error {
connection, err := s.muxBroker.Dial(args.APIMuxID)
func (s *hooksRPCServer) OnActivate(args *Z_OnActivateArgs, returns *Z_OnActivateReturns) error {
connection, err := s.muxBroker.Dial(args.APIMuxId)
if err != nil {
return err
}
@@ -231,16 +231,16 @@ func (s *hooksRPCServer) OnActivate(args *ZOnActivateArgs, returns *ZOnActivateR
return nil
}
type ZLoadPluginConfigurationArgsArgs struct {
type Z_LoadPluginConfigurationArgsArgs struct {
}
type ZLoadPluginConfigurationArgsReturns struct {
type Z_LoadPluginConfigurationArgsReturns struct {
A []byte
}
func (g *apiRPCClient) LoadPluginConfiguration(dest interface{}) error {
_args := &ZLoadPluginConfigurationArgsArgs{}
_returns := &ZLoadPluginConfigurationArgsReturns{}
_args := &Z_LoadPluginConfigurationArgsArgs{}
_returns := &Z_LoadPluginConfigurationArgsReturns{}
if err := g.client.Call("Plugin.LoadPluginConfiguration", _args, _returns); err != nil {
log.Printf("RPC call to LoadPluginConfiguration API failed: %s", err.Error())
}
@@ -250,7 +250,7 @@ func (g *apiRPCClient) LoadPluginConfiguration(dest interface{}) error {
return nil
}
func (s *apiRPCServer) LoadPluginConfiguration(args *ZLoadPluginConfigurationArgsArgs, returns *ZLoadPluginConfigurationArgsReturns) error {
func (s *apiRPCServer) LoadPluginConfiguration(args *Z_LoadPluginConfigurationArgsArgs, returns *Z_LoadPluginConfigurationArgsReturns) error {
var config interface{}
if hook, ok := s.impl.(interface {
LoadPluginConfiguration(dest interface{}) error
@@ -271,7 +271,7 @@ func init() {
hookNameToId["ServeHTTP"] = ServeHTTPID
}
type ZServeHTTPArgs struct {
type Z_ServeHTTPArgs struct {
ResponseWriterStream uint32
Request *http.Request
Context *Context
@@ -284,11 +284,11 @@ func (g *hooksRPCClient) ServeHTTP(c *Context, w http.ResponseWriter, r *http.Re
return
}
serveHTTPStreamID := g.muxBroker.NextId()
serveHTTPStreamId := g.muxBroker.NextId()
go func() {
connection, err := g.muxBroker.Accept(serveHTTPStreamID)
connection, err := g.muxBroker.Accept(serveHTTPStreamId)
if err != nil {
g.log.Error("Plugin failed to ServeHTTP, muxBroker couldn't accept connection", mlog.Uint32("serve_http_stream_id", serveHTTPStreamID), mlog.Err(err))
g.log.Error("Plugin failed to ServeHTTP, muxBroker couldn't accept connection", mlog.Uint32("serve_http_stream_id", serveHTTPStreamId), mlog.Err(err))
return
}
defer connection.Close()
@@ -301,11 +301,11 @@ func (g *hooksRPCClient) ServeHTTP(c *Context, w http.ResponseWriter, r *http.Re
rpcServer.ServeConn(connection)
}()
requestBodyStreamID := uint32(0)
requestBodyStreamId := uint32(0)
if r.Body != nil {
requestBodyStreamID = g.muxBroker.NextId()
requestBodyStreamId = g.muxBroker.NextId()
go func() {
bodyConnection, err := g.muxBroker.Accept(requestBodyStreamID)
bodyConnection, err := g.muxBroker.Accept(requestBodyStreamId)
if err != nil {
g.log.Error("Plugin failed to ServeHTTP, muxBroker couldn't Accept request body connection", mlog.Err(err))
return
@@ -327,18 +327,18 @@ func (g *hooksRPCClient) ServeHTTP(c *Context, w http.ResponseWriter, r *http.Re
RequestURI: r.RequestURI,
}
if err := g.client.Call("Plugin.ServeHTTP", ZServeHTTPArgs{
if err := g.client.Call("Plugin.ServeHTTP", Z_ServeHTTPArgs{
Context: c,
ResponseWriterStream: serveHTTPStreamID,
ResponseWriterStream: serveHTTPStreamId,
Request: forwardedRequest,
RequestBodyStream: requestBodyStreamID,
RequestBodyStream: requestBodyStreamId,
}, nil); err != nil {
g.log.Error("Plugin failed to ServeHTTP, RPC call failed", mlog.Err(err))
http.Error(w, "500 internal server error", http.StatusInternalServerError)
}
}
func (s *hooksRPCServer) ServeHTTP(args *ZServeHTTPArgs, returns *struct{}) error {
func (s *hooksRPCServer) ServeHTTP(args *Z_ServeHTTPArgs, returns *struct{}) error {
connection, err := s.muxBroker.Dial(args.ResponseWriterStream)
if err != nil {
fmt.Fprintf(os.Stderr, "[ERROR] Can't connect to remote response writer stream, error: %v", err.Error())
@@ -371,12 +371,12 @@ func (s *hooksRPCServer) ServeHTTP(args *ZServeHTTPArgs, returns *struct{}) erro
return nil
}
type ZPluginHTTPArgs struct {
type Z_PluginHTTPArgs struct {
Request *http.Request
RequestBody []byte
}
type ZPluginHTTPReturns struct {
type Z_PluginHTTPReturns struct {
Response *http.Response
ResponseBody []byte
}
@@ -402,12 +402,12 @@ func (g *apiRPCClient) PluginHTTP(request *http.Request) *http.Response {
request.Body.Close()
request.Body = nil
_args := &ZPluginHTTPArgs{
_args := &Z_PluginHTTPArgs{
Request: forwardedRequest,
RequestBody: requestBody,
}
_returns := &ZPluginHTTPReturns{}
_returns := &Z_PluginHTTPReturns{}
if err := g.client.Call("Plugin.PluginHTTP", _args, _returns); err != nil {
log.Printf("RPC call to PluginHTTP API failed: %s", err.Error())
return nil
@@ -418,7 +418,7 @@ func (g *apiRPCClient) PluginHTTP(request *http.Request) *http.Response {
return _returns.Response
}
func (s *apiRPCServer) PluginHTTP(args *ZPluginHTTPArgs, returns *ZPluginHTTPReturns) error {
func (s *apiRPCServer) PluginHTTP(args *Z_PluginHTTPArgs, returns *Z_PluginHTTPReturns) error {
args.Request.Body = ioutil.NopCloser(bytes.NewBuffer(args.RequestBody))
if hook, ok := s.impl.(interface {
@@ -445,14 +445,14 @@ func init() {
hookNameToId["FileWillBeUploaded"] = FileWillBeUploadedID
}
type ZFileWillBeUploadedArgs struct {
type Z_FileWillBeUploadedArgs struct {
A *Context
B *model.FileInfo
UploadedFileStream uint32
ReplacementFileStream uint32
}
type ZFileWillBeUploadedReturns struct {
type Z_FileWillBeUploadedReturns struct {
A *model.FileInfo
B string
}
@@ -462,9 +462,9 @@ func (g *hooksRPCClient) FileWillBeUploaded(c *Context, info *model.FileInfo, fi
return info, ""
}
uploadedFileStreamID := g.muxBroker.NextId()
uploadedFileStreamId := g.muxBroker.NextId()
go func() {
uploadedFileConnection, err := g.muxBroker.Accept(uploadedFileStreamID)
uploadedFileConnection, err := g.muxBroker.Accept(uploadedFileStreamId)
if err != nil {
g.log.Error("Plugin failed to serve upload file stream. MuxBroker could not Accept connection", mlog.Err(err))
return
@@ -474,11 +474,11 @@ func (g *hooksRPCClient) FileWillBeUploaded(c *Context, info *model.FileInfo, fi
}()
replacementDone := make(chan bool)
replacementFileStreamID := g.muxBroker.NextId()
replacementFileStreamId := g.muxBroker.NextId()
go func() {
defer close(replacementDone)
replacementFileConnection, err := g.muxBroker.Accept(replacementFileStreamID)
replacementFileConnection, err := g.muxBroker.Accept(replacementFileStreamId)
if err != nil {
g.log.Error("Plugin failed to serve replacement file stream. MuxBroker could not Accept connection", mlog.Err(err))
return
@@ -489,8 +489,8 @@ func (g *hooksRPCClient) FileWillBeUploaded(c *Context, info *model.FileInfo, fi
}
}()
_args := &ZFileWillBeUploadedArgs{c, info, uploadedFileStreamID, replacementFileStreamID}
_returns := &ZFileWillBeUploadedReturns{A: _args.B}
_args := &Z_FileWillBeUploadedArgs{c, info, uploadedFileStreamId, replacementFileStreamId}
_returns := &Z_FileWillBeUploadedReturns{A: _args.B}
if err := g.client.Call("Plugin.FileWillBeUploaded", _args, _returns); err != nil {
g.log.Error("RPC call FileWillBeUploaded to plugin failed.", mlog.Err(err))
}
@@ -501,7 +501,7 @@ func (g *hooksRPCClient) FileWillBeUploaded(c *Context, info *model.FileInfo, fi
return _returns.A, _returns.B
}
func (s *hooksRPCServer) FileWillBeUploaded(args *ZFileWillBeUploadedArgs, returns *ZFileWillBeUploadedReturns) error {
func (s *hooksRPCServer) FileWillBeUploaded(args *Z_FileWillBeUploadedArgs, returns *Z_FileWillBeUploadedReturns) error {
uploadFileConnection, err := s.muxBroker.Dial(args.UploadedFileStream)
if err != nil {
fmt.Fprintf(os.Stderr, "[ERROR] Can't connect to remote upload file stream, error: %v", err.Error())
@@ -536,19 +536,19 @@ func init() {
hookNameToId["MessageWillBePosted"] = MessageWillBePostedID
}
type ZMessageWillBePostedArgs struct {
type Z_MessageWillBePostedArgs struct {
A *Context
B *model.Post
}
type ZMessageWillBePostedReturns struct {
type Z_MessageWillBePostedReturns struct {
A *model.Post
B string
}
func (g *hooksRPCClient) MessageWillBePosted(c *Context, post *model.Post) (*model.Post, string) {
_args := &ZMessageWillBePostedArgs{c, post}
_returns := &ZMessageWillBePostedReturns{A: _args.B}
_args := &Z_MessageWillBePostedArgs{c, post}
_returns := &Z_MessageWillBePostedReturns{A: _args.B}
if g.implemented[MessageWillBePostedID] {
if err := g.client.Call("Plugin.MessageWillBePosted", _args, _returns); err != nil {
g.log.Error("RPC call MessageWillBePosted to plugin failed.", mlog.Err(err))
@@ -557,7 +557,7 @@ func (g *hooksRPCClient) MessageWillBePosted(c *Context, post *model.Post) (*mod
return _returns.A, _returns.B
}
func (s *hooksRPCServer) MessageWillBePosted(args *ZMessageWillBePostedArgs, returns *ZMessageWillBePostedReturns) error {
func (s *hooksRPCServer) MessageWillBePosted(args *Z_MessageWillBePostedArgs, returns *Z_MessageWillBePostedReturns) error {
if hook, ok := s.impl.(interface {
MessageWillBePosted(c *Context, post *model.Post) (*model.Post, string)
}); ok {
@@ -576,20 +576,20 @@ func init() {
hookNameToId["MessageWillBeUpdated"] = MessageWillBeUpdatedID
}
type ZMessageWillBeUpdatedArgs struct {
type Z_MessageWillBeUpdatedArgs struct {
A *Context
B *model.Post
C *model.Post
}
type ZMessageWillBeUpdatedReturns struct {
type Z_MessageWillBeUpdatedReturns struct {
A *model.Post
B string
}
func (g *hooksRPCClient) MessageWillBeUpdated(c *Context, newPost, oldPost *model.Post) (*model.Post, string) {
_args := &ZMessageWillBeUpdatedArgs{c, newPost, oldPost}
_returns := &ZMessageWillBeUpdatedReturns{A: _args.B}
_args := &Z_MessageWillBeUpdatedArgs{c, newPost, oldPost}
_returns := &Z_MessageWillBeUpdatedReturns{A: _args.B}
if g.implemented[MessageWillBeUpdatedID] {
if err := g.client.Call("Plugin.MessageWillBeUpdated", _args, _returns); err != nil {
g.log.Error("RPC call MessageWillBeUpdated to plugin failed.", mlog.Err(err))
@@ -598,7 +598,7 @@ func (g *hooksRPCClient) MessageWillBeUpdated(c *Context, newPost, oldPost *mode
return _returns.A, _returns.B
}
func (s *hooksRPCServer) MessageWillBeUpdated(args *ZMessageWillBeUpdatedArgs, returns *ZMessageWillBeUpdatedReturns) error {
func (s *hooksRPCServer) MessageWillBeUpdated(args *Z_MessageWillBeUpdatedArgs, returns *Z_MessageWillBeUpdatedReturns) error {
if hook, ok := s.impl.(interface {
MessageWillBeUpdated(c *Context, newPost, oldPost *model.Post) (*model.Post, string)
}); ok {
@@ -610,25 +610,25 @@ func (s *hooksRPCServer) MessageWillBeUpdated(args *ZMessageWillBeUpdatedArgs, r
return nil
}
type ZLogDebugArgs struct {
type Z_LogDebugArgs struct {
A string
B []interface{}
}
type ZLogDebugReturns struct {
type Z_LogDebugReturns struct {
}
func (g *apiRPCClient) LogDebug(msg string, keyValuePairs ...interface{}) {
stringifiedPairs := stringifyToObjects(keyValuePairs)
_args := &ZLogDebugArgs{msg, stringifiedPairs}
_returns := &ZLogDebugReturns{}
_args := &Z_LogDebugArgs{msg, stringifiedPairs}
_returns := &Z_LogDebugReturns{}
if err := g.client.Call("Plugin.LogDebug", _args, _returns); err != nil {
log.Printf("RPC call to LogDebug API failed: %s", err.Error())
}
}
func (s *apiRPCServer) LogDebug(args *ZLogDebugArgs, returns *ZLogDebugReturns) error {
func (s *apiRPCServer) LogDebug(args *Z_LogDebugArgs, returns *Z_LogDebugReturns) error {
if hook, ok := s.impl.(interface {
LogDebug(msg string, keyValuePairs ...interface{})
}); ok {
@@ -639,25 +639,25 @@ func (s *apiRPCServer) LogDebug(args *ZLogDebugArgs, returns *ZLogDebugReturns)
return nil
}
type ZLogInfoArgs struct {
type Z_LogInfoArgs struct {
A string
B []interface{}
}
type ZLogInfoReturns struct {
type Z_LogInfoReturns struct {
}
func (g *apiRPCClient) LogInfo(msg string, keyValuePairs ...interface{}) {
stringifiedPairs := stringifyToObjects(keyValuePairs)
_args := &ZLogInfoArgs{msg, stringifiedPairs}
_returns := &ZLogInfoReturns{}
_args := &Z_LogInfoArgs{msg, stringifiedPairs}
_returns := &Z_LogInfoReturns{}
if err := g.client.Call("Plugin.LogInfo", _args, _returns); err != nil {
log.Printf("RPC call to LogInfo API failed: %s", err.Error())
}
}
func (s *apiRPCServer) LogInfo(args *ZLogInfoArgs, returns *ZLogInfoReturns) error {
func (s *apiRPCServer) LogInfo(args *Z_LogInfoArgs, returns *Z_LogInfoReturns) error {
if hook, ok := s.impl.(interface {
LogInfo(msg string, keyValuePairs ...interface{})
}); ok {
@@ -668,25 +668,25 @@ func (s *apiRPCServer) LogInfo(args *ZLogInfoArgs, returns *ZLogInfoReturns) err
return nil
}
type ZLogWarnArgs struct {
type Z_LogWarnArgs struct {
A string
B []interface{}
}
type ZLogWarnReturns struct {
type Z_LogWarnReturns struct {
}
func (g *apiRPCClient) LogWarn(msg string, keyValuePairs ...interface{}) {
stringifiedPairs := stringifyToObjects(keyValuePairs)
_args := &ZLogWarnArgs{msg, stringifiedPairs}
_returns := &ZLogWarnReturns{}
_args := &Z_LogWarnArgs{msg, stringifiedPairs}
_returns := &Z_LogWarnReturns{}
if err := g.client.Call("Plugin.LogWarn", _args, _returns); err != nil {
log.Printf("RPC call to LogWarn API failed: %s", err.Error())
}
}
func (s *apiRPCServer) LogWarn(args *ZLogWarnArgs, returns *ZLogWarnReturns) error {
func (s *apiRPCServer) LogWarn(args *Z_LogWarnArgs, returns *Z_LogWarnReturns) error {
if hook, ok := s.impl.(interface {
LogWarn(msg string, keyValuePairs ...interface{})
}); ok {
@@ -697,24 +697,24 @@ func (s *apiRPCServer) LogWarn(args *ZLogWarnArgs, returns *ZLogWarnReturns) err
return nil
}
type ZLogErrorArgs struct {
type Z_LogErrorArgs struct {
A string
B []interface{}
}
type ZLogErrorReturns struct {
type Z_LogErrorReturns struct {
}
func (g *apiRPCClient) LogError(msg string, keyValuePairs ...interface{}) {
stringifiedPairs := stringifyToObjects(keyValuePairs)
_args := &ZLogErrorArgs{msg, stringifiedPairs}
_returns := &ZLogErrorReturns{}
_args := &Z_LogErrorArgs{msg, stringifiedPairs}
_returns := &Z_LogErrorReturns{}
if err := g.client.Call("Plugin.LogError", _args, _returns); err != nil {
log.Printf("RPC call to LogError API failed: %s", err.Error())
}
}
func (s *apiRPCServer) LogError(args *ZLogErrorArgs, returns *ZLogErrorReturns) error {
func (s *apiRPCServer) LogError(args *Z_LogErrorArgs, returns *Z_LogErrorReturns) error {
if hook, ok := s.impl.(interface {
LogError(msg string, keyValuePairs ...interface{})
}); ok {
@@ -725,12 +725,12 @@ func (s *apiRPCServer) LogError(args *ZLogErrorArgs, returns *ZLogErrorReturns)
return nil
}
type ZInstallPluginArgs struct {
type Z_InstallPluginArgs struct {
PluginStreamID uint32
B bool
}
type ZInstallPluginReturns struct {
type Z_InstallPluginReturns struct {
A *model.Manifest
B *model.AppError
}
@@ -748,8 +748,8 @@ func (g *apiRPCClient) InstallPlugin(file io.Reader, replace bool) (*model.Manif
serveIOReader(file, uploadPluginConnection)
}()
_args := &ZInstallPluginArgs{pluginStreamID, replace}
_returns := &ZInstallPluginReturns{}
_args := &Z_InstallPluginArgs{pluginStreamID, replace}
_returns := &Z_InstallPluginReturns{}
if err := g.client.Call("Plugin.InstallPlugin", _args, _returns); err != nil {
log.Print("RPC call InstallPlugin to plugin failed.", mlog.Err(err))
}
@@ -757,7 +757,7 @@ func (g *apiRPCClient) InstallPlugin(file io.Reader, replace bool) (*model.Manif
return _returns.A, _returns.B
}
func (s *apiRPCServer) InstallPlugin(args *ZInstallPluginArgs, returns *ZInstallPluginReturns) error {
func (s *apiRPCServer) InstallPlugin(args *Z_InstallPluginArgs, returns *Z_InstallPluginReturns) error {
hook, ok := s.impl.(interface {
InstallPlugin(file io.Reader, replace bool) (*model.Manifest, *model.AppError)
})

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@@ -191,14 +191,14 @@ func (env *Environment) Statuses() (model.PluginStatuses, error) {
// GetManifest returns a manifest for a given pluginId.
// Returns ErrNotFound if plugin is not found.
func (env *Environment) GetManifest(pluginID string) (*model.Manifest, error) {
func (env *Environment) GetManifest(pluginId string) (*model.Manifest, error) {
plugins, err := env.Available()
if err != nil {
return nil, errors.Wrap(err, "unable to get plugin statuses")
}
for _, plugin := range plugins {
if plugin.Manifest != nil && plugin.Manifest.Id == pluginID {
if plugin.Manifest != nil && plugin.Manifest.Id == pluginId {
return plugin.Manifest, nil
}
}
@@ -447,13 +447,13 @@ func (env *Environment) HooksForPlugin(id string) (Hooks, error) {
//
// If hookRunnerFunc returns false, iteration will not continue. The iteration order among active
// plugins is not specified.
func (env *Environment) RunMultiPluginHook(hookRunnerFunc func(hooks Hooks) bool, hookID int) {
func (env *Environment) RunMultiPluginHook(hookRunnerFunc func(hooks Hooks) bool, hookId int) {
startTime := time.Now()
env.registeredPlugins.Range(func(key, value interface{}) bool {
rp := value.(registeredPlugin)
if rp.supervisor == nil || !rp.supervisor.Implements(hookID) || !env.IsActive(rp.BundleInfo.Manifest.Id) {
if rp.supervisor == nil || !rp.supervisor.Implements(hookId) || !env.IsActive(rp.BundleInfo.Manifest.Id) {
return true
}

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

@@ -470,7 +470,7 @@ func generateHooksGlue(info *PluginInterfaceInfo) {
return FieldListToRecordSuccess(structPrefix, fields)
},
"obscure": func(name string) string {
return "Z" + name
return "Z_" + name
},
}

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

@@ -89,8 +89,8 @@ func newSupervisor(pluginInfo *model.BundleInfo, apiImpl API, parentLogger *mlog
return nil, err
}
for _, hookName := range impl {
if hookID, ok := hookNameToId[hookName]; ok {
sup.implemented[hookID] = true
if hookId, ok := hookNameToId[hookName]; ok {
sup.implemented[hookId] = true
}
}
@@ -141,8 +141,8 @@ func (sup *supervisor) Ping() error {
return client.Ping()
}
func (sup *supervisor) Implements(hookID int) bool {
func (sup *supervisor) Implements(hookId int) bool {
sup.lock.RLock()
defer sup.lock.RUnlock()
return sup.implemented[hookID]
return sup.implemented[hookId]
}

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

@@ -22,7 +22,7 @@ func slackConvertTimeStamp(ts string) int64 {
return timeStamp * 1000 // Convert to milliseconds
}
func slackConvertChannelName(channelName string, channelID string) string {
func slackConvertChannelName(channelName string, channelId string) string {
newName := strings.Trim(channelName, "_-")
if len(newName) == 1 {
return "slack-channel-" + newName
@@ -31,15 +31,15 @@ func slackConvertChannelName(channelName string, channelID string) string {
if isValidChannelNameCharacters(newName) {
return newName
}
return strings.ToLower(channelID)
return strings.ToLower(channelId)
}
func slackConvertUserMentions(users []slackUser, posts map[string][]slackPost) map[string][]slackPost {
var regexes = make(map[string]*regexp.Regexp, len(users))
for _, user := range users {
r, err := regexp.Compile("<@" + user.ID + `(\|` + user.Username + ")?>")
r, err := regexp.Compile("<@" + user.Id + `(\|` + user.Username + ")?>")
if err != nil {
mlog.Warn("Slack Import: Unable to compile the @mention, matching regular expression for the Slack user.", mlog.String("user_name", user.Username), mlog.String("user_id", user.ID))
mlog.Warn("Slack Import: Unable to compile the @mention, matching regular expression for the Slack user.", mlog.String("user_name", user.Username), mlog.String("user_id", user.Id))
continue
}
regexes["@"+user.Username] = r
@@ -65,9 +65,9 @@ func slackConvertUserMentions(users []slackUser, posts map[string][]slackPost) m
func slackConvertChannelMentions(channels []slackChannel, posts map[string][]slackPost) map[string][]slackPost {
var regexes = make(map[string]*regexp.Regexp, len(channels))
for _, channel := range channels {
r, err := regexp.Compile("<#" + channel.ID + `(\|` + channel.Name + ")?>")
r, err := regexp.Compile("<#" + channel.Id + `(\|` + channel.Name + ")?>")
if err != nil {
mlog.Warn("Slack Import: Unable to compile the !channel, matching regular expression for the Slack channel.", mlog.String("channel_id", channel.ID), mlog.String("channel_name", channel.Name))
mlog.Warn("Slack Import: Unable to compile the !channel, matching regular expression for the Slack channel.", mlog.String("channel_id", channel.Id), mlog.String("channel_name", channel.Name))
continue
}
regexes["~"+channel.Name] = r

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

@@ -25,7 +25,7 @@ import (
)
type slackChannel struct {
ID string `json:"id"`
Id string `json:"id"`
Name string `json:"name"`
Creator string `json:"creator"`
Members []string `json:"members"`
@@ -45,19 +45,19 @@ type slackProfile struct {
}
type slackUser struct {
ID string `json:"id"`
Id string `json:"id"`
Username string `json:"name"`
Profile slackProfile `json:"profile"`
}
type slackFile struct {
ID string `json:"id"`
Id string `json:"id"`
Title string `json:"title"`
}
type slackPost struct {
User string `json:"user"`
BotID string `json:"bot_id"`
BotId string `json:"bot_id"`
BotUsername string `json:"username"`
Text string `json:"text"`
TimeStamp string `json:"ts"`
@@ -205,7 +205,7 @@ func truncateRunes(s string, i int) string {
return s
}
func (si *SlackImporter) slackAddUsers(teamID string, slackusers []slackUser, importerLog *bytes.Buffer) map[string]*model.User {
func (si *SlackImporter) slackAddUsers(teamId string, slackusers []slackUser, importerLog *bytes.Buffer) map[string]*model.User {
// Log header
importerLog.WriteString(i18n.T("api.slackimport.slack_add_users.created"))
importerLog.WriteString("===============\r\n\r\n")
@@ -213,7 +213,7 @@ func (si *SlackImporter) slackAddUsers(teamID string, slackusers []slackUser, im
addedUsers := make(map[string]*model.User)
// Need the team
team, err := si.store.Team().Get(teamID)
team, err := si.store.Team().Get(teamId)
if err != nil {
importerLog.WriteString(i18n.T("api.slackimport.slack_import.team_fail"))
return addedUsers
@@ -233,8 +233,8 @@ func (si *SlackImporter) slackAddUsers(teamID string, slackusers []slackUser, im
// Check for email conflict and use existing user if found
if existingUser, err := si.store.User().GetByEmail(email); err == nil {
addedUsers[sUser.ID] = existingUser
if err := si.actions.JoinUserToTeam(team, addedUsers[sUser.ID], ""); err != nil {
addedUsers[sUser.Id] = existingUser
if err := si.actions.JoinUserToTeam(team, addedUsers[sUser.Id], ""); err != nil {
importerLog.WriteString(i18n.T("api.slackimport.slack_add_users.merge_existing_failed", map[string]interface{}{"Email": existingUser.Email, "Username": existingUser.Username}))
} else {
importerLog.WriteString(i18n.T("api.slackimport.slack_add_users.merge_existing", map[string]interface{}{"Email": existingUser.Email, "Username": existingUser.Username}))
@@ -256,15 +256,15 @@ func (si *SlackImporter) slackAddUsers(teamID string, slackusers []slackUser, im
importerLog.WriteString(i18n.T("api.slackimport.slack_add_users.unable_import", map[string]interface{}{"Username": sUser.Username}))
continue
}
addedUsers[sUser.ID] = mUser
addedUsers[sUser.Id] = mUser
importerLog.WriteString(i18n.T("api.slackimport.slack_add_users.email_pwd", map[string]interface{}{"Email": newUser.Email, "Password": password}))
}
return addedUsers
}
func (si *SlackImporter) slackAddBotUser(teamID string, log *bytes.Buffer) *model.User {
team, err := si.store.Team().Get(teamID)
func (si *SlackImporter) slackAddBotUser(teamId string, log *bytes.Buffer) *model.User {
team, err := si.store.Team().Get(teamId)
if err != nil {
log.WriteString(i18n.T("api.slackimport.slack_import.team_fail"))
return nil
@@ -292,7 +292,7 @@ func (si *SlackImporter) slackAddBotUser(teamID string, log *bytes.Buffer) *mode
return mUser
}
func (si *SlackImporter) slackAddPosts(teamID string, channel *model.Channel, posts []slackPost, users map[string]*model.User, uploads map[string]*zip.File, botUser *model.User) {
func (si *SlackImporter) slackAddPosts(teamId string, channel *model.Channel, posts []slackPost, users map[string]*model.User, uploads map[string]*zip.File, botUser *model.User) {
sort.Slice(posts, func(i, j int) bool {
return slackConvertTimeStamp(posts[i].TimeStamp) < slackConvertTimeStamp(posts[j].TimeStamp)
})
@@ -316,12 +316,12 @@ func (si *SlackImporter) slackAddPosts(teamID string, channel *model.Channel, po
}
if sPost.Upload {
if sPost.File != nil {
if fileInfo, ok := si.slackUploadFile(sPost.File, uploads, teamID, newPost.ChannelId, newPost.UserId, sPost.TimeStamp); ok {
if fileInfo, ok := si.slackUploadFile(sPost.File, uploads, teamId, newPost.ChannelId, newPost.UserId, sPost.TimeStamp); ok {
newPost.FileIds = append(newPost.FileIds, fileInfo.Id)
}
} else if sPost.Files != nil {
for _, file := range sPost.Files {
if fileInfo, ok := si.slackUploadFile(file, uploads, teamID, newPost.ChannelId, newPost.UserId, sPost.TimeStamp); ok {
if fileInfo, ok := si.slackUploadFile(file, uploads, teamId, newPost.ChannelId, newPost.UserId, sPost.TimeStamp); ok {
newPost.FileIds = append(newPost.FileIds, fileInfo.Id)
}
}
@@ -332,10 +332,10 @@ func (si *SlackImporter) slackAddPosts(teamID string, channel *model.Channel, po
newPost.RootId = threads[sPost.ThreadTS]
newPost.ParentId = threads[sPost.ThreadTS]
}
postID := si.oldImportPost(&newPost)
postId := si.oldImportPost(&newPost)
// If post is thread starter
if sPost.ThreadTS == sPost.TimeStamp {
threads[sPost.ThreadTS] = postID
threads[sPost.ThreadTS] = postId
}
case sPost.Type == "message" && sPost.SubType == "file_comment":
if sPost.Comment == nil {
@@ -362,7 +362,7 @@ func (si *SlackImporter) slackAddPosts(teamID string, channel *model.Channel, po
mlog.Warn("Slack Import: Unable to import the bot message as the bot user does not exist.")
continue
}
if sPost.BotID == "" {
if sPost.BotId == "" {
mlog.Warn("Slack Import: Unable to import bot message as the BotId field is missing.")
continue
}
@@ -381,10 +381,10 @@ func (si *SlackImporter) slackAddPosts(teamID string, channel *model.Channel, po
Type: model.POST_SLACK_ATTACHMENT,
}
postID := si.oldImportIncomingWebhookPost(post, props)
postId := si.oldImportIncomingWebhookPost(post, props)
// If post is thread starter
if sPost.ThreadTS == sPost.TimeStamp {
threads[sPost.ThreadTS] = postID
threads[sPost.ThreadTS] = postId
}
case sPost.Type == "message" && (sPost.SubType == "channel_join" || sPost.SubType == "channel_leave"):
if sPost.User == "" {
@@ -429,10 +429,10 @@ func (si *SlackImporter) slackAddPosts(teamID string, channel *model.Channel, po
Message: "*" + sPost.Text + "*",
CreateAt: slackConvertTimeStamp(sPost.TimeStamp),
}
postID := si.oldImportPost(&newPost)
postId := si.oldImportPost(&newPost)
// If post is thread starter
if sPost.ThreadTS == sPost.TimeStamp {
threads[sPost.ThreadTS] = postID
threads[sPost.ThreadTS] = postId
}
case sPost.Type == "message" && sPost.SubType == "channel_topic":
if sPost.User == "" {
@@ -495,27 +495,27 @@ func (si *SlackImporter) slackAddPosts(teamID string, channel *model.Channel, po
}
}
func (si *SlackImporter) slackUploadFile(slackPostFile *slackFile, uploads map[string]*zip.File, teamID string, channelID string, userID string, slackTimestamp string) (*model.FileInfo, bool) {
func (si *SlackImporter) slackUploadFile(slackPostFile *slackFile, uploads map[string]*zip.File, teamId string, channelId string, userId string, slackTimestamp string) (*model.FileInfo, bool) {
if slackPostFile == nil {
mlog.Warn("Slack Import: Unable to attach the file to the post as the latter has no file section present in Slack export.")
return nil, false
}
file, ok := uploads[slackPostFile.ID]
file, ok := uploads[slackPostFile.Id]
if !ok {
mlog.Warn("Slack Import: Unable to import file as the file is missing from the Slack export zip file.", mlog.String("file_id", slackPostFile.ID))
mlog.Warn("Slack Import: Unable to import file as the file is missing from the Slack export zip file.", mlog.String("file_id", slackPostFile.Id))
return nil, false
}
openFile, err := file.Open()
if err != nil {
mlog.Warn("Slack Import: Unable to open the file from the Slack export.", mlog.String("file_id", slackPostFile.ID), mlog.Err(err))
mlog.Warn("Slack Import: Unable to open the file from the Slack export.", mlog.String("file_id", slackPostFile.Id), mlog.Err(err))
return nil, false
}
defer openFile.Close()
timestamp := utils.TimeFromMillis(slackConvertTimeStamp(slackTimestamp))
uploadedFile, err := si.oldImportFile(timestamp, openFile, teamID, channelID, userID, filepath.Base(file.Name))
uploadedFile, err := si.oldImportFile(timestamp, openFile, teamId, channelId, userId, filepath.Base(file.Name))
if err != nil {
mlog.Warn("Slack Import: An error occurred when uploading file.", mlog.String("file_id", slackPostFile.ID), mlog.Err(err))
mlog.Warn("Slack Import: An error occurred when uploading file.", mlog.String("file_id", slackPostFile.Id), mlog.Err(err))
return nil, false
}
@@ -565,7 +565,7 @@ func slackSanitiseChannelProperties(channel model.Channel) model.Channel {
return channel
}
func (si *SlackImporter) slackAddChannels(teamID string, slackchannels []slackChannel, posts map[string][]slackPost, users map[string]*model.User, uploads map[string]*zip.File, botUser *model.User, importerLog *bytes.Buffer) map[string]*model.Channel {
func (si *SlackImporter) slackAddChannels(teamId string, slackchannels []slackChannel, posts map[string][]slackPost, users map[string]*model.User, uploads map[string]*zip.File, botUser *model.User, importerLog *bytes.Buffer) map[string]*model.Channel {
// Write Header
importerLog.WriteString(i18n.T("api.slackimport.slack_add_channels.added"))
importerLog.WriteString("=================\r\n\r\n")
@@ -573,27 +573,27 @@ func (si *SlackImporter) slackAddChannels(teamID string, slackchannels []slackCh
addedChannels := make(map[string]*model.Channel)
for _, sChannel := range slackchannels {
newChannel := model.Channel{
TeamId: teamID,
TeamId: teamId,
Type: sChannel.Type,
DisplayName: sChannel.Name,
Name: slackConvertChannelName(sChannel.Name, sChannel.ID),
Name: slackConvertChannelName(sChannel.Name, sChannel.Id),
Purpose: sChannel.Purpose.Value,
Header: sChannel.Topic.Value,
}
// Direct message channels in Slack don't have a name so we set the id as name or else the messages won't get imported.
if newChannel.Type == model.CHANNEL_DIRECT {
sChannel.Name = sChannel.ID
sChannel.Name = sChannel.Id
}
newChannel = slackSanitiseChannelProperties(newChannel)
var mChannel *model.Channel
var err error
if mChannel, err = si.store.Channel().GetByName(teamID, sChannel.Name, true); err == nil {
if mChannel, err = si.store.Channel().GetByName(teamId, sChannel.Name, true); err == nil {
// The channel already exists as an active channel. Merge with the existing one.
importerLog.WriteString(i18n.T("api.slackimport.slack_add_channels.merge", map[string]interface{}{"DisplayName": newChannel.DisplayName}))
} else if _, nErr := si.store.Channel().GetDeletedByName(teamID, sChannel.Name); nErr == nil {
} else if _, nErr := si.store.Channel().GetDeletedByName(teamId, sChannel.Name); nErr == nil {
// The channel already exists but has been deleted. Generate a random string for the handle instead.
newChannel.Name = model.NewId()
newChannel = slackSanitiseChannelProperties(newChannel)
@@ -614,8 +614,8 @@ func (si *SlackImporter) slackAddChannels(teamID string, slackchannels []slackCh
si.addSlackUsersToChannel(sChannel.Members, users, mChannel, importerLog)
}
importerLog.WriteString(newChannel.DisplayName + "\r\n")
addedChannels[sChannel.ID] = mChannel
si.slackAddPosts(teamID, mChannel, posts[sChannel.Name], users, uploads, botUser)
addedChannels[sChannel.Id] = mChannel
si.slackAddPosts(teamId, mChannel, posts[sChannel.Name], users, uploads, botUser)
}
return addedChannels
@@ -630,9 +630,9 @@ func (si *SlackImporter) slackAddChannels(teamID string, slackchannels []slackCh
func (si *SlackImporter) oldImportPost(post *model.Post) string {
// Workaround for empty messages, which may be the case if they are webhook posts.
firstIteration := true
firstpostID := ""
firstPostId := ""
if post.ParentId != "" {
firstpostID = post.ParentId
firstPostId = post.ParentId
}
maxPostSize := si.actions.MaxPostSize()
for messageRuneCount := utf8.RuneCountInString(post.Message); messageRuneCount > 0 || firstIteration; messageRuneCount = utf8.RuneCountInString(post.Message) {
@@ -646,8 +646,8 @@ func (si *SlackImporter) oldImportPost(post *model.Post) string {
post.Hashtags, _ = model.ParseHashtags(post.Message)
post.RootId = firstpostID
post.ParentId = firstpostID
post.RootId = firstPostId
post.ParentId = firstPostId
_, err := si.store.Post().Save(post)
if err != nil {
@@ -655,11 +655,11 @@ func (si *SlackImporter) oldImportPost(post *model.Post) string {
}
if firstIteration {
if firstpostID == "" {
firstpostID = post.Id
if firstPostId == "" {
firstPostId = post.Id
}
for _, fileID := range post.FileIds {
if err := si.store.FileInfo().AttachToPost(fileID, post.Id, post.UserId); err != nil {
for _, fileId := range post.FileIds {
if err := si.store.FileInfo().AttachToPost(fileId, post.Id, post.UserId); err != nil {
mlog.Error(
"Error attaching files to post.",
mlog.String("post_id", post.Id),
@@ -677,7 +677,7 @@ func (si *SlackImporter) oldImportPost(post *model.Post) string {
post.Message = remainder
firstIteration = false
}
return firstpostID
return firstPostId
}
func (si *SlackImporter) oldImportUser(team *model.Team, user *model.User) *model.User {
@@ -761,12 +761,12 @@ func (si *SlackImporter) oldImportChannel(channel *model.Channel, sChannel slack
return sc
}
func (si *SlackImporter) oldImportFile(timestamp time.Time, file io.Reader, teamID string, channelID string, userID string, fileName string) (*model.FileInfo, error) {
func (si *SlackImporter) oldImportFile(timestamp time.Time, file io.Reader, teamId string, channelId string, userId string, fileName string) (*model.FileInfo, error) {
buf := bytes.NewBuffer(nil)
io.Copy(buf, file)
data := buf.Bytes()
fileInfo, err := si.actions.DoUploadFile(timestamp, teamID, channelID, userID, fileName, data)
fileInfo, err := si.actions.DoUploadFile(timestamp, teamId, channelId, userId, fileName, data)
if err != nil {
return nil, err
}

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

@@ -38,8 +38,8 @@ func TestSlackConvertChannelName(t *testing.T) {
func TestSlackConvertUserMentions(t *testing.T) {
users := []slackUser{
{ID: "U00000A0A", Username: "firstuser"},
{ID: "U00000B1B", Username: "seconduser"},
{Id: "U00000A0A", Username: "firstuser"},
{Id: "U00000B1B", Username: "seconduser"},
}
posts := map[string][]slackPost{
@@ -81,8 +81,8 @@ func TestSlackConvertUserMentions(t *testing.T) {
func TestSlackConvertChannelMentions(t *testing.T) {
channels := []slackChannel{
{ID: "C000AA00A", Name: "one"},
{ID: "C000BB11B", Name: "two"},
{Id: "C000AA00A", Name: "one"},
{Id: "C000BB11B", Name: "two"},
}
posts := map[string][]slackPost{
@@ -336,7 +336,7 @@ func TestOldImportChannel(t *testing.T) {
u2.Id: u2,
}
sCh := slackChannel{
ID: "someid",
Id: "someid",
Members: []string{u1.Id, "randomID"},
Creator: "randomID2",
}
@@ -356,7 +356,7 @@ func TestOldImportChannel(t *testing.T) {
u1.Id: u1,
}
sCh := slackChannel{
ID: "someid",
Id: "someid",
Members: []string{u1.Id},
Creator: "randomID2",
}
@@ -376,7 +376,7 @@ func TestOldImportChannel(t *testing.T) {
u1.Id: u1,
}
sCh := slackChannel{
ID: "someid",
Id: "someid",
Members: []string{u1.Id},
Creator: "randomID2",
}

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

@@ -84,23 +84,23 @@ func TestUpdateAssetsSubpath(t *testing.T) {
}{
{
"no changes required, empty subpath provided",
baseRootHTML,
baseRootHtml,
baseCss,
baseManifestJSON,
"",
nil,
baseRootHTML,
baseRootHtml,
baseCss,
baseManifestJSON,
},
{
"no changes required",
baseRootHTML,
baseRootHtml,
baseCss,
baseManifestJSON,
"/",
nil,
baseRootHTML,
baseRootHtml,
baseCss,
baseManifestJSON,
},
@@ -117,29 +117,29 @@ func TestUpdateAssetsSubpath(t *testing.T) {
},
{
"content security policy not found (missing unsafe-eval)",
contentSecurityPolicyNotFound2HTML,
contentSecurityPolicyNotFound2Html,
baseCss,
baseManifestJSON,
"/subpath",
fmt.Errorf("failed to find 'Content-Security-Policy' meta tag to rewrite"),
contentSecurityPolicyNotFound2HTML,
contentSecurityPolicyNotFound2Html,
baseCss,
baseManifestJSON,
},
{
"subpath",
baseRootHTML,
baseRootHtml,
baseCss,
baseManifestJSON,
"/subpath",
nil,
subpathRootHTML,
subpathRootHtml,
subpathCSS,
subpathManifestJson,
},
{
"new subpath from old",
subpathRootHTML,
subpathRootHtml,
subpathCSS,
subpathManifestJson,
"/nested/subpath",
@@ -150,12 +150,12 @@ func TestUpdateAssetsSubpath(t *testing.T) {
},
{
"resetting to /",
subpathRootHTML,
subpathRootHtml,
subpathCSS,
baseManifestJSON,
"/",
nil,
baseRootHTML,
baseRootHtml,
baseCss,
baseManifestJSON,
},
@@ -270,13 +270,13 @@ func sToP(s string) *string {
const contentSecurityPolicyNotFoundHtml = `<!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <meta http-equiv=Content-Security-Policy content="script-src 'self' cdn.rudderlabs.com/ js.stripe.com/v3"> <meta http-equiv=X-UA-Compatible content="IE=edge"> <meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"> <meta name=robots content="noindex, nofollow"> <meta name=referrer content=no-referrer> <title>Mattermost</title> <meta name=apple-mobile-web-app-capable content=yes> <meta name=apple-mobile-web-app-status-bar-style content=default> <meta name=mobile-web-app-capable content=yes> <meta name=apple-mobile-web-app-title content=Mattermost> <meta name=application-name content=Mattermost> <meta name=format-detection content="telephone=no"> <link rel=apple-touch-icon sizes=57x57 href=/static/files/78b7e73b41b8731ce2c41c870ecc8886.png> <link rel=apple-touch-icon sizes=60x60 href=/static/files/51d00ffd13afb6d74fd8f6dfdeef768a.png> <link rel=apple-touch-icon sizes=72x72 href=/static/files/23645596f8f78f017bd4d457abb855c4.png> <link rel=apple-touch-icon sizes=76x76 href=/static/files/26e9d72f472663a00b4b206149459fab.png> <link rel=apple-touch-icon sizes=144x144 href=/static/files/7bd91659bf3fc8c68fcd45fc1db9c630.png> <link rel=apple-touch-icon sizes=120x120 href=/static/files/fa69ffe11eb334aaef5aece8d848ca62.png> <link rel=apple-touch-icon sizes=152x152 href=/static/files/f046777feb6ab12fc43b8f9908b1db35.png> <link rel=icon type=image/png sizes=16x16 href=/static/files/02b96247d275680adaaabf01c71c571d.png> <link rel=icon type=image/png sizes=32x32 href=/static/files/1d9020f201a6762421cab8d30624fdd8.png> <link rel=icon type=image/png sizes=96x96 href=/static/files/fe23af39ae98d77dc26ae8586565970f.png> <link rel=icon type=image/png sizes=192x192 href=/static/files/d7ff68a7675f84337cc154c3d4abe713.png> <link rel=manifest href=/static/files/a985ad72552ad069537d6eea81e719c7.json> <link rel=stylesheet class=code_theme> <style>.error-screen{font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding-top:50px;max-width:750px;font-size:14px;color:#333;margin:auto;display:none;line-height:1.5}.error-screen h2{font-size:30px;font-weight:400;line-height:1.2}.error-screen ul{padding-left:15px;line-height:1.7;margin-top:0;margin-bottom:10px}.error-screen hr{color:#ddd;margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.error-screen-visible{display:block}</style> <link href="/static/main.364fd054d7a6d741efc6.css" rel="stylesheet"><script type="text/javascript" src="/static/main.e49599ac425584ffead5.js"></script></head> <body class=font--open_sans> <div id=root> <div class=error-screen> <h2>Cannot connect to Mattermost</h2> <hr/> <p>We're having trouble connecting to Mattermost. If refreshing this page (Ctrl+R or Command+R) does not work, please verify that your computer is connected to the internet.</p> <br/> </div> <div class=loading-screen style=position:relative> <div class=loading__content> <div class="round round-1"></div> <div class="round round-2"></div> <div class="round round-3"></div> </div> </div> </div> <noscript> To use Mattermost, please enable JavaScript. </noscript> </body> </html>`
const contentSecurityPolicyNotFound2HTML = `<!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <meta http-equiv=Content-Security-Policy content="script-src 'self' cdn.rudderlabs.com/ js.stripe.com/v3 'unsafe-eval'"> <meta http-equiv=X-UA-Compatible content="IE=edge"> <meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"> <meta name=robots content="noindex, nofollow"> <meta name=referrer content=no-referrer> <title>Mattermost</title> <meta name=apple-mobile-web-app-capable content=yes> <meta name=apple-mobile-web-app-status-bar-style content=default> <meta name=mobile-web-app-capable content=yes> <meta name=apple-mobile-web-app-title content=Mattermost> <meta name=application-name content=Mattermost> <meta name=format-detection content="telephone=no"> <link rel=apple-touch-icon sizes=57x57 href=/static/files/78b7e73b41b8731ce2c41c870ecc8886.png> <link rel=apple-touch-icon sizes=60x60 href=/static/files/51d00ffd13afb6d74fd8f6dfdeef768a.png> <link rel=apple-touch-icon sizes=72x72 href=/static/files/23645596f8f78f017bd4d457abb855c4.png> <link rel=apple-touch-icon sizes=76x76 href=/static/files/26e9d72f472663a00b4b206149459fab.png> <link rel=apple-touch-icon sizes=144x144 href=/static/files/7bd91659bf3fc8c68fcd45fc1db9c630.png> <link rel=apple-touch-icon sizes=120x120 href=/static/files/fa69ffe11eb334aaef5aece8d848ca62.png> <link rel=apple-touch-icon sizes=152x152 href=/static/files/f046777feb6ab12fc43b8f9908b1db35.png> <link rel=icon type=image/png sizes=16x16 href=/static/files/02b96247d275680adaaabf01c71c571d.png> <link rel=icon type=image/png sizes=32x32 href=/static/files/1d9020f201a6762421cab8d30624fdd8.png> <link rel=icon type=image/png sizes=96x96 href=/static/files/fe23af39ae98d77dc26ae8586565970f.png> <link rel=icon type=image/png sizes=192x192 href=/static/files/d7ff68a7675f84337cc154c3d4abe713.png> <link rel=manifest href=/static/files/a985ad72552ad069537d6eea81e719c7.json> <link rel=stylesheet class=code_theme> <style>.error-screen{font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding-top:50px;max-width:750px;font-size:14px;color:#333;margin:auto;display:none;line-height:1.5}.error-screen h2{font-size:30px;font-weight:400;line-height:1.2}.error-screen ul{padding-left:15px;line-height:1.7;margin-top:0;margin-bottom:10px}.error-screen hr{color:#ddd;margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.error-screen-visible{display:block}</style> <link href="/static/main.364fd054d7a6d741efc6.css" rel="stylesheet"><script type="text/javascript" src="/static/main.e49599ac425584ffead5.js"></script></head> <body class=font--open_sans> <div id=root> <div class=error-screen> <h2>Cannot connect to Mattermost</h2> <hr/> <p>We're having trouble connecting to Mattermost. If refreshing this page (Ctrl+R or Command+R) does not work, please verify that your computer is connected to the internet.</p> <br/> </div> <div class=loading-screen style=position:relative> <div class=loading__content> <div class="round round-1"></div> <div class="round round-2"></div> <div class="round round-3"></div> </div> </div> </div> <noscript> To use Mattermost, please enable JavaScript. </noscript> </body> </html>`
const contentSecurityPolicyNotFound2Html = `<!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <meta http-equiv=Content-Security-Policy content="script-src 'self' cdn.rudderlabs.com/ js.stripe.com/v3 'unsafe-eval'"> <meta http-equiv=X-UA-Compatible content="IE=edge"> <meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"> <meta name=robots content="noindex, nofollow"> <meta name=referrer content=no-referrer> <title>Mattermost</title> <meta name=apple-mobile-web-app-capable content=yes> <meta name=apple-mobile-web-app-status-bar-style content=default> <meta name=mobile-web-app-capable content=yes> <meta name=apple-mobile-web-app-title content=Mattermost> <meta name=application-name content=Mattermost> <meta name=format-detection content="telephone=no"> <link rel=apple-touch-icon sizes=57x57 href=/static/files/78b7e73b41b8731ce2c41c870ecc8886.png> <link rel=apple-touch-icon sizes=60x60 href=/static/files/51d00ffd13afb6d74fd8f6dfdeef768a.png> <link rel=apple-touch-icon sizes=72x72 href=/static/files/23645596f8f78f017bd4d457abb855c4.png> <link rel=apple-touch-icon sizes=76x76 href=/static/files/26e9d72f472663a00b4b206149459fab.png> <link rel=apple-touch-icon sizes=144x144 href=/static/files/7bd91659bf3fc8c68fcd45fc1db9c630.png> <link rel=apple-touch-icon sizes=120x120 href=/static/files/fa69ffe11eb334aaef5aece8d848ca62.png> <link rel=apple-touch-icon sizes=152x152 href=/static/files/f046777feb6ab12fc43b8f9908b1db35.png> <link rel=icon type=image/png sizes=16x16 href=/static/files/02b96247d275680adaaabf01c71c571d.png> <link rel=icon type=image/png sizes=32x32 href=/static/files/1d9020f201a6762421cab8d30624fdd8.png> <link rel=icon type=image/png sizes=96x96 href=/static/files/fe23af39ae98d77dc26ae8586565970f.png> <link rel=icon type=image/png sizes=192x192 href=/static/files/d7ff68a7675f84337cc154c3d4abe713.png> <link rel=manifest href=/static/files/a985ad72552ad069537d6eea81e719c7.json> <link rel=stylesheet class=code_theme> <style>.error-screen{font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding-top:50px;max-width:750px;font-size:14px;color:#333;margin:auto;display:none;line-height:1.5}.error-screen h2{font-size:30px;font-weight:400;line-height:1.2}.error-screen ul{padding-left:15px;line-height:1.7;margin-top:0;margin-bottom:10px}.error-screen hr{color:#ddd;margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.error-screen-visible{display:block}</style> <link href="/static/main.364fd054d7a6d741efc6.css" rel="stylesheet"><script type="text/javascript" src="/static/main.e49599ac425584ffead5.js"></script></head> <body class=font--open_sans> <div id=root> <div class=error-screen> <h2>Cannot connect to Mattermost</h2> <hr/> <p>We're having trouble connecting to Mattermost. If refreshing this page (Ctrl+R or Command+R) does not work, please verify that your computer is connected to the internet.</p> <br/> </div> <div class=loading-screen style=position:relative> <div class=loading__content> <div class="round round-1"></div> <div class="round round-2"></div> <div class="round round-3"></div> </div> </div> </div> <noscript> To use Mattermost, please enable JavaScript. </noscript> </body> </html>`
const baseRootHTML = `<!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <meta http-equiv="Content-Security-Policy" content="script-src 'self' cdn.rudderlabs.com/ js.stripe.com/v3"> <meta http-equiv=X-UA-Compatible content="IE=edge"> <meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"> <meta name=robots content="noindex, nofollow"> <meta name=referrer content=no-referrer> <title>Mattermost</title> <meta name=apple-mobile-web-app-capable content=yes> <meta name=apple-mobile-web-app-status-bar-style content=default> <meta name=mobile-web-app-capable content=yes> <meta name=apple-mobile-web-app-title content=Mattermost> <meta name=application-name content=Mattermost> <meta name=format-detection content="telephone=no"> <link rel=apple-touch-icon sizes=57x57 href=/static/files/78b7e73b41b8731ce2c41c870ecc8886.png> <link rel=apple-touch-icon sizes=60x60 href=/static/files/51d00ffd13afb6d74fd8f6dfdeef768a.png> <link rel=apple-touch-icon sizes=72x72 href=/static/files/23645596f8f78f017bd4d457abb855c4.png> <link rel=apple-touch-icon sizes=76x76 href=/static/files/26e9d72f472663a00b4b206149459fab.png> <link rel=apple-touch-icon sizes=144x144 href=/static/files/7bd91659bf3fc8c68fcd45fc1db9c630.png> <link rel=apple-touch-icon sizes=120x120 href=/static/files/fa69ffe11eb334aaef5aece8d848ca62.png> <link rel=apple-touch-icon sizes=152x152 href=/static/files/f046777feb6ab12fc43b8f9908b1db35.png> <link rel=icon type=image/png sizes=16x16 href=/static/files/02b96247d275680adaaabf01c71c571d.png> <link rel=icon type=image/png sizes=32x32 href=/static/files/1d9020f201a6762421cab8d30624fdd8.png> <link rel=icon type=image/png sizes=96x96 href=/static/files/fe23af39ae98d77dc26ae8586565970f.png> <link rel=icon type=image/png sizes=192x192 href=/static/files/d7ff68a7675f84337cc154c3d4abe713.png> <link rel=manifest href=/static/files/a985ad72552ad069537d6eea81e719c7.json> <link rel=stylesheet class=code_theme> <style>.error-screen{font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding-top:50px;max-width:750px;font-size:14px;color:#333;margin:auto;display:none;line-height:1.5}.error-screen h2{font-size:30px;font-weight:400;line-height:1.2}.error-screen ul{padding-left:15px;line-height:1.7;margin-top:0;margin-bottom:10px}.error-screen hr{color:#ddd;margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.error-screen-visible{display:block}</style> <link href="/static/main.364fd054d7a6d741efc6.css" rel="stylesheet"><script type="text/javascript" src="/static/main.e49599ac425584ffead5.js"></script></head> <body class=font--open_sans> <div id=root> <div class=error-screen> <h2>Cannot connect to Mattermost</h2> <hr/> <p>We're having trouble connecting to Mattermost. If refreshing this page (Ctrl+R or Command+R) does not work, please verify that your computer is connected to the internet.</p> <br/> </div> <div class=loading-screen style=position:relative> <div class=loading__content> <div class="round round-1"></div> <div class="round round-2"></div> <div class="round round-3"></div> </div> </div> </div> <noscript> To use Mattermost, please enable JavaScript. </noscript> </body> </html>`
const baseRootHtml = `<!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <meta http-equiv="Content-Security-Policy" content="script-src 'self' cdn.rudderlabs.com/ js.stripe.com/v3"> <meta http-equiv=X-UA-Compatible content="IE=edge"> <meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"> <meta name=robots content="noindex, nofollow"> <meta name=referrer content=no-referrer> <title>Mattermost</title> <meta name=apple-mobile-web-app-capable content=yes> <meta name=apple-mobile-web-app-status-bar-style content=default> <meta name=mobile-web-app-capable content=yes> <meta name=apple-mobile-web-app-title content=Mattermost> <meta name=application-name content=Mattermost> <meta name=format-detection content="telephone=no"> <link rel=apple-touch-icon sizes=57x57 href=/static/files/78b7e73b41b8731ce2c41c870ecc8886.png> <link rel=apple-touch-icon sizes=60x60 href=/static/files/51d00ffd13afb6d74fd8f6dfdeef768a.png> <link rel=apple-touch-icon sizes=72x72 href=/static/files/23645596f8f78f017bd4d457abb855c4.png> <link rel=apple-touch-icon sizes=76x76 href=/static/files/26e9d72f472663a00b4b206149459fab.png> <link rel=apple-touch-icon sizes=144x144 href=/static/files/7bd91659bf3fc8c68fcd45fc1db9c630.png> <link rel=apple-touch-icon sizes=120x120 href=/static/files/fa69ffe11eb334aaef5aece8d848ca62.png> <link rel=apple-touch-icon sizes=152x152 href=/static/files/f046777feb6ab12fc43b8f9908b1db35.png> <link rel=icon type=image/png sizes=16x16 href=/static/files/02b96247d275680adaaabf01c71c571d.png> <link rel=icon type=image/png sizes=32x32 href=/static/files/1d9020f201a6762421cab8d30624fdd8.png> <link rel=icon type=image/png sizes=96x96 href=/static/files/fe23af39ae98d77dc26ae8586565970f.png> <link rel=icon type=image/png sizes=192x192 href=/static/files/d7ff68a7675f84337cc154c3d4abe713.png> <link rel=manifest href=/static/files/a985ad72552ad069537d6eea81e719c7.json> <link rel=stylesheet class=code_theme> <style>.error-screen{font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding-top:50px;max-width:750px;font-size:14px;color:#333;margin:auto;display:none;line-height:1.5}.error-screen h2{font-size:30px;font-weight:400;line-height:1.2}.error-screen ul{padding-left:15px;line-height:1.7;margin-top:0;margin-bottom:10px}.error-screen hr{color:#ddd;margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.error-screen-visible{display:block}</style> <link href="/static/main.364fd054d7a6d741efc6.css" rel="stylesheet"><script type="text/javascript" src="/static/main.e49599ac425584ffead5.js"></script></head> <body class=font--open_sans> <div id=root> <div class=error-screen> <h2>Cannot connect to Mattermost</h2> <hr/> <p>We're having trouble connecting to Mattermost. If refreshing this page (Ctrl+R or Command+R) does not work, please verify that your computer is connected to the internet.</p> <br/> </div> <div class=loading-screen style=position:relative> <div class=loading__content> <div class="round round-1"></div> <div class="round round-2"></div> <div class="round round-3"></div> </div> </div> </div> <noscript> To use Mattermost, please enable JavaScript. </noscript> </body> </html>`
const baseCss = `@font-face{font-family:FontAwesome;src:url(/static/files/674f50d287a8c48dc19ba404d20fe713.eot);src:url(/static/files/674f50d287a8c48dc19ba404d20fe713.eot?#iefix&v=4.7.0) format("embedded-opentype"),url(/static/files/af7ae505a9eed503f8b8e6982036873e.woff2) format("woff2"),url(/static/files/fee66e712a8a08eef5805a46892932ad.woff) format("woff"),url(/static/files/b06871f281fee6b241d60582ae9369b9.ttf) format("truetype"),url(/static/files/677433a0892aaed7b7d2628c313c9775.svg#fontawesomeregular) format("svg");font-weight:400;font-style:normal}`
const subpathRootHTML = `<!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <meta http-equiv="Content-Security-Policy" content="script-src 'self' cdn.rudderlabs.com/ js.stripe.com/v3 'sha256-tPOjw+tkVs9axL78ZwGtYl975dtyPHB6LYKAO2R3gR4='"> <meta http-equiv=X-UA-Compatible content="IE=edge"> <meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"> <meta name=robots content="noindex, nofollow"> <meta name=referrer content=no-referrer> <title>Mattermost</title> <meta name=apple-mobile-web-app-capable content=yes> <meta name=apple-mobile-web-app-status-bar-style content=default> <meta name=mobile-web-app-capable content=yes> <meta name=apple-mobile-web-app-title content=Mattermost> <meta name=application-name content=Mattermost> <meta name=format-detection content="telephone=no"> <link rel=apple-touch-icon sizes=57x57 href=/subpath/static/files/78b7e73b41b8731ce2c41c870ecc8886.png> <link rel=apple-touch-icon sizes=60x60 href=/subpath/static/files/51d00ffd13afb6d74fd8f6dfdeef768a.png> <link rel=apple-touch-icon sizes=72x72 href=/subpath/static/files/23645596f8f78f017bd4d457abb855c4.png> <link rel=apple-touch-icon sizes=76x76 href=/subpath/static/files/26e9d72f472663a00b4b206149459fab.png> <link rel=apple-touch-icon sizes=144x144 href=/subpath/static/files/7bd91659bf3fc8c68fcd45fc1db9c630.png> <link rel=apple-touch-icon sizes=120x120 href=/subpath/static/files/fa69ffe11eb334aaef5aece8d848ca62.png> <link rel=apple-touch-icon sizes=152x152 href=/subpath/static/files/f046777feb6ab12fc43b8f9908b1db35.png> <link rel=icon type=image/png sizes=16x16 href=/subpath/static/files/02b96247d275680adaaabf01c71c571d.png> <link rel=icon type=image/png sizes=32x32 href=/subpath/static/files/1d9020f201a6762421cab8d30624fdd8.png> <link rel=icon type=image/png sizes=96x96 href=/subpath/static/files/fe23af39ae98d77dc26ae8586565970f.png> <link rel=icon type=image/png sizes=192x192 href=/subpath/static/files/d7ff68a7675f84337cc154c3d4abe713.png> <link rel=manifest href=/subpath/static/files/a985ad72552ad069537d6eea81e719c7.json> <link rel=stylesheet class=code_theme> <style>.error-screen{font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding-top:50px;max-width:750px;font-size:14px;color:#333;margin:auto;display:none;line-height:1.5}.error-screen h2{font-size:30px;font-weight:400;line-height:1.2}.error-screen ul{padding-left:15px;line-height:1.7;margin-top:0;margin-bottom:10px}.error-screen hr{color:#ddd;margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.error-screen-visible{display:block}</style><script>window.publicPath='/subpath/static/'</script> <link href="/subpath/static/main.364fd054d7a6d741efc6.css" rel="stylesheet"><script type="text/javascript" src="/subpath/static/main.e49599ac425584ffead5.js"></script></head> <body class=font--open_sans> <div id=root> <div class=error-screen> <h2>Cannot connect to Mattermost</h2> <hr/> <p>We're having trouble connecting to Mattermost. If refreshing this page (Ctrl+R or Command+R) does not work, please verify that your computer is connected to the internet.</p> <br/> </div> <div class=loading-screen style=position:relative> <div class=loading__content> <div class="round round-1"></div> <div class="round round-2"></div> <div class="round round-3"></div> </div> </div> </div> <noscript> To use Mattermost, please enable JavaScript. </noscript> </body> </html>`
const subpathRootHtml = `<!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <meta http-equiv="Content-Security-Policy" content="script-src 'self' cdn.rudderlabs.com/ js.stripe.com/v3 'sha256-tPOjw+tkVs9axL78ZwGtYl975dtyPHB6LYKAO2R3gR4='"> <meta http-equiv=X-UA-Compatible content="IE=edge"> <meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"> <meta name=robots content="noindex, nofollow"> <meta name=referrer content=no-referrer> <title>Mattermost</title> <meta name=apple-mobile-web-app-capable content=yes> <meta name=apple-mobile-web-app-status-bar-style content=default> <meta name=mobile-web-app-capable content=yes> <meta name=apple-mobile-web-app-title content=Mattermost> <meta name=application-name content=Mattermost> <meta name=format-detection content="telephone=no"> <link rel=apple-touch-icon sizes=57x57 href=/subpath/static/files/78b7e73b41b8731ce2c41c870ecc8886.png> <link rel=apple-touch-icon sizes=60x60 href=/subpath/static/files/51d00ffd13afb6d74fd8f6dfdeef768a.png> <link rel=apple-touch-icon sizes=72x72 href=/subpath/static/files/23645596f8f78f017bd4d457abb855c4.png> <link rel=apple-touch-icon sizes=76x76 href=/subpath/static/files/26e9d72f472663a00b4b206149459fab.png> <link rel=apple-touch-icon sizes=144x144 href=/subpath/static/files/7bd91659bf3fc8c68fcd45fc1db9c630.png> <link rel=apple-touch-icon sizes=120x120 href=/subpath/static/files/fa69ffe11eb334aaef5aece8d848ca62.png> <link rel=apple-touch-icon sizes=152x152 href=/subpath/static/files/f046777feb6ab12fc43b8f9908b1db35.png> <link rel=icon type=image/png sizes=16x16 href=/subpath/static/files/02b96247d275680adaaabf01c71c571d.png> <link rel=icon type=image/png sizes=32x32 href=/subpath/static/files/1d9020f201a6762421cab8d30624fdd8.png> <link rel=icon type=image/png sizes=96x96 href=/subpath/static/files/fe23af39ae98d77dc26ae8586565970f.png> <link rel=icon type=image/png sizes=192x192 href=/subpath/static/files/d7ff68a7675f84337cc154c3d4abe713.png> <link rel=manifest href=/subpath/static/files/a985ad72552ad069537d6eea81e719c7.json> <link rel=stylesheet class=code_theme> <style>.error-screen{font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;padding-top:50px;max-width:750px;font-size:14px;color:#333;margin:auto;display:none;line-height:1.5}.error-screen h2{font-size:30px;font-weight:400;line-height:1.2}.error-screen ul{padding-left:15px;line-height:1.7;margin-top:0;margin-bottom:10px}.error-screen hr{color:#ddd;margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.error-screen-visible{display:block}</style><script>window.publicPath='/subpath/static/'</script> <link href="/subpath/static/main.364fd054d7a6d741efc6.css" rel="stylesheet"><script type="text/javascript" src="/subpath/static/main.e49599ac425584ffead5.js"></script></head> <body class=font--open_sans> <div id=root> <div class=error-screen> <h2>Cannot connect to Mattermost</h2> <hr/> <p>We're having trouble connecting to Mattermost. If refreshing this page (Ctrl+R or Command+R) does not work, please verify that your computer is connected to the internet.</p> <br/> </div> <div class=loading-screen style=position:relative> <div class=loading__content> <div class="round round-1"></div> <div class="round round-2"></div> <div class="round round-3"></div> </div> </div> </div> <noscript> To use Mattermost, please enable JavaScript. </noscript> </body> </html>`
const subpathCSS = `@font-face{font-family:FontAwesome;src:url(/subpath/static/files/674f50d287a8c48dc19ba404d20fe713.eot);src:url(/subpath/static/files/674f50d287a8c48dc19ba404d20fe713.eot?#iefix&v=4.7.0) format("embedded-opentype"),url(/subpath/static/files/af7ae505a9eed503f8b8e6982036873e.woff2) format("woff2"),url(/subpath/static/files/fee66e712a8a08eef5805a46892932ad.woff) format("woff"),url(/subpath/static/files/b06871f281fee6b241d60582ae9369b9.ttf) format("truetype"),url(/subpath/static/files/677433a0892aaed7b7d2628c313c9775.svg#fontawesomeregular) format("svg");font-weight:400;font-style:normal}`