Merge branch 'release/v1.2' of github.com:ONLYOFFICE/AppServer into release/v1.2
This commit is contained in:
commit
f8dd154c88
@ -210,7 +210,7 @@ namespace ASC.Common.Caching
|
||||
|
||||
private string GetChannelName(CacheNotifyAction cacheNotifyAction)
|
||||
{
|
||||
return $"ascchannel{cacheNotifyAction}{typeof(T).FullName}".ToLower();
|
||||
return $"ascchannel{cacheNotifyAction}{typeof(T).FullName}".ToLowerInvariant();
|
||||
}
|
||||
|
||||
public void Unsubscribe(CacheNotifyAction action)
|
||||
|
@ -2357,7 +2357,7 @@ const Dark = {
|
||||
borderBottom: "1px solid #474747",
|
||||
borderTop: "1px solid #474747",
|
||||
externalLinkBackground: "#292929",
|
||||
externalLinkSvg: "#858585",
|
||||
externalLinkSvg: "#eeeeee",
|
||||
|
||||
internalLinkBorder: "1px dashed #eeeeee",
|
||||
|
||||
|
@ -18,14 +18,14 @@ export default function withFileActions(WrappedFileItem) {
|
||||
const { onSelectItem, item } = this.props;
|
||||
const { id, isFolder } = item;
|
||||
|
||||
id !== -1 && onSelectItem({ id, isFolder });
|
||||
id !== -1 && onSelectItem({ id, isFolder }, true, false);
|
||||
};
|
||||
|
||||
onFileContextClick = (withSelect) => {
|
||||
const { onSelectItem } = this.props;
|
||||
const { id, isFolder } = this.props.item;
|
||||
|
||||
id !== -1 && onSelectItem({ id, isFolder }, !withSelect, true);
|
||||
id !== -1 && onSelectItem({ id, isFolder }, !withSelect);
|
||||
};
|
||||
|
||||
onHideContextMenu = () => {
|
||||
|
@ -32,6 +32,7 @@ const FilesMediaViewer = (props) => {
|
||||
setScrollToItem,
|
||||
setCurrentId,
|
||||
setBufferSelection,
|
||||
mediaViewerAudioFormats,
|
||||
} = props;
|
||||
|
||||
useEffect(() => {
|
||||
@ -148,6 +149,8 @@ const FilesMediaViewer = (props) => {
|
||||
}
|
||||
};
|
||||
|
||||
const mediaFormats = [...mediaViewerMediaFormats, ...mediaViewerAudioFormats];
|
||||
|
||||
return (
|
||||
visible && (
|
||||
<MediaViewer
|
||||
@ -163,7 +166,7 @@ const FilesMediaViewer = (props) => {
|
||||
onClose={onMediaViewerClose}
|
||||
onEmptyPlaylistError={onMediaViewerClose}
|
||||
deleteDialogVisible={deleteDialogVisible}
|
||||
extsMediaPreviewed={mediaViewerMediaFormats} //TODO:
|
||||
extsMediaPreviewed={mediaFormats} //TODO:
|
||||
extsImagePreviewed={mediaViewerImageFormats} //TODO:
|
||||
errorLabel={t("Translations:MediaLoadError")}
|
||||
isPreviewFile={!!previewFile}
|
||||
@ -201,7 +204,7 @@ export default inject(
|
||||
setCurrentId,
|
||||
} = mediaViewerDataStore;
|
||||
const { deleteItemAction } = filesActionsStore;
|
||||
const { extsVideo, extsImage } = settingsStore;
|
||||
const { extsVideo, extsImage, extsAudio } = settingsStore;
|
||||
const { expandedKeys, setExpandedKeys } = treeFoldersStore;
|
||||
|
||||
return {
|
||||
@ -214,6 +217,7 @@ export default inject(
|
||||
setMediaViewerData,
|
||||
mediaViewerImageFormats: extsImage,
|
||||
mediaViewerMediaFormats: extsVideo,
|
||||
mediaViewerAudioFormats: extsAudio,
|
||||
setRemoveMediaItem: dialogsStore.setRemoveMediaItem,
|
||||
deleteDialogVisible: dialogsStore.deleteDialogVisible,
|
||||
fetchFiles,
|
||||
|
@ -250,6 +250,7 @@ class ConnectClouds extends React.Component {
|
||||
type="page"
|
||||
title={item.customer_title}
|
||||
//color={theme.filesSettings.linkColor}
|
||||
isHovered={true}
|
||||
color="#A3A9AE"
|
||||
fontSize="11px"
|
||||
fontWeight={400}
|
||||
|
@ -493,7 +493,11 @@ class FilesActionStore {
|
||||
}
|
||||
};
|
||||
|
||||
onSelectItem = ({ id, isFolder }, withSelect = true, isContextItem) => {
|
||||
onSelectItem = (
|
||||
{ id, isFolder },
|
||||
withSelect = true,
|
||||
isContextItem = true
|
||||
) => {
|
||||
const {
|
||||
setBufferSelection,
|
||||
setSelected,
|
||||
|
@ -235,7 +235,8 @@ class SettingsStore {
|
||||
isMediaOrImage = (fileExst) => {
|
||||
if (
|
||||
this.extsVideo.includes(fileExst) ||
|
||||
this.extsImage.includes(fileExst)
|
||||
this.extsImage.includes(fileExst) ||
|
||||
this.extsAudio.includes(fileExst)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Common.Caching;
|
||||
@ -18,8 +17,6 @@ namespace ASC.Web.Core.Notify
|
||||
[Scope]
|
||||
public class StudioNotifyServiceHelper
|
||||
{
|
||||
private readonly ILog _log;
|
||||
|
||||
private ICacheNotify<NotifyItem> Cache { get; }
|
||||
private StudioNotifyHelper StudioNotifyHelper { get; }
|
||||
private AuthContext AuthContext { get; }
|
||||
@ -39,7 +36,6 @@ namespace ASC.Web.Core.Notify
|
||||
TenantManager = tenantManager;
|
||||
CommonLinkUtility = commonLinkUtility;
|
||||
Cache = cache;
|
||||
_log = options.CurrentValue;
|
||||
}
|
||||
|
||||
public void SendNoticeToAsync(INotifyAction action, IRecipient[] recipients, string[] senderNames, params ITagValue[] args)
|
||||
@ -82,62 +78,51 @@ namespace ASC.Web.Core.Notify
|
||||
|
||||
public void SendNoticeToAsync(INotifyAction action, string objectID, IRecipient[] recipients, string[] senderNames, bool checkSubsciption, params ITagValue[] args)
|
||||
{
|
||||
try
|
||||
var item = new NotifyItem
|
||||
{
|
||||
_log.Debug("SendNoticeToAsync begin");
|
||||
var item = new NotifyItem
|
||||
{
|
||||
TenantId = TenantManager.GetCurrentTenant().TenantId,
|
||||
UserId = AuthContext.CurrentAccount.ID.ToString(),
|
||||
Action = (NotifyAction)action,
|
||||
CheckSubsciption = checkSubsciption,
|
||||
BaseUrl = CommonLinkUtility.GetFullAbsolutePath("")
|
||||
};
|
||||
TenantId = TenantManager.GetCurrentTenant().TenantId,
|
||||
UserId = AuthContext.CurrentAccount.ID.ToString(),
|
||||
Action = (NotifyAction)action,
|
||||
CheckSubsciption = checkSubsciption,
|
||||
BaseUrl = CommonLinkUtility.GetFullAbsolutePath("")
|
||||
};
|
||||
|
||||
if (objectID != null)
|
||||
{
|
||||
item.ObjectId = objectID;
|
||||
}
|
||||
if (objectID != null)
|
||||
{
|
||||
item.ObjectId = objectID;
|
||||
}
|
||||
|
||||
if (recipients != null)
|
||||
if (recipients != null)
|
||||
{
|
||||
foreach (var r in recipients)
|
||||
{
|
||||
foreach (var r in recipients)
|
||||
var recipient = new Recipient { Id = r.ID, Name = r.Name };
|
||||
if (r is IDirectRecipient d)
|
||||
{
|
||||
var recipient = new Recipient { Id = r.ID, Name = r.Name };
|
||||
if (r is IDirectRecipient d)
|
||||
{
|
||||
recipient.Addresses.AddRange(d.Addresses);
|
||||
recipient.CheckActivation = d.CheckActivation;
|
||||
}
|
||||
|
||||
if (r is IRecipientsGroup g)
|
||||
{
|
||||
recipient.IsGroup = true;
|
||||
}
|
||||
|
||||
item.Recipients.Add(recipient);
|
||||
recipient.Addresses.AddRange(d.Addresses);
|
||||
recipient.CheckActivation = d.CheckActivation;
|
||||
}
|
||||
|
||||
if (r is IRecipientsGroup g)
|
||||
{
|
||||
recipient.IsGroup = true;
|
||||
}
|
||||
|
||||
item.Recipients.Add(recipient);
|
||||
}
|
||||
|
||||
_log.Debug("SendNoticeToAsync middle");
|
||||
|
||||
if (senderNames != null)
|
||||
{
|
||||
item.SenderNames.AddRange(senderNames);
|
||||
}
|
||||
|
||||
if (args != null)
|
||||
{
|
||||
item.Tags.AddRange(args.Select(r => new Tag { Tag_ = r.Tag, Value = r.Value.ToString() }));
|
||||
}
|
||||
|
||||
Cache.Publish(item, CacheNotifyAction.Any);
|
||||
_log.Debug("SendNoticeToAsync end");
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
if (senderNames != null)
|
||||
{
|
||||
_log.Error("SendNoticeToAsync", e);
|
||||
item.SenderNames.AddRange(senderNames);
|
||||
}
|
||||
|
||||
if (args != null)
|
||||
{
|
||||
item.Tags.AddRange(args.Select(r => new Tag { Tag_ = r.Tag, Value = r.Value.ToString() }));
|
||||
}
|
||||
|
||||
Cache.Publish(item, CacheNotifyAction.Any);
|
||||
}
|
||||
}
|
||||
}
|
@ -31,7 +31,6 @@ using System.Threading;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Common.Caching;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common;
|
||||
using ASC.Core.Configuration;
|
||||
@ -42,7 +41,6 @@ using ASC.Web.Studio.Utility;
|
||||
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Web.Studio.Core.Notify
|
||||
{
|
||||
@ -64,65 +62,49 @@ namespace ASC.Web.Studio.Core.Notify
|
||||
public void OnMessage(NotifyItem item)
|
||||
{
|
||||
using var scope = ServiceProvider.CreateScope();
|
||||
var log = scope.ServiceProvider.GetService<IOptionsMonitor<ILog>>().CurrentValue;
|
||||
|
||||
try
|
||||
var commonLinkUtilitySettings = scope.ServiceProvider.GetService<CommonLinkUtilitySettings>();
|
||||
commonLinkUtilitySettings.ServerUri = item.BaseUrl;
|
||||
var scopeClass = scope.ServiceProvider.GetService<StudioNotifyServiceSenderScope>();
|
||||
var (tenantManager, userManager, securityContext, studioNotifyHelper, _, _) = scopeClass;
|
||||
tenantManager.SetCurrentTenant(item.TenantId);
|
||||
CultureInfo culture = null;
|
||||
|
||||
var client = WorkContext.NotifyContext.NotifyService.RegisterClient(studioNotifyHelper.NotifySource, scope);
|
||||
|
||||
var tenant = tenantManager.GetCurrentTenant(false);
|
||||
|
||||
if (tenant != null)
|
||||
{
|
||||
log.Debug("onMessage try");//temp
|
||||
|
||||
var commonLinkUtilitySettings = scope.ServiceProvider.GetService<CommonLinkUtilitySettings>();
|
||||
commonLinkUtilitySettings.ServerUri = item.BaseUrl;
|
||||
var scopeClass = scope.ServiceProvider.GetService<StudioNotifyServiceSenderScope>();
|
||||
var (tenantManager, userManager, securityContext, studioNotifyHelper, _, _) = scopeClass;
|
||||
tenantManager.SetCurrentTenant(item.TenantId);
|
||||
CultureInfo culture = null;
|
||||
|
||||
var client = WorkContext.NotifyContext.NotifyService.RegisterClient(studioNotifyHelper.NotifySource, scope);
|
||||
|
||||
var tenant = tenantManager.GetCurrentTenant(false);
|
||||
|
||||
if (tenant != null)
|
||||
{
|
||||
culture = tenant.GetCulture();
|
||||
}
|
||||
|
||||
if (Guid.TryParse(item.UserId, out var userId) && !userId.Equals(Constants.Guest.ID) && !userId.Equals(Guid.Empty))
|
||||
{
|
||||
securityContext.AuthenticateMeWithoutCookie(Guid.Parse(item.UserId));
|
||||
var user = userManager.GetUsers(userId);
|
||||
if (!string.IsNullOrEmpty(user.CultureName))
|
||||
{
|
||||
culture = CultureInfo.GetCultureInfo(user.CultureName);
|
||||
}
|
||||
}
|
||||
|
||||
log.Debug("onMessage UserId");//temp
|
||||
|
||||
if (culture != null && !Equals(Thread.CurrentThread.CurrentCulture, culture))
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = culture;
|
||||
}
|
||||
if (culture != null && !Equals(Thread.CurrentThread.CurrentUICulture, culture))
|
||||
{
|
||||
Thread.CurrentThread.CurrentUICulture = culture;
|
||||
}
|
||||
|
||||
log.Debug("onMessage culture");//temp
|
||||
|
||||
client.SendNoticeToAsync(
|
||||
(NotifyAction)item.Action,
|
||||
item.ObjectId,
|
||||
item.Recipients?.Select(r => r.IsGroup ? new RecipientsGroup(r.Id, r.Name) : (IRecipient)new DirectRecipient(r.Id, r.Name, r.Addresses.ToArray(), r.CheckActivation)).ToArray(),
|
||||
item.SenderNames.Count > 0 ? item.SenderNames.ToArray() : null,
|
||||
item.CheckSubsciption,
|
||||
item.Tags.Select(r => new TagValue(r.Tag_, r.Value)).ToArray());
|
||||
|
||||
log.Debug("onMessage send");//temp
|
||||
culture = tenant.GetCulture();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
if (Guid.TryParse(item.UserId, out var userId) && !userId.Equals(Constants.Guest.ID) && !userId.Equals(Guid.Empty))
|
||||
{
|
||||
log.Error("onMessage", e);
|
||||
securityContext.AuthenticateMeWithoutCookie(Guid.Parse(item.UserId));
|
||||
var user = userManager.GetUsers(userId);
|
||||
if (!string.IsNullOrEmpty(user.CultureName))
|
||||
{
|
||||
culture = CultureInfo.GetCultureInfo(user.CultureName);
|
||||
}
|
||||
}
|
||||
|
||||
if (culture != null && !Equals(Thread.CurrentThread.CurrentCulture, culture))
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = culture;
|
||||
}
|
||||
if (culture != null && !Equals(Thread.CurrentThread.CurrentUICulture, culture))
|
||||
{
|
||||
Thread.CurrentThread.CurrentUICulture = culture;
|
||||
}
|
||||
|
||||
client.SendNoticeToAsync(
|
||||
(NotifyAction)item.Action,
|
||||
item.ObjectId,
|
||||
item.Recipients?.Select(r => r.IsGroup ? new RecipientsGroup(r.Id, r.Name) : (IRecipient)new DirectRecipient(r.Id, r.Name, r.Addresses.ToArray(), r.CheckActivation)).ToArray(),
|
||||
item.SenderNames.Count > 0 ? item.SenderNames.ToArray() : null,
|
||||
item.CheckSubsciption,
|
||||
item.Tags.Select(r => new TagValue(r.Tag_, r.Value)).ToArray());
|
||||
}
|
||||
|
||||
public void RegisterSendMethod()
|
||||
|
Loading…
Reference in New Issue
Block a user