@@ -131,40 +131,6 @@ public async Task<IActionResult> WorkitemUpdated([FromBody] WebHooksRequestInput
131131 stringBuilder . AppendLine ( ) ;
132132 }
133133
134- var changeStatus = request . Resource . Fields . GetValueOrDefault ( "System.State" ) ;
135- if ( changeStatus != null )
136- {
137- try
138- {
139- var ch = changeStatus . ToValueChangeModel ( ) ;
140- if ( ch . OldValue != ch . NewValue )
141- {
142- stringBuilder . AppendLine ( $ "- 状态变更: { ch . OldValue } 更改为 { ch . NewValue } ") ;
143- stringBuilder . AppendLine ( ) ;
144- }
145- }
146- catch
147- {
148- }
149- }
150-
151- var changeAssignedTo = request . Resource . Fields . GetValueOrDefault ( "System.AssignedTo" ) ;
152- if ( changeAssignedTo != null )
153- {
154- try
155- {
156- var ch = changeAssignedTo . ToValueChangeModel ( ) ;
157- if ( ch . OldValue != ch . NewValue )
158- {
159- stringBuilder . AppendLine ( $ "- 指派变更: { ch . OldValue } 更改为 @{ ch . NewValue } ") ;
160- stringBuilder . AppendLine ( ) ;
161- }
162- }
163- catch
164- {
165- }
166- }
167-
168134 var history = request . Resource . Revision . Fields . GetValueOrDefault ( "System.History" ) ;
169135 if ( history != null )
170136 {
@@ -176,6 +142,8 @@ public async Task<IActionResult> WorkitemUpdated([FromBody] WebHooksRequestInput
176142 stringBuilder . AppendLine ( ) ;
177143 }
178144
145+ var changeStatus = request . Resource . Fields . GetValueOrDefault ( "System.State" ) ;
146+ var changeAssignedTo = request . Resource . Fields . GetValueOrDefault ( "System.AssignedTo" ) ;
179147 var priority = request . Resource . Fields . GetValueOrDefault ( "Microsoft.VSTS.Common.Priority" ) ;
180148 var remainingWork = request . Resource . Fields . GetValueOrDefault ( "Microsoft.VSTS.Scheduling.RemainingWork" ) ;
181149 var originalEstimate = request . Resource . Fields . GetValueOrDefault ( "Microsoft.VSTS.Scheduling.OriginalEstimate" ) ;
@@ -198,6 +166,36 @@ public async Task<IActionResult> WorkitemUpdated([FromBody] WebHooksRequestInput
198166 {
199167 }
200168 }
169+ if ( changeStatus != null )
170+ {
171+ try
172+ {
173+ var ch = changeStatus . ToValueChangeModel ( ) ;
174+ if ( ch . OldValue != ch . NewValue )
175+ {
176+ stringBuilder . AppendLine ( $ "> 状态变更: { ch . OldValue } 更改为 { ch . NewValue } ") ;
177+ stringBuilder . AppendLine ( ) ;
178+ }
179+ }
180+ catch
181+ {
182+ }
183+ }
184+ if ( changeAssignedTo != null )
185+ {
186+ try
187+ {
188+ var ch = changeAssignedTo . ToValueChangeModel ( ) ;
189+ if ( ch . OldValue != ch . NewValue )
190+ {
191+ stringBuilder . AppendLine ( $ "> 指派变更: { $ "{ ch . OldValue } ". Split ( ' ' ) ? [ 0 ] } 更改为 @{ $ "{ ch . NewValue } ". Split ( ' ' ) ? [ 0 ] } ") ;
192+ stringBuilder . AppendLine ( ) ;
193+ }
194+ }
195+ catch
196+ {
197+ }
198+ }
201199 if ( remainingWork != null )
202200 {
203201 try
@@ -243,6 +241,13 @@ public async Task<IActionResult> WorkitemUpdated([FromBody] WebHooksRequestInput
243241 var ch = node . ToValueChangeModel ( ) ;
244242 if ( ch . OldValue != ch . NewValue )
245243 {
244+ var o = $ "{ ch . OldValue } ";
245+ var n = $ "{ ch . NewValue } ";
246+ if ( ! string . IsNullOrWhiteSpace ( setting . Format ) )
247+ {
248+ o = string . Format ( $ "{{0:{ setting . Format } }}", o ) ;
249+ n = string . Format ( $ "{{0:{ setting . Format } }}", n ) ;
250+ }
246251 stringBuilder . AppendLine ( $ "> { setting . Name } : { ch . OldValue } 更改为 { ch . NewValue } ") ;
247252 stringBuilder . AppendLine ( ) ;
248253 }
0 commit comments