diff --git a/changelog/unreleased/notif-no-cap.md b/changelog/unreleased/notif-no-cap.md new file mode 100644 index 0000000000..c5b1076c87 --- /dev/null +++ b/changelog/unreleased/notif-no-cap.md @@ -0,0 +1,6 @@ +Enhancement: removed notification capability + +This is not needed any longer, the code was simplified +to enable notifications if they are configured + +https://github.com/cs3org/reva/pull/4493 diff --git a/internal/http/services/owncloud/ocdav/ocdav.go b/internal/http/services/owncloud/ocdav/ocdav.go index a252c43412..1560e86c4b 100644 --- a/internal/http/services/owncloud/ocdav/ocdav.go +++ b/internal/http/services/owncloud/ocdav/ocdav.go @@ -175,7 +175,7 @@ func New(ctx context.Context, m map[string]interface{}) (global.Service, error) httpclient.RoundTripper(tr), ), favoritesManager: fm, - notificationHelper: notificationhelper.New("ocdav", c.Notifications, log), + notificationHelper: notificationhelper.New("ocdav", log), } // initialize handlers and set default cigs diff --git a/internal/http/services/owncloud/ocs/config/config.go b/internal/http/services/owncloud/ocs/config/config.go index d513ab9820..95849d9291 100644 --- a/internal/http/services/owncloud/ocs/config/config.go +++ b/internal/http/services/owncloud/ocs/config/config.go @@ -45,7 +45,6 @@ type Config struct { AllowedLanguages []string `mapstructure:"allowed_languages"` OCMMountPoint string `mapstructure:"ocm_mount_point"` ListOCMShares bool `mapstructure:"list_ocm_shares"` - Notifications map[string]interface{} `mapstructure:"notifications"` } // Init sets sane defaults. diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go index 1829f31b31..005fe4342f 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go @@ -117,7 +117,7 @@ func (h *Handler) Init(c *config.Config, l *zerolog.Logger) { h.ocmMountPoint = c.OCMMountPoint h.listOCMShares = c.ListOCMShares h.Log = l - h.notificationHelper = notificationhelper.New("ocs", c.Notifications, l) + h.notificationHelper = notificationhelper.New("ocs", l) h.additionalInfoTemplate, _ = template.New("additionalInfo").Parse(c.AdditionalInfoAttribute) h.resourceInfoCacheTTL = time.Second * time.Duration(c.ResourceInfoCacheTTL) diff --git a/pkg/notification/notificationhelper/notificationhelper.go b/pkg/notification/notificationhelper/notificationhelper.go index 88f6e93dea..6fe7a1946d 100644 --- a/pkg/notification/notificationhelper/notificationhelper.go +++ b/pkg/notification/notificationhelper/notificationhelper.go @@ -57,7 +57,7 @@ func defaultConfig() *Config { } // New creates a new Notification Helper. -func New(name string, m map[string]interface{}, log *zerolog.Logger) *NotificationHelper { +func New(name string, log *zerolog.Logger) *NotificationHelper { annotatedLogger := log.With().Str("service", name).Str("scope", "notifications").Logger() conf := defaultConfig() @@ -67,18 +67,8 @@ func New(name string, m map[string]interface{}, log *zerolog.Logger) *Notificati Log: &annotatedLogger, } - if len(m) == 0 { - log.Info().Msgf("no 'notifications' field in service config, notifications will be disabled") - return nh - } - - if err := mapstructure.Decode(m, conf); err != nil { - log.Error().Err(err).Msgf("decoding config failed, notifications will be disabled") - return nh - } - if err := nh.connect(); err != nil { - log.Error().Err(err).Msgf("connecting to nats failed, notifications will be disabled") + log.Error().Err(err).Msg("connecting to nats failed, notifications will be disabled") return nh }