Remove unused user rule legacy fields
This commit is contained in:
1 parent
1bc136ff06
commit
bfcd36ae94
3 files changed
+9
-46
No files matched your search
@@ -810,34 +810,15 @@ WHERE item_id IN ({idParams}) AND lang IN ({langParams});";
|
||||
{
|
||||
using var con = Open();
|
||||
con.Open();
|
||||
using var tx = con.BeginTransaction();
|
||||
using (var cmd = con.CreateCommand())
|
||||
{
|
||||
cmd.Transaction = tx;
|
||||
cmd.CommandText = @"
|
||||
using var cmd = con.CreateCommand();
|
||||
cmd.CommandText = @"
|
||||
INSERT INTO user_rules(user_id, rules_json, updated_at)
|
||||
VALUES($user_id, $rules_json, $updated_at)
|
||||
ON CONFLICT(user_id) DO UPDATE SET rules_json = excluded.rules_json, updated_at = excluded.updated_at;";
|
||||
cmd.Parameters.AddWithValue("$user_id", userId);
|
||||
cmd.Parameters.AddWithValue("$rules_json", JsonSerializer.Serialize(rules));
|
||||
cmd.Parameters.AddWithValue("$updated_at", NowUnixUtc());
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
using (var cmd = con.CreateCommand())
|
||||
{
|
||||
cmd.Transaction = tx;
|
||||
cmd.CommandText = @"
|
||||
INSERT INTO user_display_langs(user_id, langs_json, updated_at)
|
||||
VALUES($user_id, $langs_json, $updated_at)
|
||||
ON CONFLICT(user_id) DO UPDATE SET langs_json = excluded.langs_json, updated_at = excluded.updated_at;";
|
||||
cmd.Parameters.AddWithValue("$user_id", userId);
|
||||
cmd.Parameters.AddWithValue("$langs_json", JsonSerializer.Serialize(rules.FallbackLanguages));
|
||||
cmd.Parameters.AddWithValue("$updated_at", NowUnixUtc());
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
tx.Commit();
|
||||
cmd.Parameters.AddWithValue("$user_id", userId);
|
||||
cmd.Parameters.AddWithValue("$rules_json", JsonSerializer.Serialize(rules));
|
||||
cmd.Parameters.AddWithValue("$updated_at", NowUnixUtc());
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
public UserRulesDocument? GetUserRules(string userId)
|
||||
@@ -1133,24 +1114,12 @@ public sealed class UserRulesDocument
|
||||
|
||||
public string SortLocale { get; set; } = "Auto";
|
||||
|
||||
public string[] FallbackLanguages { get; set; } = [];
|
||||
|
||||
public Dictionary<string, string[]> FallbackFieldActions { get; set; } = MultilangConstants.DefaultActionLists();
|
||||
|
||||
public bool TrustTmdbCollections { get; set; } = true;
|
||||
|
||||
public UserCategoryRule[] Categories { get; set; } = [];
|
||||
|
||||
public UserRuleEntry[] Rules { get; set; } = [];
|
||||
}
|
||||
|
||||
public sealed class UserRuleEntry
|
||||
{
|
||||
public string Text { get; set; } = string.Empty;
|
||||
|
||||
public string[] Languages { get; set; } = [];
|
||||
|
||||
public string[] Scopes { get; set; } = [];
|
||||
}
|
||||
|
||||
public sealed class UserCategoryRule
|
||||
|
||||
Reference in new issue
Block a user