DocSpace-buildtools/web/ASC.Web.Core/Notify/StudioWhatsNewNotify.cs

355 lines
16 KiB
C#
Raw Normal View History

2022-03-15 18:00:53 +00:00
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// 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
2022-02-10 18:31:44 +00:00
2022-03-17 15:13:38 +00:00
namespace ASC.Web.Studio.Core.Notify;
2022-03-24 11:57:39 +00:00
[Scope]
2022-03-17 15:13:38 +00:00
public class StudioWhatsNewNotify
2020-10-19 15:53:15 +00:00
{
2022-03-29 10:53:05 +00:00
private readonly ILog _log;
private readonly WebItemManager _webItemManager;
2022-03-24 11:57:39 +00:00
private readonly TenantManager _tenantManager;
private readonly PaymentManager _paymentManager;
private readonly TenantUtil _tenantUtil;
private readonly StudioNotifyHelper _studioNotifyHelper;
private readonly UserManager _userManager;
private readonly SecurityContext _securityContext;
private readonly AuthManager _authManager;
private readonly CommonLinkUtility _commonLinkUtility;
private readonly DisplayUserSettingsHelper _displayUserSettingsHelper;
private readonly FeedAggregateDataProvider _feedAggregateDataProvider;
private readonly CoreSettings _coreSettings;
2022-03-31 17:32:46 +00:00
private readonly NotifyEngineQueue _notifyEngineQueue;
2022-03-24 11:57:39 +00:00
private readonly IConfiguration _confuguration;
2022-03-25 14:51:03 +00:00
private readonly WorkContext _workContext;
2022-03-17 15:13:38 +00:00
private readonly IMapper _mapper;
2022-03-29 10:53:05 +00:00
public StudioWhatsNewNotify(
2022-03-24 11:57:39 +00:00
TenantManager tenantManager,
PaymentManager paymentManager,
TenantUtil tenantUtil,
StudioNotifyHelper studioNotifyHelper,
UserManager userManager,
SecurityContext securityContext,
AuthManager authManager,
CommonLinkUtility commonLinkUtility,
DisplayUserSettingsHelper displayUserSettingsHelper,
FeedAggregateDataProvider feedAggregateDataProvider,
CoreSettings coreSettings,
2022-03-31 17:32:46 +00:00
NotifyEngineQueue notifyEngineQueue,
2022-03-24 11:57:39 +00:00
IConfiguration confuguration,
2022-03-25 14:51:03 +00:00
WorkContext workContext,
2022-03-24 11:57:39 +00:00
IOptionsMonitor<ILog> optionsMonitor,
2022-03-29 10:53:05 +00:00
IMapper mapper,
WebItemManager webItemManager)
2022-03-17 15:13:38 +00:00
{
2022-03-29 10:53:05 +00:00
_webItemManager = webItemManager;
2022-03-24 11:57:39 +00:00
_tenantManager = tenantManager;
_paymentManager = paymentManager;
_tenantUtil = tenantUtil;
_studioNotifyHelper = studioNotifyHelper;
_userManager = userManager;
_securityContext = securityContext;
_authManager = authManager;
_commonLinkUtility = commonLinkUtility;
_displayUserSettingsHelper = displayUserSettingsHelper;
_feedAggregateDataProvider = feedAggregateDataProvider;
_coreSettings = coreSettings;
2022-03-31 17:32:46 +00:00
_notifyEngineQueue = notifyEngineQueue;
2022-03-24 11:57:39 +00:00
_confuguration = confuguration;
2022-03-25 14:51:03 +00:00
_workContext = workContext;
2022-03-17 15:13:38 +00:00
_mapper = mapper;
2022-03-29 10:53:05 +00:00
_log = optionsMonitor.Get("ASC.Notify");
2022-03-17 15:13:38 +00:00
}
public void SendMsgWhatsNew(DateTime scheduleDate)
{
2022-03-29 10:53:05 +00:00
if (_webItemManager.GetItemsAll<IProduct>().Count == 0)
2022-03-17 15:13:38 +00:00
{
2022-03-29 10:53:05 +00:00
_log.Info("No products. Return from function");
2022-03-17 15:13:38 +00:00
return;
2020-10-12 16:23:15 +00:00
}
2022-03-29 10:53:05 +00:00
_log.Info("Start send whats new.");
Merge branch 'feature/backend-refactor' into feature/warnings # Conflicts: # common/ASC.Common/Threading/DistributedTaskProgress.cs # common/ASC.Common/Threading/DistributedTaskQueue.cs # common/ASC.Core.Common/Configuration/AmiPublicDnsSyncService.cs # common/ASC.Core.Common/Notify/Engine/NotifyRequest.cs # common/ASC.Core.Common/Notify/Model/NotifyClientImpl.cs # common/ASC.Core.Common/Security/EmailValidationKeyProvider.cs # common/ASC.Data.Reassigns/QueueWorker.cs # common/ASC.Data.Reassigns/ReassignProgressItem.cs # common/ASC.Data.Reassigns/RemoveProgressItem.cs # common/ASC.Data.Storage/StaticUploader.cs # products/ASC.Files/Core/ApiModels/ResponseDto/FileDto.cs # products/ASC.Files/Core/ApiModels/ResponseDto/FolderDto.cs # products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs # products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs # products/ASC.Files/Core/Core/Dao/TeamlabDao/TagDao.cs # products/ASC.Files/Core/Core/Thirdparty/Box/BoxDaoBase.cs # products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxDaoBase.cs # products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveDaoBase.cs # products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs # products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveDaoBase.cs # products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderSecutiryDao.cs # products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxDaoBase.cs # products/ASC.Files/Core/HttpHandlers/FileHandler.ashx.cs # products/ASC.Files/Core/HttpHandlers/ThirdPartyAppHandler.ashx.cs # products/ASC.Files/Core/HttpHandlers/docusignhandler.ashx.cs # products/ASC.Files/Core/Services/DocumentService/DocumentServiceTracker.cs # products/ASC.Files/Core/Services/WCFService/FileOperations/FileDownloadOperation.cs # products/ASC.Files/Core/Services/WCFService/FileOperations/FileOperation.cs # products/ASC.Files/Core/Utils/EntryManager.cs # web/ASC.Web.Core/CollaboratorSettings.cs # web/ASC.Web.Core/CustomNavigationSettings.cs # web/ASC.Web.Core/EmailActivationSettings.cs # web/ASC.Web.Core/Notify/NotifyConfiguration.cs # web/ASC.Web.Core/Notify/SpamEmailSettings.cs # web/ASC.Web.Core/Notify/StudioNotifyHelper.cs # web/ASC.Web.Core/Notify/StudioNotifyService.cs # web/ASC.Web.Core/Notify/StudioNotifyServiceSender.cs # web/ASC.Web.Core/Notify/StudioPeriodicNotify.cs # web/ASC.Web.Core/Notify/StudioWhatsNewNotify.cs # web/ASC.Web.Core/PersonalSettings.cs # web/ASC.Web.Core/PrivacyRoomSettings.cs # web/ASC.Web.Core/PromotionsSettings.cs # web/ASC.Web.Core/QuotaSync.cs # web/ASC.Web.Core/Sms/SmsSender.cs # web/ASC.Web.Core/Sms/StudioSmsNotificationSettings.cs # web/ASC.Web.Core/StudioAdminMessageSettings.cs # web/ASC.Web.Core/StudioDefaultPageSettings.cs # web/ASC.Web.Core/StudioTrustedDomainSettings.cs # web/ASC.Web.Core/TariffSettings.cs # web/ASC.Web.Core/Tfa/TfaAppAuthSettings.cs # web/ASC.Web.Core/Tfa/TfaAppUserSettings.cs # web/ASC.Web.Core/TipsSettings.cs # web/ASC.Web.Core/Users/CustomNamingPeople.cs # web/ASC.Web.Core/Users/UserHelpTourSettings.cs # web/ASC.Web.Core/Users/UserPhotoManager.cs # web/ASC.Web.Core/Users/UserPhotoThumbnailManager.cs # web/ASC.Web.Core/Users/UserPhotoThumbnailSettings.cs # web/ASC.Web.Core/Utility/ColorThemesSettings.cs # web/ASC.Web.Core/Utility/PasswordSettings.cs # web/ASC.Web.Core/Utility/Settings/TenantAccessSettings.cs # web/ASC.Web.Core/Utility/Settings/WebItemSettings.cs # web/ASC.Web.Core/Utility/Settings/WizardSettings.cs # web/ASC.Web.Core/Utility/TenantExtra.cs # web/ASC.Web.Core/WhiteLabel/AdditionalWhiteLabelSettings.cs # web/ASC.Web.Core/WhiteLabel/CompanyWhiteLabelSettings.cs # web/ASC.Web.Core/WhiteLabel/TenantInfoSettings.cs # web/ASC.Web.Core/WhiteLabel/TenantWhiteLabelSettings.cs
2022-04-14 12:21:06 +00:00
2022-03-29 10:53:05 +00:00
var products = _webItemManager.GetItemsAll().ToDictionary(p => p.GetSysName());
var tenants = GetChangedTenants(scheduleDate);
foreach (var tenantid in tenants)
Merge branch 'feature/backend-refactor' into feature/warnings # Conflicts: # common/ASC.Common/Threading/DistributedTaskProgress.cs # common/ASC.Common/Threading/DistributedTaskQueue.cs # common/ASC.Core.Common/Configuration/AmiPublicDnsSyncService.cs # common/ASC.Core.Common/Notify/Engine/NotifyRequest.cs # common/ASC.Core.Common/Notify/Model/NotifyClientImpl.cs # common/ASC.Core.Common/Security/EmailValidationKeyProvider.cs # common/ASC.Data.Reassigns/QueueWorker.cs # common/ASC.Data.Reassigns/ReassignProgressItem.cs # common/ASC.Data.Reassigns/RemoveProgressItem.cs # common/ASC.Data.Storage/StaticUploader.cs # products/ASC.Files/Core/ApiModels/ResponseDto/FileDto.cs # products/ASC.Files/Core/ApiModels/ResponseDto/FolderDto.cs # products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs # products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs # products/ASC.Files/Core/Core/Dao/TeamlabDao/TagDao.cs # products/ASC.Files/Core/Core/Thirdparty/Box/BoxDaoBase.cs # products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxDaoBase.cs # products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveDaoBase.cs # products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs # products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveDaoBase.cs # products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderSecutiryDao.cs # products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxDaoBase.cs # products/ASC.Files/Core/HttpHandlers/FileHandler.ashx.cs # products/ASC.Files/Core/HttpHandlers/ThirdPartyAppHandler.ashx.cs # products/ASC.Files/Core/HttpHandlers/docusignhandler.ashx.cs # products/ASC.Files/Core/Services/DocumentService/DocumentServiceTracker.cs # products/ASC.Files/Core/Services/WCFService/FileOperations/FileDownloadOperation.cs # products/ASC.Files/Core/Services/WCFService/FileOperations/FileOperation.cs # products/ASC.Files/Core/Utils/EntryManager.cs # web/ASC.Web.Core/CollaboratorSettings.cs # web/ASC.Web.Core/CustomNavigationSettings.cs # web/ASC.Web.Core/EmailActivationSettings.cs # web/ASC.Web.Core/Notify/NotifyConfiguration.cs # web/ASC.Web.Core/Notify/SpamEmailSettings.cs # web/ASC.Web.Core/Notify/StudioNotifyHelper.cs # web/ASC.Web.Core/Notify/StudioNotifyService.cs # web/ASC.Web.Core/Notify/StudioNotifyServiceSender.cs # web/ASC.Web.Core/Notify/StudioPeriodicNotify.cs # web/ASC.Web.Core/Notify/StudioWhatsNewNotify.cs # web/ASC.Web.Core/PersonalSettings.cs # web/ASC.Web.Core/PrivacyRoomSettings.cs # web/ASC.Web.Core/PromotionsSettings.cs # web/ASC.Web.Core/QuotaSync.cs # web/ASC.Web.Core/Sms/SmsSender.cs # web/ASC.Web.Core/Sms/StudioSmsNotificationSettings.cs # web/ASC.Web.Core/StudioAdminMessageSettings.cs # web/ASC.Web.Core/StudioDefaultPageSettings.cs # web/ASC.Web.Core/StudioTrustedDomainSettings.cs # web/ASC.Web.Core/TariffSettings.cs # web/ASC.Web.Core/Tfa/TfaAppAuthSettings.cs # web/ASC.Web.Core/Tfa/TfaAppUserSettings.cs # web/ASC.Web.Core/TipsSettings.cs # web/ASC.Web.Core/Users/CustomNamingPeople.cs # web/ASC.Web.Core/Users/UserHelpTourSettings.cs # web/ASC.Web.Core/Users/UserPhotoManager.cs # web/ASC.Web.Core/Users/UserPhotoThumbnailManager.cs # web/ASC.Web.Core/Users/UserPhotoThumbnailSettings.cs # web/ASC.Web.Core/Utility/ColorThemesSettings.cs # web/ASC.Web.Core/Utility/PasswordSettings.cs # web/ASC.Web.Core/Utility/Settings/TenantAccessSettings.cs # web/ASC.Web.Core/Utility/Settings/WebItemSettings.cs # web/ASC.Web.Core/Utility/Settings/WizardSettings.cs # web/ASC.Web.Core/Utility/TenantExtra.cs # web/ASC.Web.Core/WhiteLabel/AdditionalWhiteLabelSettings.cs # web/ASC.Web.Core/WhiteLabel/CompanyWhiteLabelSettings.cs # web/ASC.Web.Core/WhiteLabel/TenantInfoSettings.cs # web/ASC.Web.Core/WhiteLabel/TenantWhiteLabelSettings.cs
2022-04-14 12:21:06 +00:00
{
2022-03-29 10:53:05 +00:00
SendMsgWhatsNew(tenantid, scheduleDate, products);
}
}
2022-03-17 15:13:38 +00:00
2022-03-29 10:53:05 +00:00
private IEnumerable<int> GetChangedTenants(DateTime date)
{
return _feedAggregateDataProvider.GetTenants(new TimeInterval(date.Date.AddDays(-1), date.Date.AddSeconds(-1)));
}
2022-03-17 15:13:38 +00:00
2022-03-29 10:53:05 +00:00
private void SendMsgWhatsNew(int tenantid, DateTime scheduleDate, Dictionary<string, IWebItem> products)
2022-03-17 15:13:38 +00:00
{
try
2022-03-17 15:01:39 +00:00
{
2022-03-24 11:57:39 +00:00
var tenant = _tenantManager.GetTenant(tenantid);
2022-03-17 15:13:38 +00:00
if (tenant == null ||
tenant.Status != TenantStatus.Active ||
2022-03-24 11:57:39 +00:00
!TimeToSendWhatsNew(_tenantUtil.DateTimeFromUtc(tenant.TimeZone, scheduleDate)) ||
TariffState.NotPaid <= _paymentManager.GetTariff(tenantid).State)
2022-03-17 15:01:39 +00:00
{
2022-03-24 11:57:39 +00:00
return;
2022-03-17 15:01:39 +00:00
}
2022-03-24 11:57:39 +00:00
_tenantManager.SetCurrentTenant(tenant);
2022-03-31 17:32:46 +00:00
var client = _workContext.NotifyContext.RegisterClient(_notifyEngineQueue, _studioNotifyHelper.NotifySource);
2022-03-17 15:01:39 +00:00
2022-03-24 11:57:39 +00:00
_log.InfoFormat("Start send whats new in {0} ({1}).", tenant.GetTenantDomain(_coreSettings), tenantid);
foreach (var user in _userManager.GetUsers())
2022-03-17 15:01:39 +00:00
{
2022-03-24 11:57:39 +00:00
if (!_studioNotifyHelper.IsSubscribedToNotify(user, Actions.SendWhatsNew))
2022-03-17 15:13:38 +00:00
{
continue;
}
2022-03-24 11:57:39 +00:00
_securityContext.AuthenticateMeWithoutCookie(_authManager.GetAccountByID(tenant.Id, user.Id));
2022-03-17 15:13:38 +00:00
var culture = string.IsNullOrEmpty(user.CultureName) ? tenant.GetCulture() : user.GetCulture();
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
2022-03-24 11:57:39 +00:00
var feeds = _feedAggregateDataProvider.GetFeeds(new FeedApiFilter
2022-03-17 15:13:38 +00:00
{
From = scheduleDate.Date.AddDays(-1),
To = scheduleDate.Date.AddSeconds(-1),
Max = 100,
});
var feedMinWrappers = _mapper.Map<List<FeedResultItem>, List<FeedMin>>(feeds);
var feedMinGroupedWrappers = feedMinWrappers
.Where(f =>
(f.CreatedDate == DateTime.MaxValue || f.CreatedDate >= scheduleDate.Date.AddDays(-1)) && //'cause here may be old posts with new comments
products.ContainsKey(f.Product) &&
!f.Id.StartsWith("participant")
)
.GroupBy(f => products[f.Product]);
var ProjectsProductName = products["projects"]?.Name; //from ASC.Feed.Aggregator.Modules.ModulesHelper.ProjectsProductName
var activities = feedMinGroupedWrappers
.Where(f => f.Key.Name != ProjectsProductName) //not for project product
.ToDictionary(
g => g.Key.Name,
g => g.Select(f => new WhatsNewUserActivity
{
Date = f.CreatedDate,
2022-03-24 11:57:39 +00:00
UserName = f.Author != null && f.Author.UserInfo != null ? f.Author.UserInfo.DisplayUserName(_displayUserSettingsHelper) : string.Empty,
UserAbsoluteURL = f.Author != null && f.Author.UserInfo != null ? _commonLinkUtility.GetFullAbsolutePath(f.Author.UserInfo.GetUserProfilePageURL(_commonLinkUtility)) : string.Empty,
2022-03-17 15:13:38 +00:00
Title = HtmlUtil.GetText(f.Title, 512),
2022-03-24 11:57:39 +00:00
URL = _commonLinkUtility.GetFullAbsolutePath(f.ItemUrl),
2022-03-17 15:13:38 +00:00
BreadCrumbs = Array.Empty<string>(),
Action = GetWhatsNewActionText(f)
}).ToList());
var projectActivities = feedMinGroupedWrappers
.Where(f => f.Key.Name == ProjectsProductName) // for project product
.SelectMany(f => f);
var projectActivitiesWithoutBreadCrumbs = projectActivities.Where(p => string.IsNullOrEmpty(p.ExtraLocation));
var whatsNewUserActivityGroupByPrjs = new List<WhatsNewUserActivity>();
foreach (var prawbc in projectActivitiesWithoutBreadCrumbs)
{
whatsNewUserActivityGroupByPrjs.Add(
new WhatsNewUserActivity
{
Date = prawbc.CreatedDate,
2022-03-24 11:57:39 +00:00
UserName = prawbc.Author != null && prawbc.Author.UserInfo != null ? prawbc.Author.UserInfo.DisplayUserName(_displayUserSettingsHelper) : string.Empty,
UserAbsoluteURL = prawbc.Author != null && prawbc.Author.UserInfo != null ? _commonLinkUtility.GetFullAbsolutePath(prawbc.Author.UserInfo.GetUserProfilePageURL(_commonLinkUtility)) : string.Empty,
2022-03-17 15:13:38 +00:00
Title = HtmlUtil.GetText(prawbc.Title, 512),
2022-03-24 11:57:39 +00:00
URL = _commonLinkUtility.GetFullAbsolutePath(prawbc.ItemUrl),
2022-03-17 15:13:38 +00:00
BreadCrumbs = Array.Empty<string>(),
Action = GetWhatsNewActionText(prawbc)
});
}
var groupByPrjs = projectActivities.Where(p => !string.IsNullOrEmpty(p.ExtraLocation)).GroupBy(f => f.ExtraLocation);
foreach (var gr in groupByPrjs)
{
var grlist = gr.ToList();
for (var i = 0; i < grlist.Count; i++)
{
var ls = grlist[i];
whatsNewUserActivityGroupByPrjs.Add(
new WhatsNewUserActivity
{
Date = ls.CreatedDate,
2022-03-24 11:57:39 +00:00
UserName = ls.Author != null && ls.Author.UserInfo != null ? ls.Author.UserInfo.DisplayUserName(_displayUserSettingsHelper) : string.Empty,
UserAbsoluteURL = ls.Author != null && ls.Author.UserInfo != null ? _commonLinkUtility.GetFullAbsolutePath(ls.Author.UserInfo.GetUserProfilePageURL(_commonLinkUtility)) : string.Empty,
2022-03-17 15:13:38 +00:00
Title = HtmlUtil.GetText(ls.Title, 512),
2022-03-24 11:57:39 +00:00
URL = _commonLinkUtility.GetFullAbsolutePath(ls.ItemUrl),
2022-03-17 15:13:38 +00:00
BreadCrumbs = i == 0 ? new string[1] { gr.Key } : Array.Empty<string>(),
Action = GetWhatsNewActionText(ls)
});
}
}
if (whatsNewUserActivityGroupByPrjs.Count > 0)
{
activities.Add(ProjectsProductName, whatsNewUserActivityGroupByPrjs);
}
if (activities.Count > 0)
{
2022-03-24 11:57:39 +00:00
_log.InfoFormat("Send whats new to {0}", user.Email);
2022-03-17 15:13:38 +00:00
client.SendNoticeAsync(
Actions.SendWhatsNew, null, user,
new TagValue(Tags.Activities, activities),
new TagValue(Tags.Date, DateToString(scheduleDate.AddDays(-1), culture)),
new TagValue(CommonTags.Priority, 1)
);
}
2022-03-17 15:01:39 +00:00
}
}
2022-03-17 15:13:38 +00:00
catch (Exception error)
2022-03-17 15:01:39 +00:00
{
2022-03-24 11:57:39 +00:00
_log.Error(error);
2022-03-17 15:01:39 +00:00
}
2022-03-17 15:13:38 +00:00
}
private static string GetWhatsNewActionText(FeedMin feed)
{
if (feed.Module == ASC.Feed.Constants.BookmarksModule)
{
return WebstudioNotifyPatternResource.ActionCreateBookmark;
}
else if (feed.Module == ASC.Feed.Constants.BlogsModule)
{
return WebstudioNotifyPatternResource.ActionCreateBlog;
}
else if (feed.Module == ASC.Feed.Constants.ForumsModule)
{
if (feed.Item == "forumTopic")
2022-03-17 15:01:39 +00:00
{
2022-03-17 15:13:38 +00:00
return WebstudioNotifyPatternResource.ActionCreateForum;
2022-03-17 15:01:39 +00:00
}
2022-03-17 15:13:38 +00:00
if (feed.Item == "forumPost")
2022-03-17 15:01:39 +00:00
{
2022-03-17 15:13:38 +00:00
return WebstudioNotifyPatternResource.ActionCreateForumPost;
2022-03-17 15:01:39 +00:00
}
2022-03-17 15:13:38 +00:00
if (feed.Item == "forumPoll")
2022-03-17 15:01:39 +00:00
{
2022-03-17 15:13:38 +00:00
return WebstudioNotifyPatternResource.ActionCreateForumPoll;
2022-03-17 15:01:39 +00:00
}
2022-03-17 15:13:38 +00:00
}
else if (feed.Module == ASC.Feed.Constants.EventsModule)
2020-08-24 18:41:06 +00:00
{
2022-03-17 15:13:38 +00:00
return WebstudioNotifyPatternResource.ActionCreateEvent;
2020-08-24 18:41:06 +00:00
}
2022-03-17 15:13:38 +00:00
else if (feed.Module == ASC.Feed.Constants.ProjectsModule)
{
return WebstudioNotifyPatternResource.ActionCreateProject;
}
else if (feed.Module == ASC.Feed.Constants.MilestonesModule)
{
return WebstudioNotifyPatternResource.ActionCreateMilestone;
}
else if (feed.Module == ASC.Feed.Constants.DiscussionsModule)
{
return WebstudioNotifyPatternResource.ActionCreateDiscussion;
}
else if (feed.Module == ASC.Feed.Constants.TasksModule)
{
return WebstudioNotifyPatternResource.ActionCreateTask;
}
else if (feed.Module == ASC.Feed.Constants.CommentsModule)
{
return WebstudioNotifyPatternResource.ActionCreateComment;
}
else if (feed.Module == ASC.Feed.Constants.CrmTasksModule)
{
return WebstudioNotifyPatternResource.ActionCreateTask;
}
else if (feed.Module == ASC.Feed.Constants.ContactsModule)
{
return WebstudioNotifyPatternResource.ActionCreateContact;
}
else if (feed.Module == ASC.Feed.Constants.DealsModule)
{
return WebstudioNotifyPatternResource.ActionCreateDeal;
}
else if (feed.Module == ASC.Feed.Constants.CasesModule)
2020-08-31 08:18:07 +00:00
{
2022-03-17 15:13:38 +00:00
return WebstudioNotifyPatternResource.ActionCreateCase;
2020-08-31 08:18:07 +00:00
}
2022-03-17 15:13:38 +00:00
else if (feed.Module == ASC.Feed.Constants.FilesModule)
2020-10-19 15:53:15 +00:00
{
2022-03-17 15:13:38 +00:00
return WebstudioNotifyPatternResource.ActionCreateFile;
}
else if (feed.Module == ASC.Feed.Constants.FoldersModule)
{
return WebstudioNotifyPatternResource.ActionCreateFolder;
}
return "";
}
private bool TimeToSendWhatsNew(DateTime currentTime)
{
var hourToSend = 7;
2022-03-24 11:57:39 +00:00
if (!string.IsNullOrEmpty(_confuguration["web:whatsnew-time"]))
2022-03-17 15:13:38 +00:00
{
2022-03-24 11:57:39 +00:00
if (int.TryParse(_confuguration["web:whatsnew-time"], out var hour))
2022-03-17 15:13:38 +00:00
{
hourToSend = hour;
}
}
return currentTime.Hour == hourToSend;
}
private static string DateToString(DateTime d, CultureInfo c)
{
return d.ToString(c.TwoLetterISOLanguageName == "ru" ? "d MMMM" : "M", c);
}
Merge branch 'feature/backend-refactor' into feature/warnings # Conflicts: # common/ASC.Common/Threading/DistributedTaskProgress.cs # common/ASC.Common/Threading/DistributedTaskQueue.cs # common/ASC.Core.Common/Configuration/AmiPublicDnsSyncService.cs # common/ASC.Core.Common/Notify/Engine/NotifyRequest.cs # common/ASC.Core.Common/Notify/Model/NotifyClientImpl.cs # common/ASC.Core.Common/Security/EmailValidationKeyProvider.cs # common/ASC.Data.Reassigns/QueueWorker.cs # common/ASC.Data.Reassigns/ReassignProgressItem.cs # common/ASC.Data.Reassigns/RemoveProgressItem.cs # common/ASC.Data.Storage/StaticUploader.cs # products/ASC.Files/Core/ApiModels/ResponseDto/FileDto.cs # products/ASC.Files/Core/ApiModels/ResponseDto/FolderDto.cs # products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs # products/ASC.Files/Core/Core/Dao/TeamlabDao/FolderDao.cs # products/ASC.Files/Core/Core/Dao/TeamlabDao/TagDao.cs # products/ASC.Files/Core/Core/Thirdparty/Box/BoxDaoBase.cs # products/ASC.Files/Core/Core/Thirdparty/Dropbox/DropboxDaoBase.cs # products/ASC.Files/Core/Core/Thirdparty/GoogleDrive/GoogleDriveDaoBase.cs # products/ASC.Files/Core/Core/Thirdparty/IThirdPartyProviderDao.cs # products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveDaoBase.cs # products/ASC.Files/Core/Core/Thirdparty/ProviderDao/ProviderSecutiryDao.cs # products/ASC.Files/Core/Core/Thirdparty/Sharpbox/SharpBoxDaoBase.cs # products/ASC.Files/Core/HttpHandlers/FileHandler.ashx.cs # products/ASC.Files/Core/HttpHandlers/ThirdPartyAppHandler.ashx.cs # products/ASC.Files/Core/HttpHandlers/docusignhandler.ashx.cs # products/ASC.Files/Core/Services/DocumentService/DocumentServiceTracker.cs # products/ASC.Files/Core/Services/WCFService/FileOperations/FileDownloadOperation.cs # products/ASC.Files/Core/Services/WCFService/FileOperations/FileOperation.cs # products/ASC.Files/Core/Utils/EntryManager.cs # web/ASC.Web.Core/CollaboratorSettings.cs # web/ASC.Web.Core/CustomNavigationSettings.cs # web/ASC.Web.Core/EmailActivationSettings.cs # web/ASC.Web.Core/Notify/NotifyConfiguration.cs # web/ASC.Web.Core/Notify/SpamEmailSettings.cs # web/ASC.Web.Core/Notify/StudioNotifyHelper.cs # web/ASC.Web.Core/Notify/StudioNotifyService.cs # web/ASC.Web.Core/Notify/StudioNotifyServiceSender.cs # web/ASC.Web.Core/Notify/StudioPeriodicNotify.cs # web/ASC.Web.Core/Notify/StudioWhatsNewNotify.cs # web/ASC.Web.Core/PersonalSettings.cs # web/ASC.Web.Core/PrivacyRoomSettings.cs # web/ASC.Web.Core/PromotionsSettings.cs # web/ASC.Web.Core/QuotaSync.cs # web/ASC.Web.Core/Sms/SmsSender.cs # web/ASC.Web.Core/Sms/StudioSmsNotificationSettings.cs # web/ASC.Web.Core/StudioAdminMessageSettings.cs # web/ASC.Web.Core/StudioDefaultPageSettings.cs # web/ASC.Web.Core/StudioTrustedDomainSettings.cs # web/ASC.Web.Core/TariffSettings.cs # web/ASC.Web.Core/Tfa/TfaAppAuthSettings.cs # web/ASC.Web.Core/Tfa/TfaAppUserSettings.cs # web/ASC.Web.Core/TipsSettings.cs # web/ASC.Web.Core/Users/CustomNamingPeople.cs # web/ASC.Web.Core/Users/UserHelpTourSettings.cs # web/ASC.Web.Core/Users/UserPhotoManager.cs # web/ASC.Web.Core/Users/UserPhotoThumbnailManager.cs # web/ASC.Web.Core/Users/UserPhotoThumbnailSettings.cs # web/ASC.Web.Core/Utility/ColorThemesSettings.cs # web/ASC.Web.Core/Utility/PasswordSettings.cs # web/ASC.Web.Core/Utility/Settings/TenantAccessSettings.cs # web/ASC.Web.Core/Utility/Settings/WebItemSettings.cs # web/ASC.Web.Core/Utility/Settings/WizardSettings.cs # web/ASC.Web.Core/Utility/TenantExtra.cs # web/ASC.Web.Core/WhiteLabel/AdditionalWhiteLabelSettings.cs # web/ASC.Web.Core/WhiteLabel/CompanyWhiteLabelSettings.cs # web/ASC.Web.Core/WhiteLabel/TenantInfoSettings.cs # web/ASC.Web.Core/WhiteLabel/TenantWhiteLabelSettings.cs
2022-04-14 12:21:06 +00:00
2022-03-17 15:13:38 +00:00
class WhatsNewUserActivity
{
public IList<string> BreadCrumbs { get; set; }
public string Title { get; set; }
public string URL { get; set; }
public string UserName { get; set; }
public string UserAbsoluteURL { get; set; }
public DateTime Date { get; set; }
public string Action { get; set; }
}
}