diff --git a/gui/default/index.html b/gui/default/index.html index 966ffb334..6d77767ac 100644 --- a/gui/default/index.html +++ b/gui/default/index.html @@ -248,6 +248,8 @@ +
+
@@ -672,6 +674,7 @@ + diff --git a/gui/default/syncthing/core/notificationDirective.js b/gui/default/syncthing/core/notificationDirective.js new file mode 100644 index 000000000..fc7810f6e --- /dev/null +++ b/gui/default/syncthing/core/notificationDirective.js @@ -0,0 +1,21 @@ +angular.module('syncthing.core') + .directive('notification', function () { + return { + restrict: 'E', + scope: true, + transclude: true, + template: '
', + link: function (scope, elm, attrs) { + scope.visible = function () { + return scope.config.options.unackedNotificationIDs.indexOf(attrs.id) > -1; + } + scope.dismiss = function () { + var idx = scope.config.options.unackedNotificationIDs.indexOf(attrs.id); + if (idx > -1) { + scope.config.options.unackedNotificationIDs.splice(idx, 1); + scope.saveConfig(); + } + } + } + }; +}); diff --git a/gui/default/syncthing/core/notifications.html b/gui/default/syncthing/core/notifications.html new file mode 100644 index 000000000..68dc45418 --- /dev/null +++ b/gui/default/syncthing/core/notifications.html @@ -0,0 +1,16 @@ + diff --git a/lib/config/config.go b/lib/config/config.go index 281de7c20..4a2a9f3a0 100644 --- a/lib/config/config.go +++ b/lib/config/config.go @@ -176,6 +176,9 @@ func (cfg *Configuration) prepare(myID protocol.DeviceID) error { if cfg.Options.AlwaysLocalNets == nil { cfg.Options.AlwaysLocalNets = []string{} } + if cfg.Options.UnackedNotificationIDs == nil { + cfg.Options.UnackedNotificationIDs = []string{} + } // Prepare folders and check for duplicates. Duplicates are bad and // dangerous, can't currently be resolved in the GUI, and shouldn't diff --git a/lib/config/optionsconfiguration.go b/lib/config/optionsconfiguration.go index 0781438e5..bf36a07c2 100644 --- a/lib/config/optionsconfiguration.go +++ b/lib/config/optionsconfiguration.go @@ -40,6 +40,7 @@ type OptionsConfiguration struct { AlwaysLocalNets []string `xml:"alwaysLocalNet" json:"alwaysLocalNets"` OverwriteRemoteDevNames bool `xml:"overwriteRemoteDeviceNamesOnConnect" json:"overwriteRemoteDeviceNamesOnConnect" default:"false"` TempIndexMinBlocks int `xml:"tempIndexMinBlocks" json:"tempIndexMinBlocks" default:"10"` + UnackedNotificationIDs []string `xml:"unackedNotificationID" json:"unackedNotificationIDs"` DeprecatedUPnPEnabled bool `xml:"upnpEnabled,omitempty" json:"-"` DeprecatedUPnPLeaseM int `xml:"upnpLeaseMinutes,omitempty" json:"-"` @@ -56,5 +57,7 @@ func (orig OptionsConfiguration) Copy() OptionsConfiguration { copy(c.GlobalAnnServers, orig.GlobalAnnServers) c.AlwaysLocalNets = make([]string, len(orig.AlwaysLocalNets)) copy(c.AlwaysLocalNets, orig.AlwaysLocalNets) + c.UnackedNotificationIDs = make([]string, len(orig.UnackedNotificationIDs)) + copy(c.UnackedNotificationIDs, orig.UnackedNotificationIDs) return c } diff --git a/lib/model/model.go b/lib/model/model.go index 026634bd2..7b386a819 100644 --- a/lib/model/model.go +++ b/lib/model/model.go @@ -2191,6 +2191,7 @@ func (m *Model) CommitConfiguration(from, to config.Configuration) bool { from.Options.URUniqueID = to.Options.URUniqueID from.Options.ListenAddresses = to.Options.ListenAddresses from.Options.RelaysEnabled = to.Options.RelaysEnabled + from.Options.UnackedNotificationIDs = to.Options.UnackedNotificationIDs // All of the other generic options require restart. Or at least they may; // removing this check requires going through those options carefully and // making sure there are individual services that handle them correctly.