[MM-47542] Extend Plugin API (#21446)
* Extend Plugin API * Use Error, NoError in tests * Address suggestions * Simplify code * Add new line * Add featureflag and GetCollectionMetadataByIds hook * Add enter at the end of file * make build-templates * Fix test * Fix GetCollectionMetadataByIds ret type * Add GetTopicMetadataByIds hook * Add log * Extract i18n * Add experimental notice on hooks * Update model/feature_flags.go * Swap user to userId * Change userId to userID Co-authored-by: Jesse Hallam <jesse.hallam@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
cc69c917f2
Коммит
b8da473da7
@@ -212,3 +212,45 @@ func (hooks *hooksTimerLayer) OnCloudLimitsUpdated(limits *model.ProductLimits)
|
||||
hooks.hooksImpl.OnCloudLimitsUpdated(limits)
|
||||
hooks.recordTime(startTime, "OnCloudLimitsUpdated", true)
|
||||
}
|
||||
|
||||
func (hooks *hooksTimerLayer) UserHasPermissionToCollection(c *Context, userID string, collectionType, collectionId string, permission *model.Permission) (bool, error) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := hooks.hooksImpl.UserHasPermissionToCollection(c, userID, collectionType, collectionId, permission)
|
||||
hooks.recordTime(startTime, "UserHasPermissionToCollection", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (hooks *hooksTimerLayer) GetAllCollectionIDsForUser(c *Context, userID, collectionType string) ([]string, error) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := hooks.hooksImpl.GetAllCollectionIDsForUser(c, userID, collectionType)
|
||||
hooks.recordTime(startTime, "GetAllCollectionIDsForUser", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (hooks *hooksTimerLayer) GetAllUserIdsForCollection(c *Context, collectionType, collectionID string) ([]string, error) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := hooks.hooksImpl.GetAllUserIdsForCollection(c, collectionType, collectionID)
|
||||
hooks.recordTime(startTime, "GetAllUserIdsForCollection", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (hooks *hooksTimerLayer) GetTopicRedirect(c *Context, topicType, topicID string) (string, error) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := hooks.hooksImpl.GetTopicRedirect(c, topicType, topicID)
|
||||
hooks.recordTime(startTime, "GetTopicRedirect", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (hooks *hooksTimerLayer) GetCollectionMetadataByIds(c *Context, collectionType string, collectionIds []string) (map[string]*model.CollectionMetadata, error) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := hooks.hooksImpl.GetCollectionMetadataByIds(c, collectionType, collectionIds)
|
||||
hooks.recordTime(startTime, "GetCollectionMetadataByIds", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (hooks *hooksTimerLayer) GetTopicMetadataByIds(c *Context, topicType string, topicIds []string) (map[string]*model.TopicMetadata, error) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := hooks.hooksImpl.GetTopicMetadataByIds(c, topicType, topicIds)
|
||||
hooks.recordTime(startTime, "GetTopicMetadataByIds", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user