Push: fixes
This commit is contained in:
parent
46caff0b0c
commit
ce5009d0c6
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
||||
|
@ -76,8 +76,6 @@ public class FirebaseHelper
|
||||
|
||||
public void SendMessage(NotifyMessage msg)
|
||||
{
|
||||
var data = new Dictionary<string, string>();
|
||||
|
||||
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<FireBaseUser>();
|
||||
|
||||
@ -117,7 +118,7 @@ public class FirebaseHelper
|
||||
Body = msg.Content
|
||||
}
|
||||
};
|
||||
var result = FirebaseMessaging.DefaultInstance.SendAsync(m).Result;
|
||||
FirebaseMessaging.DefaultInstance.SendAsync(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -144,6 +144,21 @@ public class NotifyClient
|
||||
? _filesLinkUtility.GetFileWebPreviewUrl(_fileUtility, fileEntry.Title, fileEntry.Id)
|
||||
: await _pathProvider.GetFolderUrlAsync((Folder<T>)fileEntry);
|
||||
|
||||
Folder<T> folder;
|
||||
|
||||
var fileExtension = "";
|
||||
|
||||
if (fileEntry.FileEntryType == FileEntryType.File)
|
||||
{
|
||||
var file = (File<T>)fileEntry;
|
||||
fileExtension = file.ConvertedExtension;
|
||||
folder = await folderDao.GetFolderAsync(file.ParentId);
|
||||
}
|
||||
else
|
||||
{
|
||||
folder = (Folder<T>)fileEntry;
|
||||
}
|
||||
|
||||
var recipientsProvider = _notifySource.GetRecipientsProvider();
|
||||
|
||||
var action = fileEntry.FileEntryType == FileEntryType.File
|
||||
@ -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<T>)file).ParentId),
|
||||
new AdditionalSenderTag("push.sender")
|
||||
);
|
||||
}
|
||||
|
@ -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";
|
||||
|
@ -82,6 +82,11 @@ $DocumentURL
|
||||
<body styler="ASC.Notify.Textile.TextileStyler,ASC.Notify.Textile" resource="|pattern_ShareFolder|ASC.Files.Core.Services.NotifyService.FilesPatternResource,ASC.Files.Core" />
|
||||
</pattern>
|
||||
|
||||
<pattern id="ShareFolder" sender="push.sender">
|
||||
<subject resource="|subject_ShareFolder|ASC.Files.Core.Services.NotifyService.FilesPatternResource,ASC.Files.Core" />
|
||||
<body styler="ASC.Notify.Textile.PushStyler, ASC.Notify.Textile" resource="|subject_ShareFolder_push|ASC.Files.Core.Services.NotifyService.FilesPatternResource,ASC.Files.Core" />
|
||||
</pattern>
|
||||
|
||||
<pattern id="ShareFolder" sender="messanger.sender">
|
||||
<subject resource="|subject_ShareFolder|ASC.Files.Core.Services.NotifyService.FilesPatternResource,ASC.Files.Core" />
|
||||
<body styler="ASC.Notify.Textile.JabberStyler, ASC.Notify.Textile">$__AuthorName
|
||||
@ -107,6 +112,12 @@ $Message
|
||||
<subject resource="|subject_EditorMentions|ASC.Files.Core.Services.NotifyService.FilesPatternResource,ASC.Files.Core" />
|
||||
<body styler="ASC.Notify.Textile.TextileStyler,ASC.Notify.Textile" resource="|pattern_EditorMentions|ASC.Files.Core.Services.NotifyService.FilesPatternResource,ASC.Files.Core" />
|
||||
</pattern>
|
||||
|
||||
<pattern id="EditorMentions" sender="push.sender">
|
||||
<subject resource="|subject_EditorMentions|ASC.Files.Core.Services.NotifyService.FilesPatternResource,ASC.Files.Core" />
|
||||
<body styler="ASC.Notify.Textile.PushStyler, ASC.Notify.Textile" resource="|subject_EditorMentions_push|ASC.Files.Core.Services.NotifyService.FilesPatternResource,ASC.Files.Core" />
|
||||
</pattern>
|
||||
|
||||
<pattern id="EditorMentions" sender="messanger.sender">
|
||||
<subject resource="|subject_EditorMentions|ASC.Files.Core.Services.NotifyService.FilesPatternResource,ASC.Files.Core" />
|
||||
<body styler="ASC.Notify.Textile.JabberStyler, ASC.Notify.Textile">$__AuthorName
|
||||
|
Loading…
Reference in New Issue
Block a user