Skip to content

Commit

Permalink
🐛 Mobile | Remove http/https from user titles (#1091)
Browse files Browse the repository at this point in the history
* Remove http and https

* Clean up regex
  • Loading branch information
zacharykeeping authored Oct 16, 2024
1 parent ce2d6f6 commit e562406
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/Common/DTOs/Leaderboard/LeaderboardUserDto.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using SSW.Rewards.Domain.Entities;
using System.Text.RegularExpressions;
using SSW.Rewards.Domain.Entities;

namespace SSW.Rewards.Shared.DTOs.Leaderboard;

Expand Down Expand Up @@ -52,7 +53,7 @@ public LeaderboardUserDto(User user, DateTime firstDayOfWeek)

if (!string.IsNullOrEmpty(company))
{
Title = company;
Title = Regex.Replace(company, @"^https?://", string.Empty);
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions src/MobileUI/Features/Activity/ActivityPageViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Text.RegularExpressions;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using SSW.Rewards.ApiClient.Services;
Expand Down Expand Up @@ -123,6 +124,7 @@ private async Task<List<ActivityFeedItemDto>> GetFeedData()
: x.UserAvatar;
x.AchievementMessage = GetMessage(x.Achievement);
x.TimeElapsed = DateTimeHelpers.GetTimeElapsed(x.AwardedAt);
x.UserTitle = Regex.Replace(x.UserTitle, @"^https?://", string.Empty);
return x;
}).ToList();
}
Expand Down
3 changes: 2 additions & 1 deletion src/MobileUI/Features/Leaderboard/LeaderViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Net.Mail;
using System.Text.RegularExpressions;
using SSW.Rewards.Shared.DTOs.Leaderboard;

namespace SSW.Rewards.Mobile.ViewModels;
Expand Down Expand Up @@ -35,7 +36,7 @@ public LeaderViewModel(LeaderboardUserDto dto, bool isMe)
Balance = dto.Balance;
Email = dto.Email;
IsMe = isMe;
Title = dto.Title;
Title = Regex.Replace(dto.Title, @"^https?://", string.Empty);
}

public int DisplayPoints { get; set; }
Expand Down
5 changes: 4 additions & 1 deletion src/MobileUI/Features/Profile/ProfileViewModelBase.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.ObjectModel;
using System.Text.RegularExpressions;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Mopups.Services;
Expand Down Expand Up @@ -147,7 +148,9 @@ private string GetTitle()
return "SSW";
}

return !string.IsNullOrEmpty(CompanyUrl) ? CompanyUrl : "Community";
return !string.IsNullOrEmpty(CompanyUrl)
? Regex.Replace(CompanyUrl, @"^https?://", string.Empty)
: "Community";
}

[RelayCommand]
Expand Down

0 comments on commit e562406

Please sign in to comment.