@@ -168,7 +168,8 @@ export const App = {
168
168
experience : 'experienced'
169
169
} ,
170
170
categories : { } ,
171
- issues : [ ]
171
+ issues : [ ] ,
172
+ octokit : null
172
173
}
173
174
} ,
174
175
computed : {
@@ -179,38 +180,59 @@ export const App = {
179
180
*/
180
181
filteredIssues ( ) {
181
182
return this . issues . filter ( issue => {
183
+ // If aim is to triage issues
184
+ if ( this . filters . aim === 'triage' ) {
185
+ // Show all issues as they all have the label "🚦 status: awaiting triage"
186
+ return true
187
+ }
188
+
182
189
// Check experience match
183
190
if ( this . filters . experience === 'beginner' && ! issue . labels . includes ( 'good first issue' ) ) {
184
191
return false
185
192
}
186
193
187
194
// Check skill set match
188
195
const joinedLabels = issue . labels . join ( ',' )
189
- if ( this . filters . skills . length && ! this . filters . skills . some ( skill => joinedLabels . includes ( skill ) ) ) {
190
- return false
191
- }
192
-
193
- return true
196
+ return ! ( this . filters . skills . length && ! this . filters . skills . some ( skill => joinedLabels . includes ( skill ) ) ) ;
194
197
} ) . sort ( ( a , b ) => b . createdAt - a . createdAt )
195
198
}
196
199
} ,
200
+ watch : {
201
+ 'filters.aim' ( to , from ) {
202
+ if ( to !== from ) {
203
+ this . loadIssues ( )
204
+ }
205
+ }
206
+ } ,
207
+ methods : {
208
+ loadIssues ( ) {
209
+ const q = [ 'org:creativecommons' , 'is:open' , 'is:issue' ]
210
+ if ( this . filters . aim === 'contribute' ) {
211
+ q . push ( 'label:"help wanted"' )
212
+ } else if ( this . filters . aim === 'triage' ) {
213
+ q . push ( 'label:"🚦 status: awaiting triage"' )
214
+ }
215
+ this . octokit . search . issuesAndPullRequests ( {
216
+ q : q . join ( ' ' ) ,
217
+ per_page : 100 ,
218
+ sort : 'updated'
219
+ } ) . then ( res => {
220
+ this . issues = res . data . items
221
+ this . issues . forEach ( issue => {
222
+ issue . labels = issue . labels . map ( label => label . name )
223
+
224
+ const repoUrl = issue . repository_url
225
+ issue . repo = repoUrl . slice ( repoUrl . lastIndexOf ( '/' ) + 1 )
226
+ } )
227
+ } )
228
+ }
229
+ } ,
197
230
mounted ( ) {
198
231
const BASE_URL = 'https://raw.githubusercontent.com/creativecommons/ccos-scripts/master/normalize_repos'
199
232
const FILE_URL = name => `${ BASE_URL } /${ name } .json`
200
233
201
- const octokit = new Octokit ( ) ;
202
- octokit . search . issuesAndPullRequests ( {
203
- q : 'org:creativecommons is:open is:issue label:"help wanted"' ,
204
- per_page : 100
205
- } ) . then ( res => {
206
- this . issues = res . data . items
207
- this . issues . forEach ( issue => {
208
- issue . labels = issue . labels . map ( label => label . name )
209
-
210
- const repoUrl = issue . repository_url
211
- issue . repo = repoUrl . slice ( repoUrl . lastIndexOf ( '/' ) + 1 )
212
- } )
213
- } )
234
+ this . octokit = new Octokit ( )
235
+ this . loadIssues ( )
214
236
215
237
Promise
216
238
. all ( [
0 commit comments