From 8d53ce79f37d2fb3fddce62fd5ef4aaf7a3a9f9a Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Wed, 30 Jul 2025 16:51:17 -0500 Subject: [PATCH] Updated Profile Updated profile to more properly iterate over subscriptions for equality checking to ensure subs properly match up. --- FreeTubeSyncer/Models/DatabaseModels/Profile.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/FreeTubeSyncer/Models/DatabaseModels/Profile.cs b/FreeTubeSyncer/Models/DatabaseModels/Profile.cs index fd795f0..954f024 100644 --- a/FreeTubeSyncer/Models/DatabaseModels/Profile.cs +++ b/FreeTubeSyncer/Models/DatabaseModels/Profile.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using System.Linq; using System.Text.Json; using FreeTubeSyncer.Library; @@ -38,8 +39,15 @@ public class Profile : IDataModel, IEquatable { if (other is null) return false; if (ReferenceEquals(this, other)) return true; - return _id == other._id && name == other.name && bgColor == other.bgColor && textColor == other.textColor && - subscriptions.Equals(other.subscriptions); + if (subscriptions.Count != other.subscriptions.Count) return false; + foreach (var sub in subscriptions) + { + var osub = other.subscriptions.FirstOrDefault(x => x.id == sub.id); + if (osub is null) return false; + if (!osub.Equals(sub)) return false; + } + + return _id == other._id && name == other.name && bgColor == other.bgColor && textColor == other.textColor; } public override bool Equals(object? obj)