File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ import qs from 'qs';
22
33const BASE_URL = 'https://classroom.google.com/u/0/share?' ;
44
5- export function createShareToClassroomUrl ( snapshotKey ) {
5+ export function createShareToClassroomUrl ( snapshotKey , title ) {
66 const uri = document . createElement ( 'a' ) ;
77 uri . href = '/' ;
88 uri . search = `snapshot=${ snapshotKey } ` ;
9- return BASE_URL + qs . stringify ( { url : uri . href } ) ;
9+ return BASE_URL + qs . stringify ( { url : uri . href , title } ) ;
1010}
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414 projectExportError ,
1515} from '../actions/clients' ;
1616import { getCurrentProject } from '../selectors' ;
17+ import { generateTextPreview } from '../util/compileProject' ;
1718
1819export function * createSnapshot ( ) {
1920 const project = yield select ( getCurrentProject ) ;
@@ -38,7 +39,8 @@ export function* exportProject({payload: {exportType}}) {
3839 ( { html_url : url } = yield call ( createRepoFromProject , project , user ) ) ;
3940 } else if ( exportType === 'classroom' ) {
4041 const snapshotKey = yield call ( createProjectSnapshot , project ) ;
41- url = yield call ( createShareToClassroomUrl , snapshotKey ) ;
42+ const projectTitle = yield call ( generateTextPreview , project ) ;
43+ url = yield call ( createShareToClassroomUrl , snapshotKey , projectTitle ) ;
4244 }
4345 yield put ( projectExported ( url , exportType ) ) ;
4446 } catch ( e ) {
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
1818import { createProjectSnapshot } from '../../../src/clients/firebase' ;
1919import { createShareToClassroomUrl } from '../../../src/clients/googleClassroom' ;
2020import { getCurrentProject } from '../../../src/selectors' ;
21+ import { generateTextPreview } from '../../../src/util/compileProject' ;
2122
2223test ( 'createSnapshot()' , ( t ) => {
2324 const { project} = new Scenario ( ) ;
@@ -121,6 +122,7 @@ test('export to classroom', (t) => {
121122 'https://classroom.google.com/u/0/share?url=http://popcode.org' ;
122123 const exportType = 'classroom' ;
123124 const snapshotKey = '123-456' ;
125+ const projectTitle = 'Page Title' ;
124126 const scenario = new Scenario ( ) ;
125127 scenario . logIn ( ) ;
126128
@@ -134,8 +136,13 @@ test('export to classroom', (t) => {
134136 scenario . project . toJS ( ) ,
135137 ) .
136138 next ( snapshotKey ) . call (
139+ generateTextPreview ,
140+ scenario . project . toJS ( ) ,
141+ ) .
142+ next ( projectTitle ) . call (
137143 createShareToClassroomUrl ,
138144 snapshotKey ,
145+ projectTitle ,
139146 ) ;
140147 }
141148
You can’t perform that action at this time.
0 commit comments