app: add posts wrapper (#19816)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
773ec991a8
Коммит
a4a6fe0a94
@@ -215,6 +215,10 @@ func NewChannels(s *Server, services map[ServiceKey]interface{}) (*Channels, err
|
|||||||
pluginsRoute.HandleFunc("/public/{public_file:.*}", ch.ServePluginPublicRequest)
|
pluginsRoute.HandleFunc("/public/{public_file:.*}", ch.ServePluginPublicRequest)
|
||||||
pluginsRoute.HandleFunc("/{anything:.*}", ch.ServePluginRequest)
|
pluginsRoute.HandleFunc("/{anything:.*}", ch.ServePluginRequest)
|
||||||
|
|
||||||
|
services[PostKey] = &postServiceWrapper{
|
||||||
|
app: &App{ch: ch},
|
||||||
|
}
|
||||||
|
|
||||||
return ch, nil
|
return ch, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,14 @@ const (
|
|||||||
|
|
||||||
var atMentionPattern = regexp.MustCompile(`\B@`)
|
var atMentionPattern = regexp.MustCompile(`\B@`)
|
||||||
|
|
||||||
|
type postServiceWrapper struct {
|
||||||
|
app AppIface
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *postServiceWrapper) CreatePost(ctx *request.Context, post *model.Post) (*model.Post, *model.AppError) {
|
||||||
|
return s.app.CreatePostMissingChannel(ctx, post, true)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *App) CreatePostAsUser(c *request.Context, post *model.Post, currentSessionId string, setOnline bool) (*model.Post, *model.AppError) {
|
func (a *App) CreatePostAsUser(c *request.Context, post *model.Post, currentSessionId string, setOnline bool) (*model.Post, *model.AppError) {
|
||||||
// Check that channel has not been deleted
|
// Check that channel has not been deleted
|
||||||
channel, errCh := a.Srv().Store.Channel().Get(post.ChannelId, true)
|
channel, errCh := a.Srv().Store.Channel().Get(post.ChannelId, true)
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ const (
|
|||||||
LicenseKey ServiceKey = "license"
|
LicenseKey ServiceKey = "license"
|
||||||
FilestoreKey ServiceKey = "filestore"
|
FilestoreKey ServiceKey = "filestore"
|
||||||
ClusterKey ServiceKey = "cluster"
|
ClusterKey ServiceKey = "cluster"
|
||||||
|
PostKey ServiceKey = "post"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user