Merge branch 'rylxes-master'

This commit is contained in:
Tom Moor 2019-09-21 13:27:18 -07:00
commit d46530a4a0
7 changed files with 16 additions and 20 deletions

View File

@ -55,4 +55,4 @@ SMTP_PORT=
SMTP_USERNAME=
SMTP_PASSWORD=
SMTP_FROM_EMAIL=
SMTP_REPLY_EMAIL=
SMTP_REPLY_EMAIL=

View File

@ -7,6 +7,7 @@ class User extends BaseModel {
name: string;
email: string;
isAdmin: boolean;
lastActiveAt: string;
isSuspended: boolean;
createdAt: string;
}

View File

@ -51,7 +51,7 @@ class UserListItem extends React.Component<Props> {
subtitle={
<React.Fragment>
{user.email ? `${user.email} · ` : undefined}
Joined <Time dateTime={user.createdAt} /> ago
Active <Time dateTime={user.lastActiveAt} /> ago
{user.isAdmin && <Badge admin={user.isAdmin}>Admin</Badge>}
{user.isSuspended && <Badge>Suspended</Badge>}
</React.Fragment>

View File

@ -9,6 +9,7 @@ Object {
"id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
"isAdmin": false,
"isSuspended": false,
"lastActiveAt": null,
"name": "User 1",
},
"ok": true,
@ -43,6 +44,7 @@ Object {
"id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
"isAdmin": false,
"isSuspended": false,
"lastActiveAt": null,
"name": "User 1",
},
"ok": true,
@ -77,6 +79,7 @@ Object {
"id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
"isAdmin": false,
"isSuspended": false,
"lastActiveAt": null,
"name": "User 1",
},
Object {
@ -85,6 +88,7 @@ Object {
"id": "fa952cff-fa64-4d42-a6ea-6955c9689046",
"isAdmin": true,
"isSuspended": false,
"lastActiveAt": null,
"name": "Admin User",
},
],
@ -108,6 +112,7 @@ Object {
"id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
"isAdmin": false,
"isSuspended": false,
"lastActiveAt": null,
"name": "User 1",
},
Object {
@ -117,6 +122,7 @@ Object {
"id": "fa952cff-fa64-4d42-a6ea-6955c9689046",
"isAdmin": true,
"isSuspended": false,
"lastActiveAt": null,
"name": "Admin User",
},
],
@ -139,6 +145,7 @@ Object {
"id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
"isAdmin": true,
"isSuspended": false,
"lastActiveAt": null,
"name": "User 1",
},
"ok": true,
@ -173,6 +180,7 @@ Object {
"id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
"isAdmin": false,
"isSuspended": true,
"lastActiveAt": null,
"name": "User 1",
},
"ok": true,
@ -196,20 +204,4 @@ Object {
"ok": false,
"status": 401,
}
`;
exports[`#users.update should update user profile information 1`] = `
Object {
"data": Object {
"avatarUrl": "http://example.com/avatar.png",
"createdAt": "2018-01-02T00:00:00.000Z",
"email": "user1@example.com",
"id": "46fde1d4-0050-428f-9f0b-0bf77f4bdf61",
"isAdmin": false,
"isSuspended": false,
"name": "New name",
},
"ok": true,
"status": 200,
}
`;
`;

View File

@ -107,7 +107,7 @@ describe('#users.update', async () => {
const body = await res.json();
expect(res.status).toEqual(200);
expect(body).toMatchSnapshot();
expect(body.data.name).toEqual('New name');
});
it('should require authentication', async () => {

View File

@ -7,6 +7,7 @@ Object {
"id": "123",
"isAdmin": undefined,
"isSuspended": undefined,
"lastActiveAt": undefined,
"name": "Test User",
}
`;
@ -18,6 +19,7 @@ Object {
"id": "123",
"isAdmin": undefined,
"isSuspended": undefined,
"lastActiveAt": undefined,
"name": "Test User",
}
`;

View File

@ -18,6 +18,7 @@ export default (user: User, options: Options = {}): ?UserPresentation => {
const userData = {};
userData.id = user.id;
userData.createdAt = user.createdAt;
userData.lastActiveAt = user.lastActiveAt;
userData.name = user.name;
userData.isAdmin = user.isAdmin;
userData.isSuspended = user.isSuspended;