Skip to content
This repository has been archived by the owner on Oct 1, 2019. It is now read-only.

Commit

Permalink
Merge hotfix-search into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
indeyets committed Aug 31, 2016
2 parents 2e2d297 + e54fe2b commit 7bac4a1
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 33 deletions.
4 changes: 2 additions & 2 deletions deploy/production/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ sphinx:
- "127.0.0.1:9306:9306"
restart: always
app:
image: "quay.io/dipstudio/libertysoil:1.7.1"
image: "quay.io/dipstudio/libertysoil:1.7.2"
ports:
- "127.0.0.1:8000:8000"
links:
Expand All @@ -49,7 +49,7 @@ app:
- "./secrets.env"
restart: always
queue:
image: "quay.io/dipstudio/libertysoil:1.7.1"
image: "quay.io/dipstudio/libertysoil:1.7.2"
links:
- db
- redis
Expand Down
2 changes: 1 addition & 1 deletion npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "libertysoil",
"version": "1.7.1",
"version": "1.7.2",
"description": "Libertysoil.org website",
"license": "AGPL-3.0+",
"repository": {
Expand Down
40 changes: 12 additions & 28 deletions src/api/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,13 @@ export default class ApiClient
defaultHeaders = { Cookie: this.serverReq.headers['cookie'] };
}

const req = fetch(
return fetch(
this.apiUrlForFetch(relativeUrl, query),
{
credentials: 'same-origin',
headers: defaultHeaders
}
);

return Promise.resolve(req);
}

async head(relativeUrl, query = {}) {
Expand All @@ -68,16 +66,14 @@ export default class ApiClient
defaultHeaders = { Cookie: this.serverReq.headers['cookie'] };
}

const req = fetch(
return fetch(
this.apiUrlForFetch(relativeUrl, query),
{
credentials: 'same-origin',
method: 'HEAD',
headers: defaultHeaders
}
);

return Promise.resolve(req);
}

async del(relativeUrl) {
Expand All @@ -87,16 +83,14 @@ export default class ApiClient
defaultHeaders = { Cookie: this.serverReq.headers['cookie'] };
}

const req = fetch(
return fetch(
this.apiUrlForFetch(relativeUrl),
{
credentials: 'same-origin',
method: 'DELETE',
headers: defaultHeaders
}
);

return Promise.resolve(req);
}

async post(relativeUrl, data = null) {
Expand All @@ -116,7 +110,7 @@ export default class ApiClient
body = stringify(data);
}

const req = fetch(
return fetch(
this.apiUrl(relativeUrl),
{
credentials: 'same-origin',
Expand All @@ -125,8 +119,6 @@ export default class ApiClient
body
}
);

return Promise.resolve(req);
}

/*
Expand All @@ -147,7 +139,7 @@ export default class ApiClient
body = data;
}

const req = fetch(
return fetch(
this.apiUrl(relativeUrl),
{
credentials: 'same-origin',
Expand All @@ -156,8 +148,6 @@ export default class ApiClient
body
}
);

return Promise.resolve(req);
}

async postJSON(relativeUrl, data = null) {
Expand All @@ -177,7 +167,7 @@ export default class ApiClient
body = JSON.stringify(data);
}

const req = fetch(
return fetch(
this.apiUrl(relativeUrl),
{
credentials: 'same-origin',
Expand All @@ -186,8 +176,6 @@ export default class ApiClient
body
}
);

return Promise.resolve(req);
}

async subscriptions(offset = 0) {
Expand Down Expand Up @@ -469,7 +457,7 @@ export default class ApiClient

async search(query) {
const response = await this.get(`/api/v1/search/${query}`);
return response.body;
return await response.json();
}

async tagCloud() {
Expand Down Expand Up @@ -499,7 +487,7 @@ export default class ApiClient

async searchSchools(query) {
const response = await this.get(`/api/v1/schools/search/${query}`);
return response.body;
return await response.json();
}

async followSchool(name) {
Expand Down Expand Up @@ -585,14 +573,10 @@ export default class ApiClient
}

async saveComment(postId, commentId, text) {
try {
const response = await this.post(`/api/v1/post/${postId}/comment/${commentId}`, {
text
});
return response.body;
} catch (err) {
return err.response.body;
}
const response = await this.post(`/api/v1/post/${postId}/comment/${commentId}`, {
text
});
return await response.json();
}

async subscribeToPost(postId) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const FooterComponent = () => (
<a href="mailto:info@libertysoil.org">info@libertysoil.org</a>
</p>
<p>
<a href="https://github.com/Lokiedu/libertysoil-site/milestones">Version 1.7.1</a>
<a href="https://github.com/Lokiedu/libertysoil-site/milestones">Version 1.7.2</a>
</p>
<script async data-trackduck-id="56182f159e7749be13765442" src="//d1ks1friyst4m3.cloudfront.net/toolbar/prod/td.js"></script>
</footer>
Expand Down
6 changes: 6 additions & 0 deletions test/integration/api/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ describe('Client test', () => {
expect(result.error, 'to be', 'You are not authorized');
});

it('#search works', async () => {
const result = await client.search('test');

expect(result, 'to be an', 'object');
expect(result, 'to have key', 'error');
});
});

describe('Authenticated client test', () => {
Expand Down

0 comments on commit 7bac4a1

Please sign in to comment.