Skip to content

Commit

Permalink
Settings: ForumLink
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelbannov committed Dec 13, 2023
1 parent 7792144 commit 3955cab
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
1 change: 1 addition & 0 deletions web/ASC.Web.Api/Api/Settings/SettingsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ public async Task<SettingsDto> 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)
Expand Down
4 changes: 4 additions & 0 deletions web/ASC.Web.Api/ApiModels/ResponseDto/SettingsDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ public class SettingsDto
/// <summary>Link to the help</summary>
/// <type>System.String, System</type>
public string HelpLink { get; set; }

/// <summary>Link to the forum</summary>
/// <type>System.String, System</type>
public string ForumLink { get; set; }

/// <summary>API documentation link</summary>
/// <type>System.String, System</type>
Expand Down
3 changes: 0 additions & 3 deletions web/ASC.Web.Core/Notify/StudioNotifyHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -52,7 +51,6 @@ public StudioNotifyHelper(
StudioNotifySource studioNotifySource,
UserManager userManager,
SettingsManager settingsManager,
AdditionalWhiteLabelSettingsHelperInit additionalWhiteLabelSettingsHelper,
MailWhiteLabelSettingsHelper mailWhiteLabelSettingsHelper,
CommonLinkUtility commonLinkUtility,
TenantManager tenantManager,
Expand All @@ -62,7 +60,6 @@ public StudioNotifyHelper(
IConfiguration configuration,
ILogger<StudioNotifyHelper> logger)
{
Helplink = commonLinkUtility.GetHelpLink(settingsManager, additionalWhiteLabelSettingsHelper, false);
SiteLink = commonLinkUtility.GetSiteLink(mailWhiteLabelSettingsHelper);
NotifySource = studioNotifySource;
_userManager = userManager;
Expand Down
2 changes: 0 additions & 2 deletions web/ASC.Web.Core/SetupInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -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));
Expand Down
14 changes: 7 additions & 7 deletions web/ASC.Web.Core/Utility/CommonLinkUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,16 +314,14 @@ public string GetUserParamsPair(UserInfo user)
return HttpUtility.UrlEncode(user.UserName.ToLowerInvariant());
}

#region Help Centr

public async Task<string> GetHelpLinkAsync(SettingsManager settingsManager, AdditionalWhiteLabelSettingsHelperInit additionalWhiteLabelSettingsHelper, bool inCurrentCulture = true)
public async Task<string> GetUserForumLinkAsync(SettingsManager settingsManager, AdditionalWhiteLabelSettingsHelperInit additionalWhiteLabelSettingsHelper, bool inCurrentCulture = true)
{
if (!(await settingsManager.LoadForDefaultTenantAsync<AdditionalWhiteLabelSettings>()).HelpCenterEnabled)
if (!(await settingsManager.LoadForDefaultTenantAsync<AdditionalWhiteLabelSettings>()).UserForumEnabled)
{
return string.Empty;
}

var url = additionalWhiteLabelSettingsHelper.DefaultHelpCenterUrl;
var url = additionalWhiteLabelSettingsHelper.DefaultUserForumUrl;

if (string.IsNullOrEmpty(url))
{
Expand All @@ -332,10 +330,12 @@ public async Task<string> 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<string> GetHelpLinkAsync(SettingsManager settingsManager, AdditionalWhiteLabelSettingsHelperInit additionalWhiteLabelSettingsHelper, bool inCurrentCulture = true)
{
if (!settingsManager.LoadForDefaultTenant<AdditionalWhiteLabelSettings>().HelpCenterEnabled)
if (!(await settingsManager.LoadForDefaultTenantAsync<AdditionalWhiteLabelSettings>()).HelpCenterEnabled)
{
return string.Empty;
}
Expand Down

0 comments on commit 3955cab

Please sign in to comment.