From 3955cab10fcc1d32653bbf067d703871a009576c Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Wed, 13 Dec 2023 17:44:31 +0300 Subject: [PATCH] Settings: ForumLink --- web/ASC.Web.Api/Api/Settings/SettingsController.cs | 1 + .../ApiModels/ResponseDto/SettingsDto.cs | 4 ++++ web/ASC.Web.Core/Notify/StudioNotifyHelper.cs | 3 --- web/ASC.Web.Core/SetupInfo.cs | 2 -- web/ASC.Web.Core/Utility/CommonLinkUtility.cs | 14 +++++++------- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/web/ASC.Web.Api/Api/Settings/SettingsController.cs b/web/ASC.Web.Api/Api/Settings/SettingsController.cs index e5a579f1936..c4c55be63ef 100644 --- a/web/ASC.Web.Api/Api/Settings/SettingsController.cs +++ b/web/ASC.Web.Api/Api/Settings/SettingsController.cs @@ -171,6 +171,7 @@ public async Task GetSettingsAsync(bool? withpassword) LegalTerms = _setupInfo.LegalTerms, CookieSettingsEnabled = tenantCookieSettings.Enabled, UserNameRegex = _userFormatter.UserNameRegex.ToString(), + ForumLink = await _commonLinkUtility.GetUserForumLinkAsync(_settingsManager, _additionalWhiteLabelSettingsHelper) }; if (!_authContext.IsAuthenticated && await _externalShare.GetLinkIdAsync() != default) diff --git a/web/ASC.Web.Api/ApiModels/ResponseDto/SettingsDto.cs b/web/ASC.Web.Api/ApiModels/ResponseDto/SettingsDto.cs index d836da9d61e..9c7cb6c7d65 100644 --- a/web/ASC.Web.Api/ApiModels/ResponseDto/SettingsDto.cs +++ b/web/ASC.Web.Api/ApiModels/ResponseDto/SettingsDto.cs @@ -133,6 +133,10 @@ public class SettingsDto /// Link to the help /// System.String, System public string HelpLink { get; set; } + + /// Link to the forum + /// System.String, System + public string ForumLink { get; set; } /// API documentation link /// System.String, System diff --git a/web/ASC.Web.Core/Notify/StudioNotifyHelper.cs b/web/ASC.Web.Core/Notify/StudioNotifyHelper.cs index 3433fa4a63b..97e04a15f80 100644 --- a/web/ASC.Web.Core/Notify/StudioNotifyHelper.cs +++ b/web/ASC.Web.Core/Notify/StudioNotifyHelper.cs @@ -31,7 +31,6 @@ namespace ASC.Web.Studio.Core.Notify; [Scope] public class StudioNotifyHelper { - public readonly string Helplink; public readonly string SiteLink; public readonly StudioNotifySource NotifySource; public readonly ISubscriptionProvider SubscriptionProvider; @@ -52,7 +51,6 @@ public StudioNotifyHelper( StudioNotifySource studioNotifySource, UserManager userManager, SettingsManager settingsManager, - AdditionalWhiteLabelSettingsHelperInit additionalWhiteLabelSettingsHelper, MailWhiteLabelSettingsHelper mailWhiteLabelSettingsHelper, CommonLinkUtility commonLinkUtility, TenantManager tenantManager, @@ -62,7 +60,6 @@ public StudioNotifyHelper( IConfiguration configuration, ILogger logger) { - Helplink = commonLinkUtility.GetHelpLink(settingsManager, additionalWhiteLabelSettingsHelper, false); SiteLink = commonLinkUtility.GetSiteLink(mailWhiteLabelSettingsHelper); NotifySource = studioNotifySource; _userManager = userManager; diff --git a/web/ASC.Web.Core/SetupInfo.cs b/web/ASC.Web.Core/SetupInfo.cs index affdce4476c..cab8468c6f6 100644 --- a/web/ASC.Web.Core/SetupInfo.cs +++ b/web/ASC.Web.Core/SetupInfo.cs @@ -70,7 +70,6 @@ public long AvailableFileSize public string NoTenantRedirectURL { get; private set; } public string NotifyAddress { get; private set; } public string TipsAddress { get; private set; } - public string UserForum { get; private set; } public string SupportFeedback { get; private set; } public string WebApiBaseUrl { get { return VirtualPathUtility.ToAbsolute(GetAppSettings("api.url", "~/api/2.0/")); } } public TimeSpan ValidEmailKeyInterval { get; private set; } @@ -159,7 +158,6 @@ public SetupInfo(IConfiguration configuration) NotifyAddress = GetAppSettings("web.promo-url", string.Empty); TipsAddress = GetAppSettings("web.promo-tips-url", string.Empty); - UserForum = GetAppSettings("web.user-forum", string.Empty); SupportFeedback = GetAppSettings("web.support-feedback", string.Empty); ValidEmailKeyInterval = GetAppSettings("email.validinterval", TimeSpan.FromDays(7)); diff --git a/web/ASC.Web.Core/Utility/CommonLinkUtility.cs b/web/ASC.Web.Core/Utility/CommonLinkUtility.cs index 790d3091234..c353f302e01 100644 --- a/web/ASC.Web.Core/Utility/CommonLinkUtility.cs +++ b/web/ASC.Web.Core/Utility/CommonLinkUtility.cs @@ -314,16 +314,14 @@ public string GetUserParamsPair(UserInfo user) return HttpUtility.UrlEncode(user.UserName.ToLowerInvariant()); } - #region Help Centr - - public async Task GetHelpLinkAsync(SettingsManager settingsManager, AdditionalWhiteLabelSettingsHelperInit additionalWhiteLabelSettingsHelper, bool inCurrentCulture = true) + public async Task GetUserForumLinkAsync(SettingsManager settingsManager, AdditionalWhiteLabelSettingsHelperInit additionalWhiteLabelSettingsHelper, bool inCurrentCulture = true) { - if (!(await settingsManager.LoadForDefaultTenantAsync()).HelpCenterEnabled) + if (!(await settingsManager.LoadForDefaultTenantAsync()).UserForumEnabled) { return string.Empty; } - var url = additionalWhiteLabelSettingsHelper.DefaultHelpCenterUrl; + var url = additionalWhiteLabelSettingsHelper.DefaultUserForumUrl; if (string.IsNullOrEmpty(url)) { @@ -332,10 +330,12 @@ public async Task GetHelpLinkAsync(SettingsManager settingsManager, Addi return GetRegionalUrl(url, inCurrentCulture ? CultureInfo.CurrentCulture.TwoLetterISOLanguageName : null); } + + #region Help Centr - public string GetHelpLink(SettingsManager settingsManager, AdditionalWhiteLabelSettingsHelperInit additionalWhiteLabelSettingsHelper, bool inCurrentCulture = true) + public async Task GetHelpLinkAsync(SettingsManager settingsManager, AdditionalWhiteLabelSettingsHelperInit additionalWhiteLabelSettingsHelper, bool inCurrentCulture = true) { - if (!settingsManager.LoadForDefaultTenant().HelpCenterEnabled) + if (!(await settingsManager.LoadForDefaultTenantAsync()).HelpCenterEnabled) { return string.Empty; }