@@ -5,7 +5,7 @@ public abstract class StaticCommonInSavers
5
5
public delegate bool FieldChangeIgnoranceDelegate (
6
6
Type whichPostType , string propName , object ? oldValue , object ? newValue ) ;
7
7
8
- // static field in this non generic class will be shared across all reified generic derived classes
8
+ // static field in this non- generic class will be shared across all reified generic derived classes
9
9
protected static Dictionary < Type , Dictionary < string , PropertyInfo > > RevisionPropertiesCache { get ; } = GetPropsKeyByType (
10
10
[ typeof ( ThreadRevision ) , typeof ( ReplyRevision ) , typeof ( SubReplyRevision ) , typeof ( UserRevision ) ] ) ;
11
11
@@ -37,22 +37,22 @@ when Math.Abs((newValue as int? ?? 0) - (oldValue as int? ?? 0)) <= 10:
37
37
if ( whichPostType == typeof ( ThreadPost ) )
38
38
{
39
39
switch ( propName )
40
- { // will be update by ThreadLateCrawlerAndSaver
40
+ { // will be updated by ThreadLateCrawlerAndSaver
41
41
case nameof ( ThreadPost . AuthorPhoneType ) :
42
42
// prevent overwrite existing value of field liker_id which is saved by legacy crawler
43
- // and Zan itself is deprecated by tieba so it shouldn't get updated
43
+ // and Zan itself is deprecated by tieba, so it shouldn't get updated
44
44
case nameof ( ThreadPost . Zan ) :
45
45
// possible randomly respond with null
46
46
case nameof ( ThreadPost . Geolocation ) when newValue is null :
47
- // empty string means the author had not write a title
47
+ // empty string means the author had not written a title
48
48
// its value generated from the first reply within response of reply crawler
49
49
// will be later set by ReplyCrawlFacade.SaveParentThreadTitle()
50
50
case nameof ( ThreadPost . Title )
51
51
when newValue is ""
52
52
53
53
// prevent repeatedly update with different title
54
54
// due to the thread is a multi forum topic thread
55
- // thus its title can be vary within the forum and within the thread
55
+ // thus its title can be varied within the forum and within the thread
56
56
|| ( newValue is not "" && oldValue is not "" ) :
57
57
// possible randomly respond with 0.NullIfZero()
58
58
case nameof ( ThreadPost . DisagreeCount ) when newValue is null && oldValue is not null :
@@ -76,6 +76,8 @@ when newValue is ""
76
76
{ // ignore revision that figures update existing old users that don't have ip geolocation
77
77
if ( whichPostType == typeof ( User )
78
78
&& propName == nameof ( User . IpGeolocation ) && oldValue is null ) return true ;
79
+
80
+ // ReSharper disable once InvertIf
79
81
if ( whichPostType == typeof ( ThreadPost ) )
80
82
{
81
83
switch ( propName )
@@ -89,7 +91,7 @@ when newValue is ""
89
91
return false ;
90
92
} ) ;
91
93
92
- private static Dictionary < Type , Dictionary < string , PropertyInfo > > GetPropsKeyByType ( List < Type > types ) =>
94
+ private static Dictionary < Type , Dictionary < string , PropertyInfo > > GetPropsKeyByType ( IEnumerable < Type > types ) =>
93
95
types . ToDictionary ( type => type , type => type . GetProperties ( ) . ToDictionary ( prop => prop . Name ) ) ;
94
96
95
97
public record FieldChangeIgnoranceDelegates (
0 commit comments