@@ -28,7 +28,7 @@ internal T UpdateValue<T>(string itemId,
2828 newValue . SerializeWith ( Database . SerializationCenter ) ,
2929 readableValue ,
3030 needsReview ,
31- LogEventType . ItemUpdated ) ;
31+ ActivityEventType . ItemUpdated ) ;
3232 }
3333
3434 return newValue ;
@@ -39,7 +39,7 @@ internal T AddValue<T>(string itemId,
3939 bool needsReview ,
4040 T value ) where T : notnull
4141 {
42- _addChange ( itemId , string . Empty , value . SerializeWith ( Database . SerializationCenter ) , readableValue , needsReview , LogEventType . ItemAdded ) ;
42+ _addChange ( itemId , string . Empty , value . SerializeWith ( Database . SerializationCenter ) , readableValue , needsReview , ActivityEventType . ItemAdded ) ;
4343
4444 return value ;
4545 }
@@ -49,7 +49,7 @@ internal T DeleteValue<T>(string itemId,
4949 bool needsReview ,
5050 T value ) where T : notnull
5151 {
52- _addChange ( itemId , string . Empty , value . SerializeWith ( Database . SerializationCenter ) , readableValue , needsReview , LogEventType . ItemDeleted ) ;
52+ _addChange ( itemId , string . Empty , value . SerializeWith ( Database . SerializationCenter ) , readableValue , needsReview , ActivityEventType . ItemDeleted ) ;
5353
5454 return value ;
5555 }
@@ -59,7 +59,7 @@ private void _addChange(string itemId,
5959 string newValue ,
6060 string readableValue ,
6161 bool needsReview ,
62- LogEventType action )
62+ ActivityEventType action )
6363 {
6464 _addChange ( itemId ,
6565 fieldName ,
@@ -76,7 +76,7 @@ private void _addChange(string itemId,
7676 string newValue ,
7777 string readableValue ,
7878 bool needsReview ,
79- LogEventType action )
79+ ActivityEventType action )
8080 {
8181 string changeKey = $ "{ itemId } \t { fieldName } ";
8282 if ( ! Changes . ContainsKey ( changeKey ) )
@@ -97,12 +97,14 @@ private void _addChange(string itemId,
9797 _mergeChanges ( changeKey , currentChange ) ;
9898
9999 Database . FileLocker . Save ( this , Database . AutoSaveFileEntry , Database . Passkeys ) ;
100+ string itemName = string . Empty ;
101+ string parentName = string . Empty ;
100102
101103 if ( itemId == Database . User ? . ItemId )
102104 {
103105 if ( Database . User is not null )
104106 {
105- itemId = Database . User . ToString ( ) ;
107+ itemName = Database . User . ToString ( ) ;
106108 }
107109 }
108110 else if ( itemId . StartsWith ( 'S' ) )
@@ -111,7 +113,7 @@ private void _addChange(string itemId,
111113
112114 if ( s is not null )
113115 {
114- itemId = s . ToString ( ) ;
116+ itemName = s . ToString ( ) ;
115117 }
116118 }
117119 else if ( itemId . StartsWith ( 'A' ) )
@@ -120,20 +122,33 @@ private void _addChange(string itemId,
120122
121123 if ( a is not null )
122124 {
123- itemId = a . ToString ( ) ;
125+ itemName = a . ToString ( ) ;
126+
127+ if ( action == ActivityEventType . ItemUpdated )
128+ {
129+ parentName = a . Service . ToString ( ) ;
130+ }
124131 }
125132 }
126133
127- Database . Logs . AddLog ( data : [ itemId , fieldName , readableValue ] ,
134+ string [ ] data = [ itemName , fieldName , readableValue ] ;
135+
136+ if ( ! string . IsNullOrEmpty ( parentName ) )
137+ {
138+ data = [ .. data , parentName ] ;
139+ }
140+
141+ Database . ActivityCenter . AddActivity ( itemId : itemId ,
128142 eventType : action ,
143+ data ,
129144 needsReview ) ;
130145 }
131146
132147 private void _mergeChanges ( string changeKey , Change currentChange )
133148 {
134- Change ? lastUpdate = Changes [ changeKey ] . LastOrDefault ( x => x . ActionType == LogEventType . ItemUpdated ) ;
149+ Change ? lastUpdate = Changes [ changeKey ] . LastOrDefault ( x => x . ActionType == ActivityEventType . ItemUpdated ) ;
135150
136- if ( currentChange . ActionType != LogEventType . ItemUpdated
151+ if ( currentChange . ActionType != ActivityEventType . ItemUpdated
137152 || lastUpdate is null )
138153 {
139154 Changes [ changeKey ] . Add ( currentChange ) ;
0 commit comments