1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-15 18:18:12 -05:00

freshdesk updates

This commit is contained in:
Kyle Spearrin 2020-02-06 22:25:02 -05:00
parent abe624b739
commit 16f718f2be

View File

@ -87,8 +87,8 @@ namespace Bit.Billing.Controllers
var user = await _userRepository.GetByEmailAsync(ticketContactEmail); var user = await _userRepository.GetByEmailAsync(ticketContactEmail);
if(user != null) if(user != null)
{ {
note += $"User: {_globalSettings.BaseServiceUri.Admin}/users/edit/{user.Id}"; note += $"<li>User: {_globalSettings.BaseServiceUri.Admin}/users/edit/{user.Id}</li>";
var tags = new List<string>(); var tags = new HashSet<string>();
if(user.Premium) if(user.Premium)
{ {
tags.Add("Premium"); tags.Add("Premium");
@ -96,20 +96,14 @@ namespace Bit.Billing.Controllers
var orgs = await _organizationRepository.GetManyByUserIdAsync(user.Id); var orgs = await _organizationRepository.GetManyByUserIdAsync(user.Id);
foreach(var org in orgs) foreach(var org in orgs)
{ {
note += $"\n\nOrg, {org.Name}: " + note += $"<li>Org, {org.Name}: " +
$"{_globalSettings.BaseServiceUri.Admin}/organizations/edit/{org.Id}"; $"{_globalSettings.BaseServiceUri.Admin}/organizations/edit/{org.Id}</li>";
var planName = GetAttribute<DisplayAttribute>(org.PlanType).Name.Split(" ").FirstOrDefault(); var planName = GetAttribute<DisplayAttribute>(org.PlanType).Name.Split(" ").FirstOrDefault();
if(!string.IsNullOrWhiteSpace(planName)) if(!string.IsNullOrWhiteSpace(planName))
{ {
tags.Add(string.Format("Org: {0}", planName)); tags.Add(string.Format("Org: {0}", planName));
} }
} }
var hasPaidOrg = orgs.Any(o => o.PlanType != Core.Enums.PlanType.Free &&
o.PlanType != Core.Enums.PlanType.Custom);
if(user.Premium || hasPaidOrg)
{
updateBody.Add("priority", 3);
}
if(tags.Any()) if(tags.Any())
{ {
updateBody.Add("tags", tags); updateBody.Add("tags", tags);
@ -123,7 +117,7 @@ namespace Bit.Billing.Controllers
var noteBody = new Dictionary<string, object> var noteBody = new Dictionary<string, object>
{ {
{ "body", note }, { "body", $"<ul>{note}</ul>" },
{ "private", true } { "private", true }
}; };
var noteRequest = new HttpRequestMessage(HttpMethod.Post, var noteRequest = new HttpRequestMessage(HttpMethod.Post,