Skip to content

Commit e2f6f4a

Browse files
authored
Merge pull request #372 from mapbox/develop
v0.60.0 release
2 parents 8c943c1 + 18b06c9 commit e2f6f4a

File tree

5 files changed

+80
-25
lines changed

5 files changed

+80
-25
lines changed

CHANGELOG.md

+28-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,36 @@
22

33
Log of changes since the 2.0 version
44

5-
### Next release
65

7-
- Add Mapping Team filters
8-
- Show some details we have on the database about deleted users
6+
### 0.60.0
97

8+
- disable logout when requests fails
9+
- adjust status modal position
10+
11+
### 0.58.2
12+
13+
- Add solution to filter out changesets newer than 5 minutes on the API request
14+
15+
### 0.58.0
16+
17+
- Exclude changesets newer than 5 minutes from query results
18+
- Change position of status notification
19+
- Show unverified teams and add string to distinct the verified ones on the filters page
20+
21+
### 0.56.2
22+
23+
- Add system status modal
24+
25+
### 0.56.1
26+
27+
- Update changeset-map to 1.3.4
28+
29+
### 0.56.0
30+
31+
- Show some stats of a deleted user on the changeset user panel
32+
- Add Mapping Team filter fields
33+
- Add forms to allow the creation and management of Mapping Teams
34+
- Code linting and text improvements
1035

1136
### 0.54.1
1237

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "osmcha-frontend",
3-
"version": "0.58.2",
3+
"version": "0.60.0",
44
"license": "ISC",
55
"engines": {
66
"node": ">=7.0"

src/components/changeset/header.js

+16-7
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,20 @@ class Header extends React.PureComponent {
2222
const create = this.props.properties.get('create');
2323
const modify = this.props.properties.get('modify');
2424
const destroy = this.props.properties.get('delete');
25-
const is_whitelisted = this.props.whitelisted.indexOf(user) !== -1;
26-
const is_blacklisted =
27-
this.props.blacklisted
28-
.map(user => user.get('uid'))
29-
.indexOf(this.props.properties.get('uid')) !== -1;
25+
let is_whitelisted, is_blacklisted;
26+
try {
27+
is_whitelisted = this.props.whitelisted.indexOf(user) !== -1;
28+
} catch (e) {
29+
is_whitelisted = false;
30+
}
31+
try {
32+
is_blacklisted =
33+
this.props.blacklisted
34+
.map(user => user.get('uid'))
35+
.indexOf(this.props.properties.get('uid')) !== -1;
36+
} catch (e) {
37+
is_blacklisted = false;
38+
}
3039

3140
return (
3241
<div className="px12 py6">
@@ -62,10 +71,10 @@ class Header extends React.PureComponent {
6271
)}
6372
{this.props.userEditCount > 0 && (
6473
<span className="txt-s txt-em">
65-
&nbsp;({this.props.userEditCount} edits)&nbsp;
74+
&nbsp;({this.props.userEditCount} edits)
6675
</span>
6776
)}
68-
created&nbsp;{moment(date).fromNow()}
77+
&nbsp;created&nbsp;{moment(date).fromNow()}
6978
</span>
7079
</div>
7180
</div>

src/network/aoi.js

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ export function handleErrors(response: Object) {
2020
'Authentication error. Sign in again and repeat the operation.'
2121
);
2222
}
23+
if (response.status === 404) {
24+
throw new Error('Resource not found.');
25+
}
2326
if (r && r.detail) throw new Error(r.detail);
2427
if (response.statusText) throw new Error(response.statusText);
2528
return Promise.reject('network request failed');

src/store/auth_actions.js

+32-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @flow
22
import { put, call, take, select, all, takeLatest } from 'redux-saga/effects';
33
import { delay as delayPromise } from 'redux-saga';
4+
import { push } from 'react-router-redux';
45
import { fromJS } from 'immutable';
56

67
import {
@@ -49,6 +50,9 @@ export const logUserOut = () => action(AUTH.logout);
4950

5051
export const tokenSelector = (state: RootStateType) => state.auth.get('token');
5152

53+
export const locationSelector = (state: RootStateType) =>
54+
state.routing.location;
55+
5256
export const changesetIdSelector = (state: RootStateType) =>
5357
state.changeset.get('changesetId');
5458

@@ -114,43 +118,57 @@ export function* watchAuth(): any {
114118
description: status.get('message'),
115119
kind: status.get('status'),
116120
autoDismiss: 20,
117-
position: 'br'
121+
position: 'bc'
118122
})
119123
);
120124
}
121125

122126
yield take(AUTH.logout);
123127
delayBy = DELAY;
128+
token = undefined;
129+
yield call(logoutFlow);
130+
yield call(delay, delayBy);
124131
} catch (error) {
125132
console.log(error);
126133
yield put(action(AUTH.loginError, error));
127134
yield call(delay, delayBy / 2);
128-
error.name = 'Login Failed';
135+
error.name = 'Error';
129136
yield put(
130137
modal({
131138
error,
132139
kind: 'warning'
133140
})
134141
);
142+
yield take(AUTH.logout);
135143
delayBy = 4 * delayBy;
136-
} finally {
137144
token = undefined;
138-
yield call(removeItem, 'token');
139-
yield call(removeItem, 'oauth_token');
140-
yield call(removeItem, 'oauth_token_secret');
141-
yield put(action(AUTH.clearSession));
142-
yield put(action(WHITELIST.clear));
143-
// get CHANGESET_PAGE without user metadata
144-
let pageIndex = yield select(pageIndexSelector);
145-
if (pageIndex) {
146-
yield put(action(CHANGESETS_PAGE.fetch, { pageIndex }));
147-
}
148-
yield put(action(AUTH.clearUserDetails));
145+
yield call(logoutFlow);
149146
yield call(delay, delayBy);
150147
}
151148
}
152149
}
153150

151+
export function* logoutFlow(): any {
152+
yield call(removeItem, 'token');
153+
yield call(removeItem, 'oauth_token');
154+
yield call(removeItem, 'oauth_token_secret');
155+
yield put(action(AUTH.clearSession));
156+
yield put(action(WHITELIST.clear));
157+
// get CHANGESET_PAGE without user metadata
158+
let pageIndex = yield select(pageIndexSelector);
159+
if (pageIndex) {
160+
yield put(action(CHANGESETS_PAGE.fetch, { pageIndex }));
161+
}
162+
yield put(action(AUTH.clearUserDetails));
163+
let location = yield select(locationSelector);
164+
yield put(
165+
push({
166+
...location,
167+
pathname: '/'
168+
})
169+
);
170+
}
171+
154172
export function* authTokenFlow(): any {
155173
const { oauth_token, oauth_token_secret } = yield call(postTokensOSMCha);
156174
yield put(

0 commit comments

Comments
 (0)