@@ -74,9 +74,13 @@ Method AfterUserAction(Type As %Integer, Name As %String, InternalName As %Strin
7474 if menu '= " %SourceMenu" , menu '=" %SourceContext" {
7575 quit $$$OK
7676 }
77- set InternalName = ##class (SourceControl.Git.Utils ).NormalizeInternalName (InternalName )
77+ set InternalName = ##class (SourceControl.Git.Utils ).NormalizeInternalName (InternalName , . fromWebApp )
7878 set context = ##class (SourceControl.Git.PackageManagerContext ).ForInternalName (InternalName )
7979 set ec = ##class (SourceControl.Git.Utils ).AfterUserAction (Type , Name , InternalName , .Answer , .Msg , .Reload )
80+ if fromWebApp {
81+ // Force reload and compile of actual item if underlying file has changed
82+ do ..OnBeforeLoad (InternalName ,1 ,1 )
83+ }
8084 quit ec
8185}
8286
@@ -235,12 +239,12 @@ Method OnMenuItem(MenuName As %String, InternalName As %String, SelectedText As
235239
236240/// This is called before the actual load of data to give the chance
237241/// to load the item from an external format.
238- Method OnBeforeLoad (InternalName As %String , verbose As %Boolean ) As %Status
242+ Method OnBeforeLoad (InternalName As %String , verbose As %Boolean , compile As %Boolean = 0 ) As %Status
239243{
240244 set context = ##class (SourceControl.Git.PackageManagerContext ).ForInternalName (InternalName )
241245 set InternalName = ##class (SourceControl.Git.Utils ).NormalizeInternalName (InternalName )
242246 if ##class (SourceControl.Git.Utils ).IsInSourceControl (InternalName ) {
243- quit ##class (SourceControl.Git.Utils ).ImportItem (InternalName ,,0 )
247+ quit ##class (SourceControl.Git.Utils ).ImportItem (InternalName ,,0 , compile )
244248 }
245249 quit $$$OK
246250}
@@ -274,14 +278,21 @@ Method OnAfterSave(InternalName As %String, Object As %RegisteredObject = {$$$NU
274278{
275279 set sc = $$$OK
276280 try {
277- set InternalName = ##class (SourceControl.Git.Utils ).NormalizeInternalName (.InternalName )
281+ set InternalName = ##class (SourceControl.Git.Utils ).NormalizeInternalName (.InternalName ,. fromWebApp ,. fullExternalName )
278282 set context = ##class (SourceControl.Git.PackageManagerContext ).ForInternalName (InternalName )
279283 if ##class (SourceControl.Git.Utils ).IsNamespaceInGit () && ..IsInSourceControl (InternalName ) {
280- set filename = ##class (SourceControl.Git.Utils ).FullExternalName (InternalName )
281- $$$ThrowOnError(##class (SourceControl.Git.Utils ).RemoveRoutineTSH (InternalName ))
282- $$$ThrowOnError(##class (SourceControl.Git.Utils ).ExportItem (InternalName ))
283- if '##class (SourceControl.Git.Change ).IsUncommitted (filename ) {
284- $$$ThrowOnError(##class (SourceControl.Git.Change ).SetUncommitted (filename , " edit" , InternalName , $username , " " , 1 , " " , " " , 0 ))
284+ if fromWebApp {
285+ if fullExternalName = ##class (SourceControl.Git.Utils ).FullExternalName (InternalName ) {
286+ // Reimport item into database
287+ $$$ThrowOnError(##class (SourceControl.Git.Utils ).ImportItem (InternalName ,,1 ,1 ))
288+ }
289+ } else {
290+ set filename = ##class (SourceControl.Git.Utils ).FullExternalName (InternalName )
291+ $$$ThrowOnError(##class (SourceControl.Git.Utils ).RemoveRoutineTSH (InternalName ))
292+ $$$ThrowOnError(##class (SourceControl.Git.Utils ).ExportItem (InternalName ))
293+ if '##class (SourceControl.Git.Change ).IsUncommitted (filename ) {
294+ $$$ThrowOnError(##class (SourceControl.Git.Change ).SetUncommitted (filename , " edit" , InternalName , $username , " " , 1 , " " , " " , 0 ))
295+ }
285296 }
286297 }
287298 } catch e {
0 commit comments