Skip to content

Commit

Permalink
Added comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jsenning committed Jul 11, 2024
1 parent 1710440 commit 0b3de98
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Gordon360/Services/ProfileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Gordon360.Enums;
using System.Security.Permissions;
using Microsoft.AspNetCore.Authentication.Negotiate;
using Microsoft.Extensions.ObjectPool;

namespace Gordon360.Services;

Expand Down Expand Up @@ -380,6 +383,31 @@ public async Task UpdateUserPrivacyAsync(string username, UserPrivacyUpdateViewM
{
user.Visibility = userPrivacy.VisibilityGroup;
}

// Attempt to update the "isMobilePhonePrivate" profile field.
// Students have this but facstaff and alumni do not. This
// maintains some measure of backward-compatibility in that
// changes made on 360 are pushed to Jenzebar, but changes made
// to this profile setting in other places will not make it
// into 360.
try
{
if (user is not null && field == "MobilePhone")
{
var value = user.Visibility == "Public" ? "N" : "Y";
await context.Procedures.UPDATE_PHONE_PRIVACYAsync(int.Parse(account.GordonID), value);
// Update value in cached data
var student = context.Student.FirstOrDefault(x => x.ID == account.GordonID);
if (student != null)
{
student.IsMobilePhonePrivate = value == "Y" ? 1 : 0;
}
}
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Message);
}
}

context.SaveChanges();
Expand Down

0 comments on commit 0b3de98

Please sign in to comment.