From f5473a3b7f443fe1629145657cce10942a186fdf Mon Sep 17 00:00:00 2001 From: Will Refvem Date: Wed, 10 Jun 2015 10:02:51 -0400 Subject: [PATCH 1/7] Removed .DS_Store from index and added it to .gitignore --- .DS_Store | Bin 6148 -> 0 bytes .gitignore | 1 + 2 files changed, 1 insertion(+) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 4cde2d1df89a5296513572b7e6fe5640dcf9500d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKL2KJE6qb@KbJ83Tn?A zAX#*hSsbK8SC2Q4K{g)QPkPgE4yipa4*N2dzKmq{sZz0^jO_Yy*=oORh}Ns-sv(x` zcC#T~Ja4a7_D{=t`mA;Q_GGg9{N?Mn^Na64e*M-f!QrD-a%gZ3f56xxW$sSnD2YFU zf1R_AB_sxj0b*be88BO!b+CuePLE6s5Cb>M0PYV06wxu5YgAhYRQUUd{Ut;cu<@~ diff --git a/.gitignore b/.gitignore index 99995a2b..ad18b101 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ coverage/* libpeerconnection.log npm-debug.log testem.log +.DS_Store # files generated by older build tools public/scripts From eff7d41a062c3cf3db940fca14ca7bf6800558c9 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Mon, 15 Jun 2015 18:15:39 +0200 Subject: [PATCH 2/7] add api icon --- app/styles/app/layouts/build-job.sass | 2 ++ app/styles/app/modules/icons.sass | 6 ++++++ app/styles/app/modules/tiles.sass | 9 ++++++--- public/images/svg/api-dark-grey.svg | 7 +++++++ public/images/svg/api-light-grey.svg | 10 ++++++++++ public/images/svg/api-white.svg | 7 +++++++ 6 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 public/images/svg/api-dark-grey.svg create mode 100644 public/images/svg/api-light-grey.svg create mode 100644 public/images/svg/api-white.svg diff --git a/app/styles/app/layouts/build-job.sass b/app/styles/app/layouts/build-job.sass index 344469dc..22831b85 100644 --- a/app/styles/app/layouts/build-job.sass +++ b/app/styles/app/layouts/build-job.sass @@ -50,6 +50,8 @@ width: 1.4em .icon--env width: 1.1em + .icon.api + height: 1.5em @media #{$medium-up} height: 36px diff --git a/app/styles/app/modules/icons.sass b/app/styles/app/modules/icons.sass index 90c89c65..f10322c2 100644 --- a/app/styles/app/modules/icons.sass +++ b/app/styles/app/modules/icons.sass @@ -88,6 +88,12 @@ .icon--grey.pull_request background-image: inline-image('svg/icon-request-pull.svg') +.icon-api, +.icon.api + background-image: inline-image('svg/api-white.svg') +.icon--grey.api + background-image: inline-image('svg/api-light-grey.svg') + .icon-lock background-image: inline-image('dashboard/private-icon.svg') diff --git a/app/styles/app/modules/tiles.sass b/app/styles/app/modules/tiles.sass index ad7e284c..d3c9fd4d 100644 --- a/app/styles/app/modules/tiles.sass +++ b/app/styles/app/modules/tiles.sass @@ -105,21 +105,22 @@ height: 100% border-top-left-radius: 4px border-bottom-left-radius: 4px - .icon-status + .icon display: block + .icon-status width: 1.1em height: 1.2em margin: .7em auto 1em .icon.push - display: block width: 1.4em height: 1.1em margin: -0.2em auto 0 .icon.pull_request - display: block width: 1.1em height: 1.6em margin: -0.5em auto 0 + .icon.api + margin: -0.4em 0.75em .icon--job @extend %absolute-center @@ -154,6 +155,8 @@ white-space: nowrap @media #{$xlarge-up} @include grid-column(5) + .icon.api + margin: -0.2em 0.75em p.tile-single-line padding: .7em 0 diff --git a/public/images/svg/api-dark-grey.svg b/public/images/svg/api-dark-grey.svg new file mode 100644 index 00000000..72d4c7f9 --- /dev/null +++ b/public/images/svg/api-dark-grey.svg @@ -0,0 +1,7 @@ + + + + + diff --git a/public/images/svg/api-light-grey.svg b/public/images/svg/api-light-grey.svg new file mode 100644 index 00000000..2fa4e7dc --- /dev/null +++ b/public/images/svg/api-light-grey.svg @@ -0,0 +1,10 @@ + + + + + + diff --git a/public/images/svg/api-white.svg b/public/images/svg/api-white.svg new file mode 100644 index 00000000..3956236f --- /dev/null +++ b/public/images/svg/api-white.svg @@ -0,0 +1,7 @@ + + + + + From 0b548f7316b10429f5aa3050d4ecf2487a379d96 Mon Sep 17 00:00:00 2001 From: Lisa Passing Date: Mon, 15 Jun 2015 19:08:33 +0200 Subject: [PATCH 3/7] start adding title attributes to icons --- app/templates/build.hbs | 4 ++-- app/templates/components/builds-item.hbs | 4 ++-- app/templates/job.hbs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/templates/build.hbs b/app/templates/build.hbs index 398a5e2b..8e42bc9c 100644 --- a/app/templates/build.hbs +++ b/app/templates/build.hbs @@ -3,8 +3,8 @@ {{else}}
- - + +
diff --git a/app/templates/components/builds-item.hbs b/app/templates/components/builds-item.hbs index eb6f3d65..ce555266 100644 --- a/app/templates/components/builds-item.hbs +++ b/app/templates/components/builds-item.hbs @@ -1,6 +1,6 @@
- - + +
diff --git a/app/templates/job.hbs b/app/templates/job.hbs index 81b394e8..d1c83dea 100644 --- a/app/templates/job.hbs +++ b/app/templates/job.hbs @@ -2,8 +2,8 @@
- - + +
From 4115a7c59b84134b17d57fd7632e993a2c5ac1a4 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 16 Jun 2015 15:25:21 +0200 Subject: [PATCH 4/7] Don't check scopes for Travis Become --- app/utils/auth.coffee | 9 +++++++-- waiter/lib/travis/web/set_token.rb | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/utils/auth.coffee b/app/utils/auth.coffee index 6a894333..11d22f46 100644 --- a/app/utils/auth.coffee +++ b/app/utils/auth.coffee @@ -52,11 +52,16 @@ Auth = Ember.Object.extend null validateUser: (user) -> - fieldsToValidate = ['id', 'login', 'token', 'correct_scopes'] + fieldsToValidate = ['id', 'login', 'token'] + isTravisBecome = sessionStorage.getItem('travis.become') + + unless isTravisBecome + fieldsToValidate.push 'correct_scopes' + if config.pro fieldsToValidate.push 'channels' - fieldsToValidate.every( (field) => @validateHas(field, user) ) && user.correct_scopes + fieldsToValidate.every( (field) => @validateHas(field, user) ) && (isTravisBecome || user.correct_scopes) validateHas: (field, user) -> if user[field] diff --git a/waiter/lib/travis/web/set_token.rb b/waiter/lib/travis/web/set_token.rb index af73cbdc..82907ae8 100644 --- a/waiter/lib/travis/web/set_token.rb +++ b/waiter/lib/travis/web/set_token.rb @@ -33,5 +33,6 @@ __END__ var storage = %s; storage.setItem('travis.token', %p); storage.setItem('travis.user', %p); +storage.setItem('travis.become', true); window.location = %p; From fb4b39f8afa3fee3f01daa783710255e01f4fc72 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 16 Jun 2015 17:17:00 +0200 Subject: [PATCH 5/7] Remove other occurances of .DS_Store --- assets/images/.DS_Store | Bin 6148 -> 0 bytes assets/images/ui/.DS_Store | Bin 6148 -> 0 bytes public/.DS_Store | Bin 6148 -> 0 bytes 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 assets/images/.DS_Store delete mode 100644 assets/images/ui/.DS_Store delete mode 100644 public/.DS_Store diff --git a/assets/images/.DS_Store b/assets/images/.DS_Store deleted file mode 100644 index febda9aab7480244fc3ef8735d7cb25be5ca9e55..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKy-ve05VqR_2}lqmhO%X2=@8TwMxszA7Nj6LP*f77qLHe&YEwFtqKy2$2Z9%3 z;9aqGG;Nx3{b?J3C%Zx`J*hF4?2~eFyA4XFRrUO=Ekfd~h6!o4fmm$EW9)S4A?1?@`L8 z#tFQEA?v;Ndr3zmSJ0otPGSg&0b+m{Sab&TzGtj0dZAPwF+dFbngQG&Y*0j3W2R7U z9nj$KBaRmkQNYH#1fs3c)tD)S5fH9Y0aYs3R}8Mw!Eft0S7WA7r86#9hI#bLT;EW* zTpj$j3}@U`NG&ly49qf+S6vIw|D&Jp|FcQdBL;|pg<^mgYJSawlJwa+R~(+THs~cN p3dUs$rzv2_qZnfGC@z9Z0l$p~psO)c2p$mn5s)-cLk#>W1D}@`R*wJx diff --git a/assets/images/ui/.DS_Store b/assets/images/ui/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Tue, 16 Jun 2015 17:54:55 +0200 Subject: [PATCH 6/7] Always refresh a user record when page is loaded --- app/routes/application.coffee | 5 +++++ app/utils/auth.coffee | 36 ++++++++++++++++++++--------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/app/routes/application.coffee b/app/routes/application.coffee index 9838bfc5..de66f55e 100644 --- a/app/routes/application.coffee +++ b/app/routes/application.coffee @@ -5,6 +5,11 @@ Route = TravisRoute.extend BuildFaviconMixin, needsAuth: false + beforeModel: -> + @_super.apply(this, arguments) + + @get('auth').refreshUserData() + renderTemplate: -> if @get('config').pro $('body').addClass('pro') diff --git a/app/utils/auth.coffee b/app/utils/auth.coffee index 11d22f46..15d823d1 100644 --- a/app/utils/auth.coffee +++ b/app/utils/auth.coffee @@ -79,18 +79,26 @@ Auth = Ember.Object.extend @set('state', 'signed-in') Travis.trigger('user:signed_in', data.user) @sendToApp('afterSignIn') - @refreshUserData(data.user) refreshUserData: (user) -> - Ajax.get "/users/#{user.id}", (data) => - @store.pushPayload(users: [data.user]) - # if user is still signed in, update saved data - if @get('signedIn') - data.user.token = user.token - @storeData(data, @sessionStorage) - @storeData(data, @storage) - , (status, xhr) => - @signOut() if status == 403 + unless user + if data = @userDataFrom(@sessionStorage) || @userDataFrom(@storage) + user = data.user + + if user + Ajax.get "/users/#{user.id}", (data) => + if data.user.correct_scopes + userRecord = @loadUser(data.user) + userRecord.get('permissions') + # if user is still signed in, update saved data + if @get('signedIn') + data.user.token = user.token + @storeData(data, @sessionStorage) + @storeData(data, @storage) + else + @signOut() + , (status, xhr) => + @signOut() if status == 403 signedIn: (-> @get('state') == 'signed-in' @@ -110,9 +118,7 @@ Auth = Ember.Object.extend loadUser: (user) -> @store.pushPayload(users: [user]) - user = @store.recordForId('user', user.id) - user.get('permissions') - user + @store.recordForId('user', user.id) receiveMessage: (event) -> if event.origin == @expectedOrigin() @@ -134,9 +140,9 @@ Auth = Ember.Object.extend # as a direct response to either manual sign in or autoSignIn (right now # we treat both cases behave the same in terms of sent events which I think # makes it more complicated than it should be). - controller = @container.lookup('controller:auth') + router = @container.lookup('router:main') try - controller.send(name) + router.send(name) catch error unless error.message =~ /Can't trigger action/ throw error From 2332c3cf63150d573601a46754aa5f2ae4435cac Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 16 Jun 2015 18:18:14 +0200 Subject: [PATCH 7/7] Fix specs --- app/utils/test-auth.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/utils/test-auth.coffee b/app/utils/test-auth.coffee index fdffd7a3..64010270 100644 --- a/app/utils/test-auth.coffee +++ b/app/utils/test-auth.coffee @@ -48,4 +48,6 @@ Auth = Ember.Object.extend if @get('state') == 'signed-in' 'a-token' + refreshUserData: (->) + `export default Auth`