Skip to content

Commit 53e4df4

Browse files
committed
Merge branch 'master' of https://github.com/popcodeorg/popcode into element-highlighter
2 parents 8812866 + a98a444 commit 53e4df4

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/clients/googleClassroom.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import qs from 'qs';
22

33
const 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
}

src/sagas/clients.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
projectExportError,
1515
} from '../actions/clients';
1616
import {getCurrentProject} from '../selectors';
17+
import {generateTextPreview} from '../util/compileProject';
1718

1819
export 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) {

test/unit/sagas/clients.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
import {createProjectSnapshot} from '../../../src/clients/firebase';
1919
import {createShareToClassroomUrl} from '../../../src/clients/googleClassroom';
2020
import {getCurrentProject} from '../../../src/selectors';
21+
import {generateTextPreview} from '../../../src/util/compileProject';
2122

2223
test('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

0 commit comments

Comments
 (0)