File tree Expand file tree Collapse file tree 6 files changed +77
-1
lines changed
components/discordinator-join-button
integration/pods/components/discordinator Expand file tree Collapse file tree 6 files changed +77
-1
lines changed Original file line number Diff line number Diff line change 221221 </div >
222222 </a >
223223 {{ /if }}
224+ <DiscordinatorJoinButton />
224225 {{ #if (and (is-after (unix runAttempt.run.start ) ' 2019-11-29' ) showGoodieRequest )}}
225226 {{!-- <GoodieComp class="mb-5" @runAttempt ={{runAttempt}} /> --}}
226227 {{ /if }}
Original file line number Diff line number Diff line change 1+ import Component from '@ember/component' ;
2+ import ENV from 'codingblocks-online/config/environment' ;
3+ import { restartableTask } from 'ember-concurrency-decorators' ;
4+
5+ export default class DiscordinatorComponent extends Component {
6+ shouldJoinDiscord = false ;
7+ redirectUrl = ENV . discordinatorUrl + '/app/connect' ;
8+
9+ didReceiveAttrs ( ) {
10+ this . fetchDiscordSynced . perform ( ) ;
11+ }
12+
13+ @restartableTask fetchDiscordSynced = function * ( ) {
14+ const resp = yield fetch ( ENV . discordinatorUrl + '/app/me' , {
15+ credentials : 'include' ,
16+ mode : 'cors'
17+ } ) ;
18+
19+ if ( ! resp . ok ) return this . set ( 'shouldJoinDiscord' , false ) ;
20+
21+ const { user } = yield resp . json ( ) ;
22+
23+ return this . set ( 'shouldJoinDiscord' , ! user || ! user . discordId ) ;
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ {{ #if shouldJoinDiscord }}
2+ <a href =" {{ redirectUrl }} " target =" _blank" >
3+ <div
4+ class =" border-card border-none bg-gradient-violet-bt mb-5 white p-4 v-align-ma mt-md-0 mt-5 row no-gutters align-items-center"
5+ >
6+ <i class =" fab fa-discord fa-2x mr-2" ></i >
7+ <strong class =" font-sm flex-1 pl-1" >Join Discord Group</strong >
8+ </div >
9+ </a >
10+ {{ /if }}
Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ module.exports = function(environment) {
101101 webPropertyId : 'UA-83327907-12'
102102 }
103103 ENV . OnesignalAppId = 'ae392a03-3c7d-498b-94aa-2a7c17f7db0c'
104+ ENV . discordinatorUrl = 'http://localhost:5050'
104105 }
105106
106107 if ( environment === 'test' ) {
@@ -138,7 +139,7 @@ module.exports = function(environment) {
138139 appId : '2LhQvB3j'
139140 }
140141 ENV . OnesignalAppId = '01d75aac-5123-4145-b655-ba8d27c5dc13'
141-
142+ ENV . discordinatorUrl = 'https://discordinator.codingblocks.com'
142143 }
143144
144145 if ( environment === 'staging' ) {
@@ -148,6 +149,7 @@ module.exports = function(environment) {
148149 ENV . oneauthURL = 'https://account.codingblocks.com'
149150 ENV . hackApiHost = 'https://hack-api.codingblocks.xyz'
150151 ENV . hiringblocksUrl = 'https://hire.codingblocks.xyz'
152+ ENV . discordinatorUrl = 'https://discordinator.codingblocks.com'
151153
152154 ENV . talkjs = {
153155 appId : '2LhQvB3j'
Original file line number Diff line number Diff line change 1+ import { module , test } from 'qunit' ;
2+ import { setupRenderingTest } from 'ember-qunit' ;
3+ import { render } from '@ember/test-helpers' ;
4+ import { hbs } from 'ember-cli-htmlbars' ;
5+
6+ module ( 'Integration | Component | discordinator' , function ( hooks ) {
7+ setupRenderingTest ( hooks ) ;
8+
9+ test ( 'it renders' , async function ( assert ) {
10+ // Set any properties with this.set('myProperty', 'value');
11+ // Handle any actions with this.set('myAction', function(val) { ... });
12+
13+ await render ( hbs `<Discordinator />` ) ;
14+
15+ assert . equal ( this . element . textContent . trim ( ) , '' ) ;
16+
17+ // Template block usage:
18+ await render ( hbs `
19+ <Discordinator>
20+ template block text
21+ </Discordinator>
22+ ` ) ;
23+
24+ assert . equal ( this . element . textContent . trim ( ) , 'template block text' ) ;
25+ } ) ;
26+ } ) ;
Original file line number Diff line number Diff line change 1+ import { module , test } from 'qunit' ;
2+ import { setupTest } from 'ember-qunit' ;
3+
4+ module ( 'Unit | Service | discordinator' , function ( hooks ) {
5+ setupTest ( hooks ) ;
6+
7+ // Replace this with your real tests.
8+ test ( 'it exists' , function ( assert ) {
9+ let service = this . owner . lookup ( 'service:discordinator' ) ;
10+ assert . ok ( service ) ;
11+ } ) ;
12+ } ) ;
You can’t perform that action at this time.
0 commit comments