diff --git a/common/ASC.Core.Common/EF/FireBaseUser.cs b/common/ASC.Core.Common/EF/FireBaseUser.cs index 4ce05ae354..9c3e2b6512 100644 --- a/common/ASC.Core.Common/EF/FireBaseUser.cs +++ b/common/ASC.Core.Common/EF/FireBaseUser.cs @@ -24,12 +24,6 @@ // content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace ASC.Core.Common.EF; public class FireBaseUser : BaseEntity diff --git a/common/ASC.Core.Common/Notify/Push/Dao/FirebaseDao.cs b/common/ASC.Core.Common/Notify/Push/Dao/FirebaseDao.cs index c750bdac2e..ad6bc0ab9e 100644 --- a/common/ASC.Core.Common/Notify/Push/Dao/FirebaseDao.cs +++ b/common/ASC.Core.Common/Notify/Push/Dao/FirebaseDao.cs @@ -24,12 +24,6 @@ // content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace ASC.Core.Common.Notify.Push; diff --git a/common/ASC.Core.Common/Notify/Push/FirebaseHelper.cs b/common/ASC.Core.Common/Notify/Push/FirebaseHelper.cs index f091894196..23e0ff8432 100644 --- a/common/ASC.Core.Common/Notify/Push/FirebaseHelper.cs +++ b/common/ASC.Core.Common/Notify/Push/FirebaseHelper.cs @@ -76,8 +76,6 @@ public class FirebaseHelper public void SendMessage(NotifyMessage msg) { - var data = new Dictionary(); - var tenant = _tenantManager.GetCurrentTenant(false); if (tenant == null) @@ -88,7 +86,10 @@ public class FirebaseHelper Guid productID; - if (!Guid.TryParse(msg.ProductID, out productID)) return; + if (!Guid.TryParse(msg.ProductID, out productID)) + { + return; + } var fireBaseUser = new List(); @@ -117,7 +118,7 @@ public class FirebaseHelper Body = msg.Content } }; - var result = FirebaseMessaging.DefaultInstance.SendAsync(m).Result; + FirebaseMessaging.DefaultInstance.SendAsync(m); } } } diff --git a/common/ASC.Core.Common/Notify/PushSenderSink.cs b/common/ASC.Core.Common/Notify/PushSenderSink.cs index 0dd1b3585a..2c6e5fea4f 100644 --- a/common/ASC.Core.Common/Notify/PushSenderSink.cs +++ b/common/ASC.Core.Common/Notify/PushSenderSink.cs @@ -106,7 +106,7 @@ public class PushSenderSinkMessageCreator : SinkMessageCreator var productID = message.Arguments.FirstOrDefault(x => x.Tag.Equals("__ProductID")); var originalUrl = message.Arguments.FirstOrDefault(x => x.Tag.Equals("DocumentURL")); - var folderId = message.Arguments.FirstOrDefault(x => x.Tag.Equals("FolderId")); + var folderId = message.Arguments.FirstOrDefault(x => x.Tag.Equals("FolderID")); var rootFolderId = message.Arguments.FirstOrDefault(x => x.Tag.Equals("FolderParentId")); var rootFolderType = message.Arguments.FirstOrDefault(x => x.Tag.Equals("FolderRootFolderType")); diff --git a/common/ASC.Core.Common/Notify/Senders/PushSender.cs b/common/ASC.Core.Common/Notify/Senders/PushSender.cs index 9d2c3aa31a..427abc673a 100644 --- a/common/ASC.Core.Common/Notify/Senders/PushSender.cs +++ b/common/ASC.Core.Common/Notify/Senders/PushSender.cs @@ -34,7 +34,7 @@ public class PushSender : INotifySender public PushSender(ILoggerProvider options, IServiceProvider serviceProvider) { - _logger = options.CreateLogger("ASC"); + _logger = options.CreateLogger("ASC.Notify"); _serviceProvider = serviceProvider; } diff --git a/products/ASC.Files/Core/Services/NotifyService/NotifyClient.cs b/products/ASC.Files/Core/Services/NotifyService/NotifyClient.cs index 05284e6bcd..ef6d6300ae 100644 --- a/products/ASC.Files/Core/Services/NotifyService/NotifyClient.cs +++ b/products/ASC.Files/Core/Services/NotifyService/NotifyClient.cs @@ -143,6 +143,21 @@ public class NotifyClient var url = fileEntry.FileEntryType == FileEntryType.File ? _filesLinkUtility.GetFileWebPreviewUrl(_fileUtility, fileEntry.Title, fileEntry.Id) : await _pathProvider.GetFolderUrlAsync((Folder)fileEntry); + + Folder folder; + + var fileExtension = ""; + + if (fileEntry.FileEntryType == FileEntryType.File) + { + var file = (File)fileEntry; + fileExtension = file.ConvertedExtension; + folder = await folderDao.GetFolderAsync(file.ParentId); + } + else + { + folder = (Folder)fileEntry; + } var recipientsProvider = _notifySource.GetRecipientsProvider(); @@ -170,8 +185,12 @@ public class NotifyClient true, new TagValue(NotifyConstants.TagDocumentTitle, fileEntry.Title), new TagValue(NotifyConstants.TagDocumentUrl, _baseCommonLinkUtility.GetFullAbsolutePath(url)), + new TagValue(NotifyConstants.TagDocumentExtension, fileExtension), new TagValue(NotifyConstants.TagAccessRights, aceString), new TagValue(NotifyConstants.TagMessage, message.HtmlEncode()), + new TagValue(NotifyConstants.TagFolderID, folder.Id), + new TagValue(NotifyConstants.TagFolderParentId, folder.RootId), + new TagValue(NotifyConstants.TagFolderRootFolderType, folder.RootFolderType), TagValues.Image(_studioNotifyHelper, 0, "privacy.png"), new AdditionalSenderTag("push.sender") ); @@ -203,6 +222,7 @@ public class NotifyClient new TagValue(NotifyConstants.TagDocumentTitle, file.Title), new TagValue(NotifyConstants.TagDocumentUrl, _baseCommonLinkUtility.GetFullAbsolutePath(documentUrl)), new TagValue(NotifyConstants.TagMessage, message.HtmlEncode()), + new TagValue(NotifyConstants.TagFolderID, ((File)file).ParentId), new AdditionalSenderTag("push.sender") ); } diff --git a/products/ASC.Files/Core/Services/NotifyService/NotifyConstants.cs b/products/ASC.Files/Core/Services/NotifyService/NotifyConstants.cs index 0e715c63f0..81df1d90f2 100644 --- a/products/ASC.Files/Core/Services/NotifyService/NotifyConstants.cs +++ b/products/ASC.Files/Core/Services/NotifyService/NotifyConstants.cs @@ -43,8 +43,11 @@ public static class NotifyConstants #region Tags public static readonly string TagFolderID = "FolderID"; + public static readonly string TagFolderParentId = "FolderParentId"; + public static readonly string TagFolderRootFolderType = "FolderRootFolderType"; public static readonly string TagDocumentTitle = "DocumentTitle"; public static readonly string TagDocumentUrl = "DocumentURL"; + public static readonly string TagDocumentExtension = "DocumentExtension"; public static readonly string TagAccessRights = "AccessRights"; public static readonly string TagMessage = "Message"; public static readonly string TagMailsCount = "MailsCount"; diff --git a/products/ASC.Files/Core/Services/NotifyService/patterns.xml b/products/ASC.Files/Core/Services/NotifyService/patterns.xml index f81ad25612..fab5a6172d 100644 --- a/products/ASC.Files/Core/Services/NotifyService/patterns.xml +++ b/products/ASC.Files/Core/Services/NotifyService/patterns.xml @@ -82,6 +82,11 @@ $DocumentURL + + + + + $__AuthorName @@ -107,6 +112,12 @@ $Message + + + + + + $__AuthorName