You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by ro...@apache.org on 2024/09/04 02:40:21 UTC
(incubator-answer-plugins) 01/10: fix(embed):Fixed #189, Closes #189. add GetEmbedConfigs to fixed type conflict. It will be resolved when Answer v1.4.0 release.
This is an automated email from the ASF dual-hosted git repository.
robin0716 pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-answer-plugins.git
commit 5dfea2a53161ef73164663ef26ee19d3ce00d200
Author: kumfo <ku...@sifou.com>
AuthorDate: Mon Aug 19 16:20:35 2024 +0800
fix(embed):Fixed #189, Closes #189. add GetEmbedConfigs to fixed type conflict. It will be resolved when Answer v1.4.0 release.
---
embed-basic/basic.go | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/embed-basic/basic.go b/embed-basic/basic.go
index 624be07..3d81378 100644
--- a/embed-basic/basic.go
+++ b/embed-basic/basic.go
@@ -23,6 +23,7 @@ import (
"embed"
"encoding/json"
"github.com/apache/incubator-answer-plugins/util"
+ "github.com/gin-gonic/gin"
"github.com/apache/incubator-answer-plugins/embed-basic/i18n"
"github.com/apache/incubator-answer/plugin"
@@ -163,3 +164,15 @@ func (e *Embed) ConfigReceiver(config []byte) error {
e.Config = c
return nil
}
+
+// GetEmbedConfigs get embed configs
+func (e *Embed) GetEmbedConfigs(ctx *gin.Context) (embedConfigs []*plugin.EmbedConfig, err error) {
+ embedConfigs = make([]*plugin.EmbedConfig, 0)
+ for _, field := range e.ConfigFields() {
+ embedConfigs = append(embedConfigs, &plugin.EmbedConfig{
+ Platform: field.Name,
+ Enable: field.Value.(bool),
+ })
+ }
+ return
+}