fixed app-layer generator, re-enabled struct2interface in make… (#14260)

* fixed app-layer generator, re-enabled struct2interface in makefile
Этот коммит содержится в:
Eli Yukelzon
2020-04-09 11:08:39 +03:00
коммит произвёл GitHub
родитель 1f036b7588
Коммит 819f57037b
4 изменённых файлов: 194 добавлений и 27 удалений

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

@@ -22,6 +22,7 @@ import (
"github.com/gorilla/websocket"
"github.com/mattermost/go-i18n/i18n"
goi18n "github.com/mattermost/go-i18n/i18n"
"github.com/mattermost/mattermost-server/v5/audit"
"github.com/mattermost/mattermost-server/v5/einterfaces"
"github.com/mattermost/mattermost-server/v5/mlog"
"github.com/mattermost/mattermost-server/v5/model"
@@ -36,6 +37,8 @@ import (
// AppIface is extracted from App struct and contains all it's exported methods. It's provided to allow partial interface passing and app layers creation.
type AppIface interface {
// @openTracingParams args
ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *model.AppError)
// @openTracingParams teamId
// previous ListCommands now ListAutocompleteCommands
ListAutocompleteCommands(teamId string, T goi18n.TranslateFunc) ([]*model.Command, *model.AppError)
@@ -63,7 +66,10 @@ type AppIface interface {
ConvertUserToBot(user *model.User) (*model.Bot, *model.AppError)
// CreateBot creates the given bot and corresponding user.
CreateBot(bot *model.Bot) (*model.Bot, *model.AppError)
// CreateChannelScheme creates a new Scheme of scope channel and assigns it to the channel.
CreateChannelScheme(channel *model.Channel) (*model.Scheme, *model.AppError)
// CreateDefaultChannels creates channels in the given team for each channel returned by (*App).DefaultChannelNames.
//
CreateDefaultChannels(teamID string) ([]*model.Channel, *model.AppError)
// CreateDefaultMemberships adds users to teams and channels based on their group memberships and how those groups
// are configured to sync with teams and channels for group members on or after the given timestamp.
@@ -87,9 +93,12 @@ type AppIface interface {
// However, if TeamSettings.ExperimentalDefaultChannels contains a list of channels then that list will replace
// 'off-topic' and be included in the return results in addition to 'town-square'. For example:
// ['town-square', 'game-of-thrones', 'wow']
//
DefaultChannelNames() []string
// DeleteBotIconImage deletes LHS icon for a bot.
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
// groups of all group-constrained teams and channels.
DeleteGroupConstrainedMemberships() error
@@ -134,6 +143,8 @@ type AppIface interface {
GetBots(options *model.BotGetOptions) (model.BotList, *model.AppError)
// GetChannelGroupUsers returns the users who are associated to the channel via GroupChannels and GroupMembers.
GetChannelGroupUsers(channelID string) ([]*model.User, *model.AppError)
// GetChannelModerationsForChannel Gets a channels ChannelModerations from either the higherScoped roles or from the channel scheme roles.
GetChannelModerationsForChannel(channel *model.Channel) ([]*model.ChannelModeration, *model.AppError)
// GetClusterPluginStatuses returns the status for plugins installed anywhere in the cluster.
GetClusterPluginStatuses() (model.PluginStatuses, *model.AppError)
// GetConfigFile proxies access to the given configuration file to the underlying config store.
@@ -164,8 +175,12 @@ type AppIface interface {
GetPublicKey(name string) ([]byte, *model.AppError)
// GetSanitizedConfig gets the configuration for a system admin without any secrets.
GetSanitizedConfig() *model.Config
// GetSchemeRolesForChannel Checks if a channel or its team has an override scheme for channel roles and returns the scheme roles or default channel roles.
GetSchemeRolesForChannel(channelId string) (guestRoleName string, userRoleName string, adminRoleName string, err *model.AppError)
// GetTeamGroupUsers returns the users who are associated to the team via GroupTeams and GroupMembers.
GetTeamGroupUsers(teamID string) ([]*model.User, *model.AppError)
// GetTeamSchemeChannelRoles Checks if a team has an override scheme and returns the scheme channel role names or default channel role names.
GetTeamSchemeChannelRoles(teamId string) (guestRoleName string, userRoleName string, adminRoleName string, err *model.AppError)
// GetTotalUsersStats is used for the DM list total
GetTotalUsersStats(viewRestrictions *model.ViewUsersRestrictions) (*model.UsersStats, *model.AppError)
// InstallMarketplacePlugin installs a plugin listed in the marketplace server. It will get the plugin bundle
@@ -181,6 +196,12 @@ type AppIface interface {
License() *model.License
// LimitedClientConfigWithComputed gets the configuration in a format suitable for sending to the client.
LimitedClientConfigWithComputed() map[string]string
// LogAuditRec logs an audit record using default CLILevel.
LogAuditRec(rec *audit.Record, err error)
// LogAuditRecWithLevel logs an audit record using specified Level.
LogAuditRecWithLevel(rec *audit.Record, level audit.Level, err error)
// MakeAuditRecord creates a audit record pre-populated with defaults.
MakeAuditRecord(event string, initialStatus string) *audit.Record
// MarkChanelAsUnreadFromPost will take a post and set the channel as unread from that one.
MarkChannelAsUnreadFromPost(postID string, userID string) (*model.ChannelUnreadAt, *model.AppError)
// OverrideIconURLIfEmoji changes the post icon override URL prop, if it has an emoji icon,
@@ -188,6 +209,8 @@ type AppIface interface {
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)
// 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.
// Caller must consume and close returned http.Response as necessary.
// For internal requests, requests are routed directly to a plugin ServerHTTP hook
@@ -256,6 +279,8 @@ type AppIface interface {
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.
UpdateChannelScheme(channel *model.Channel) (*model.Channel, *model.AppError)
// UploadFile uploads a single file in form of a completely constructed byte array for a channel.
UploadFile(data []byte, channelId string, filename string) (*model.FileInfo, *model.AppError)
// UploadFileX uploads a single file as specified in t. It applies the upload
@@ -302,7 +327,7 @@ type AppIface interface {
AsymmetricSigningKey() *ecdsa.PrivateKey
AttachDeviceId(sessionId string, deviceId string, expiresAt int64) *model.AppError
AttachSessionCookies(w http.ResponseWriter, r *http.Request)
AuthenticateUserForLogin(id, loginId, password, mfaToken string, ldapOnly bool) (*model.User, *model.AppError)
AuthenticateUserForLogin(id, loginId, password, mfaToken string, ldapOnly bool) (user *model.User, err *model.AppError)
AuthorizeOAuthUser(w http.ResponseWriter, r *http.Request, service, code, state, redirectUri string) (io.ReadCloser, string, map[string]string, *model.AppError)
AutocompleteChannels(teamId string, term string) (*model.ChannelList, *model.AppError)
AutocompleteChannelsForSearch(teamId string, userId string, term string) (*model.ChannelList, *model.AppError)
@@ -356,7 +381,7 @@ type AppIface interface {
CreateOAuthUser(service string, userData io.Reader, teamId string) (*model.User, *model.AppError)
CreateOutgoingWebhook(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, *model.AppError)
CreatePasswordRecoveryToken(userId, email string) (*model.Token, *model.AppError)
CreatePost(post *model.Post, channel *model.Channel, triggerWebhooks bool) (*model.Post, *model.AppError)
CreatePost(post *model.Post, channel *model.Channel, triggerWebhooks bool) (savedPost *model.Post, err *model.AppError)
CreatePostAsUser(post *model.Post, currentSessionId string) (*model.Post, *model.AppError)
CreatePostMissingChannel(post *model.Post, triggerWebhooks bool) (*model.Post, *model.AppError)
CreateRole(role *model.Role) (*model.Role, *model.AppError)
@@ -412,8 +437,6 @@ type AppIface interface {
DownloadFromURL(downloadURL string) ([]byte, error)
EnableUserAccessToken(token *model.UserAccessToken) *model.AppError
EnvironmentConfig() map[string]interface{}
// @openTracingParams args
ExecuteCommand(args *model.CommandArgs) (*model.CommandResponse, *model.AppError)
ExportPermissions(w io.Writer) error
FetchSamlMetadataFromIdp(url string) ([]byte, *model.AppError)
FileBackend() (filesstore.FileBackend, *model.AppError)
@@ -456,7 +479,6 @@ type AppIface interface {
GetChannelMembersForUserWithPagination(teamId, userId string, page, perPage int) ([]*model.ChannelMember, *model.AppError)
GetChannelMembersPage(channelId string, page, perPage int) (*model.ChannelMembers, *model.AppError)
GetChannelMembersTimezones(channelId string) ([]string, *model.AppError)
GetChannelModerationsForChannel(channel *model.Channel) ([]*model.ChannelModeration, *model.AppError)
GetChannelPinnedPostCount(channelId string) (int64, *model.AppError)
GetChannelUnread(channelId, userId string) (*model.ChannelUnread, *model.AppError)
GetChannelsByNames(channelNames []string, teamId string) ([]*model.Channel, *model.AppError)
@@ -575,7 +597,6 @@ type AppIface interface {
GetSanitizedClientLicense() map[string]string
GetScheme(id string) (*model.Scheme, *model.AppError)
GetSchemeByName(name string) (*model.Scheme, *model.AppError)
GetSchemeRolesForChannel(channelId string) (string, string, string, *model.AppError)
GetSchemeRolesForTeam(teamId string) (string, string, string, *model.AppError)
GetSchemes(scope string, offset int, limit int) ([]*model.Scheme, *model.AppError)
GetSchemesPage(scope string, page int, perPage int) ([]*model.Scheme, *model.AppError)
@@ -658,7 +679,7 @@ type AppIface interface {
HubUnregister(webConn *WebConn)
ImageProxy() *imageproxy.ImageProxy
ImageProxyAdder() func(string) string
ImageProxyRemover() func(string) string
ImageProxyRemover() (f func(string) string)
ImportPermissions(jsonl io.Reader) error
InitPlugins(pluginDir, webappPluginDir string)
InitPostMetadata()
@@ -666,6 +687,7 @@ type AppIface interface {
InvalidateAllCaches() *model.AppError
InvalidateAllCachesSkipSend()
InvalidateAllEmailInvites() *model.AppError
InvalidateCacheForUser(userId string)
InvalidateWebConnSessionCacheForUser(userId string)
InviteGuestsToChannels(teamId string, guestsInvite *model.GuestsInvite, senderId string) *model.AppError
InviteGuestsToChannelsGracefully(teamId string, guestsInvite *model.GuestsInvite, senderId string) ([]*model.EmailInviteWithError, *model.AppError)
@@ -708,7 +730,6 @@ type AppIface interface {
OpenInteractiveDialog(request model.OpenDialogRequest) *model.AppError
OriginChecker() func(*http.Request) bool
PatchChannel(channel *model.Channel, patch *model.ChannelPatch, userId string) (*model.Channel, *model.AppError)
PatchChannelModerationsForChannel(channel *model.Channel, channelModerationsPatch []*model.ChannelModerationPatch) ([]*model.ChannelModeration, *model.AppError)
PatchPost(postId string, patch *model.PostPatch) (*model.Post, *model.AppError)
PatchRole(role *model.Role, patch *model.RolePatch) (*model.Role, *model.AppError)
PatchScheme(scheme *model.Scheme, patch *model.SchemePatch) (*model.Scheme, *model.AppError)
@@ -844,6 +865,7 @@ type AppIface interface {
SetProfileImageFromMultiPartFile(userId string, file multipart.File) *model.AppError
SetRequestId(s string)
SetSamlIdpCertificateFromMetadata(data []byte) *model.AppError
SetSearchEngine(se *searchengine.Broker)
SetServer(srv *Server)
SetSession(s *model.Session)
SetStatusAwayIfNeeded(userId string, manual bool)
@@ -894,7 +916,6 @@ type AppIface interface {
UpdateChannelMemberRoles(channelId string, userId string, newRoles string) (*model.ChannelMember, *model.AppError)
UpdateChannelMemberSchemeRoles(channelId string, userId string, isSchemeGuest bool, isSchemeUser bool, isSchemeAdmin bool) (*model.ChannelMember, *model.AppError)
UpdateChannelPrivacy(oldChannel *model.Channel, user *model.User) (*model.Channel, *model.AppError)
UpdateChannelScheme(channel *model.Channel) (*model.Channel, *model.AppError)
UpdateCommand(oldCmd, updatedCmd *model.Command) (*model.Command, *model.AppError)
UpdateConfig(f func(*model.Config))
UpdateEphemeralPost(userId string, post *model.Post) *model.Post