1
1
using Microsoft . AspNetCore . Authorization ;
2
+ using Microsoft . AspNetCore . Cors ;
2
3
using Microsoft . AspNetCore . Mvc ;
3
4
using rubberduckvba . Server . Data ;
4
5
using rubberduckvba . Server . Model ;
@@ -37,6 +38,7 @@ await db.GetTopLevelFeatures(repositoryId)
37
38
. ContinueWith ( t => t . Result . Select ( e => new FeatureOptionViewModel { Id = e . Id , Name = e . Name , Title = e . Title } ) . ToArray ( ) ) ;
38
39
39
40
[ HttpGet ( "features" ) ]
41
+ [ EnableCors ( CorsPolicies . AllowAll ) ]
40
42
[ AllowAnonymous ]
41
43
public IActionResult Index ( )
42
44
{
@@ -66,6 +68,7 @@ public IActionResult Index()
66
68
}
67
69
68
70
[ HttpGet ( "features/{name}" ) ]
71
+ [ EnableCors ( CorsPolicies . AllowAll ) ]
69
72
[ AllowAnonymous ]
70
73
public IActionResult Info ( [ FromRoute ] string name )
71
74
{
@@ -82,6 +85,7 @@ public IActionResult Info([FromRoute] string name)
82
85
}
83
86
84
87
[ HttpGet ( "inspections/{name}" ) ]
88
+ [ EnableCors ( CorsPolicies . AllowAll ) ]
85
89
[ AllowAnonymous ]
86
90
public IActionResult Inspection ( [ FromRoute ] string name )
87
91
{
@@ -103,6 +107,7 @@ public IActionResult Inspection([FromRoute] string name)
103
107
}
104
108
105
109
[ HttpGet ( "annotations/{name}" ) ]
110
+ [ EnableCors ( CorsPolicies . AllowAll ) ]
106
111
[ AllowAnonymous ]
107
112
public IActionResult Annotation ( [ FromRoute ] string name )
108
113
{
@@ -124,6 +129,7 @@ public IActionResult Annotation([FromRoute] string name)
124
129
}
125
130
126
131
[ HttpGet ( "quickfixes/{name}" ) ]
132
+ [ EnableCors ( CorsPolicies . AllowAll ) ]
127
133
[ AllowAnonymous ]
128
134
public IActionResult QuickFix ( [ FromRoute ] string name )
129
135
{
@@ -145,6 +151,7 @@ public IActionResult QuickFix([FromRoute] string name)
145
151
}
146
152
147
153
[ HttpGet ( "features/create" ) ]
154
+ [ EnableCors ( CorsPolicies . AllowAuthenticated ) ]
148
155
[ Authorize ( "github" ) ]
149
156
public async Task < ActionResult < FeatureEditViewModel > > Create ( [ FromQuery ] RepositoryId repository = RepositoryId . Rubberduck , [ FromQuery ] int ? parentId = default )
150
157
{
@@ -156,6 +163,7 @@ public async Task<ActionResult<FeatureEditViewModel>> Create([FromQuery] Reposit
156
163
}
157
164
158
165
[ HttpPost ( "create" ) ]
166
+ [ EnableCors ( CorsPolicies . AllowAuthenticated ) ]
159
167
[ Authorize ( "github" ) ]
160
168
public async Task < ActionResult < FeatureEditViewModel > > Create ( [ FromBody ] FeatureEditViewModel model )
161
169
{
@@ -178,6 +186,7 @@ public async Task<ActionResult<FeatureEditViewModel>> Create([FromBody] FeatureE
178
186
}
179
187
180
188
[ HttpPost ( "features/update" ) ]
189
+ [ EnableCors ( CorsPolicies . AllowAuthenticated ) ]
181
190
[ Authorize ( "github" ) ]
182
191
public async Task < ActionResult < FeatureEditViewModel > > Update ( [ FromBody ] FeatureEditViewModel model )
183
192
{
@@ -203,8 +212,10 @@ private InspectionsFeatureViewModel GetInspections()
203
212
InspectionsFeatureViewModel result ;
204
213
if ( ! cache . TryGetInspections ( out result ! ) )
205
214
{
215
+ var quickfixesModel = GetQuickFixes ( ) ;
216
+
206
217
var feature = features . Get ( "Inspections" ) as FeatureGraph ;
207
- result = new InspectionsFeatureViewModel ( feature ,
218
+ result = new InspectionsFeatureViewModel ( feature , quickfixesModel . QuickFixes ,
208
219
feature . Inspections
209
220
. Select ( e => e . TagAssetId ) . Distinct ( )
210
221
. ToDictionary ( id => id , id => new Tag ( tagsRepository . GetById ( assetsRepository . GetById ( id ) . TagId ) ) ) ) ;
0 commit comments