11using Microsoft . AspNetCore . Authorization ;
2+ using Microsoft . AspNetCore . Cors ;
23using Microsoft . AspNetCore . Mvc ;
34using rubberduckvba . Server . Data ;
45using rubberduckvba . Server . Model ;
@@ -37,6 +38,7 @@ await db.GetTopLevelFeatures(repositoryId)
3738 . ContinueWith ( t => t . Result . Select ( e => new FeatureOptionViewModel { Id = e . Id , Name = e . Name , Title = e . Title } ) . ToArray ( ) ) ;
3839
3940 [ HttpGet ( "features" ) ]
41+ [ EnableCors ( CorsPolicies . AllowAll ) ]
4042 [ AllowAnonymous ]
4143 public IActionResult Index ( )
4244 {
@@ -66,6 +68,7 @@ public IActionResult Index()
6668 }
6769
6870 [ HttpGet ( "features/{name}" ) ]
71+ [ EnableCors ( CorsPolicies . AllowAll ) ]
6972 [ AllowAnonymous ]
7073 public IActionResult Info ( [ FromRoute ] string name )
7174 {
@@ -82,6 +85,7 @@ public IActionResult Info([FromRoute] string name)
8285 }
8386
8487 [ HttpGet ( "inspections/{name}" ) ]
88+ [ EnableCors ( CorsPolicies . AllowAll ) ]
8589 [ AllowAnonymous ]
8690 public IActionResult Inspection ( [ FromRoute ] string name )
8791 {
@@ -103,6 +107,7 @@ public IActionResult Inspection([FromRoute] string name)
103107 }
104108
105109 [ HttpGet ( "annotations/{name}" ) ]
110+ [ EnableCors ( CorsPolicies . AllowAll ) ]
106111 [ AllowAnonymous ]
107112 public IActionResult Annotation ( [ FromRoute ] string name )
108113 {
@@ -124,6 +129,7 @@ public IActionResult Annotation([FromRoute] string name)
124129 }
125130
126131 [ HttpGet ( "quickfixes/{name}" ) ]
132+ [ EnableCors ( CorsPolicies . AllowAll ) ]
127133 [ AllowAnonymous ]
128134 public IActionResult QuickFix ( [ FromRoute ] string name )
129135 {
@@ -145,6 +151,7 @@ public IActionResult QuickFix([FromRoute] string name)
145151 }
146152
147153 [ HttpGet ( "features/create" ) ]
154+ [ EnableCors ( CorsPolicies . AllowAuthenticated ) ]
148155 [ Authorize ( "github" ) ]
149156 public async Task < ActionResult < FeatureEditViewModel > > Create ( [ FromQuery ] RepositoryId repository = RepositoryId . Rubberduck , [ FromQuery ] int ? parentId = default )
150157 {
@@ -156,6 +163,7 @@ public async Task<ActionResult<FeatureEditViewModel>> Create([FromQuery] Reposit
156163 }
157164
158165 [ HttpPost ( "create" ) ]
166+ [ EnableCors ( CorsPolicies . AllowAuthenticated ) ]
159167 [ Authorize ( "github" ) ]
160168 public async Task < ActionResult < FeatureEditViewModel > > Create ( [ FromBody ] FeatureEditViewModel model )
161169 {
@@ -178,6 +186,7 @@ public async Task<ActionResult<FeatureEditViewModel>> Create([FromBody] FeatureE
178186 }
179187
180188 [ HttpPost ( "features/update" ) ]
189+ [ EnableCors ( CorsPolicies . AllowAuthenticated ) ]
181190 [ Authorize ( "github" ) ]
182191 public async Task < ActionResult < FeatureEditViewModel > > Update ( [ FromBody ] FeatureEditViewModel model )
183192 {
@@ -203,8 +212,10 @@ private InspectionsFeatureViewModel GetInspections()
203212 InspectionsFeatureViewModel result ;
204213 if ( ! cache . TryGetInspections ( out result ! ) )
205214 {
215+ var quickfixesModel = GetQuickFixes ( ) ;
216+
206217 var feature = features . Get ( "Inspections" ) as FeatureGraph ;
207- result = new InspectionsFeatureViewModel ( feature ,
218+ result = new InspectionsFeatureViewModel ( feature , quickfixesModel . QuickFixes ,
208219 feature . Inspections
209220 . Select ( e => e . TagAssetId ) . Distinct ( )
210221 . ToDictionary ( id => id , id => new Tag ( tagsRepository . GetById ( assetsRepository . GetById ( id ) . TagId ) ) ) ) ;
0 commit comments