From 593aa80abf52625af47e8b9ab2bb56dae073192c Mon Sep 17 00:00:00 2001 From: Sherriff Agboola Date: Sun, 15 Sep 2019 23:07:43 +0100 Subject: [PATCH 1/5] Show last active date on people list instead of joined date --- app/models/User.js | 1 + app/scenes/Settings/components/UserListItem.js | 2 +- server/presenters/user.js | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/User.js b/app/models/User.js index a563bd0ed..c79374eb6 100644 --- a/app/models/User.js +++ b/app/models/User.js @@ -7,6 +7,7 @@ class User extends BaseModel { name: string; email: string; isAdmin: boolean; + lastActiveAt: boolean; isSuspended: boolean; createdAt: string; } diff --git a/app/scenes/Settings/components/UserListItem.js b/app/scenes/Settings/components/UserListItem.js index a2a2094de..c615b294a 100644 --- a/app/scenes/Settings/components/UserListItem.js +++ b/app/scenes/Settings/components/UserListItem.js @@ -51,7 +51,7 @@ class UserListItem extends React.Component { subtitle={ {user.email ? `${user.email} · ` : undefined} - Joined diff --git a/server/presenters/user.js b/server/presenters/user.js index 13f310a92..4299b3aa1 100644 --- a/server/presenters/user.js +++ b/server/presenters/user.js @@ -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; From 4ea4bd41cdfd0926dd6b9df208c9f812a4e26dcd Mon Sep 17 00:00:00 2001 From: Sherriff Agboola Date: Sun, 15 Sep 2019 23:28:11 +0100 Subject: [PATCH 2/5] changed lastActiveAt boolean to string --- .env.sample | 53 ---------------------------------------------- app/models/User.js | 2 +- 2 files changed, 1 insertion(+), 54 deletions(-) delete mode 100644 .env.sample diff --git a/.env.sample b/.env.sample deleted file mode 100644 index 32f80266f..000000000 --- a/.env.sample +++ /dev/null @@ -1,53 +0,0 @@ -# Copy this file to .env, remove this comment and change the keys. For development -# with docker this should mostly work out of the box other than setting the Slack -# keys (for auth) and the SECRET_KEY. -# -# Please use `openssl rand -hex 32` to create SECRET_KEY -SECRET_KEY=generate_a_new_key - -DATABASE_URL=postgres://user:pass@postgres:5432/outline -DATABASE_URL_TEST=postgres://user:pass@postgres:5432/outline-test -REDIS_URL=redis://redis:6379 - -URL=http://localhost:3000 -PORT=3000 - -DEPLOYMENT=self -ENABLE_UPDATES=true -SUBDOMAINS_ENABLED=false -WEBSOCKETS_ENABLED=true -DEBUG=cache,presenters,events - -# Third party signin credentials (at least one is required) -SLACK_KEY=get_a_key_from_slack -SLACK_SECRET=get_the_secret_of_above_key - -GOOGLE_CLIENT_ID= -GOOGLE_CLIENT_SECRET= -# Comma separated list of domains to be allowed (optional) -# If not set, all Google apps domains are allowed by default -GOOGLE_ALLOWED_DOMAINS= - -# Third party credentials (optional) -SLACK_VERIFICATION_TOKEN=PLxk6OlXXXXXVj3YYYY -SLACK_APP_ID=A0XXXXXXX -SLACK_MESSAGE_ACTIONS=true -GOOGLE_ANALYTICS_ID= -BUGSNAG_KEY= -GITHUB_ACCESS_TOKEN= - -# AWS credentials (optional in dev) -AWS_ACCESS_KEY_ID=get_a_key_from_aws -AWS_SECRET_ACCESS_KEY=get_the_secret_of_above_key -AWS_REGION=xx-xxxx-x -AWS_S3_UPLOAD_BUCKET_URL=http://s3:4569 -AWS_S3_UPLOAD_BUCKET_NAME=bucket_name_here -AWS_S3_UPLOAD_MAX_SIZE=26214400 - -# Emails configuration (optional) -SMTP_HOST= -SMTP_PORT= -SMTP_USERNAME= -SMTP_PASSWORD= -SMTP_FROM_EMAIL= -SMTP_REPLY_EMAIL= diff --git a/app/models/User.js b/app/models/User.js index c79374eb6..4242642b9 100644 --- a/app/models/User.js +++ b/app/models/User.js @@ -7,7 +7,7 @@ class User extends BaseModel { name: string; email: string; isAdmin: boolean; - lastActiveAt: boolean; + lastActiveAt: string; isSuspended: boolean; createdAt: string; } From 02f2868d069ab4ae34abdbf8455ce38164c8afc5 Mon Sep 17 00:00:00 2001 From: Sherriff Agboola Date: Sun, 15 Sep 2019 23:30:41 +0100 Subject: [PATCH 3/5] re-added the .env.sample --- .env.sample | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .env.sample diff --git a/.env.sample b/.env.sample new file mode 100644 index 000000000..09df42023 --- /dev/null +++ b/.env.sample @@ -0,0 +1,53 @@ +# Copy this file to .env, remove this comment and change the keys. For development +# with docker this should mostly work out of the box other than setting the Slack +# keys (for auth) and the SECRET_KEY. +# +# Please use `openssl rand -hex 32` to create SECRET_KEY +SECRET_KEY=generate_a_new_key + +DATABASE_URL=postgres://user:pass@postgres:5432/outline +DATABASE_URL_TEST=postgres://user:pass@postgres:5432/outline-test +REDIS_URL=redis://redis:6379 + +URL=http://localhost:3000 +PORT=3000 + +DEPLOYMENT=self +ENABLE_UPDATES=true +SUBDOMAINS_ENABLED=false +WEBSOCKETS_ENABLED=true +DEBUG=cache,presenters,events + +# Third party signin credentials (at least one is required) +SLACK_KEY=get_a_key_from_slack +SLACK_SECRET=get_the_secret_of_above_key + +GOOGLE_CLIENT_ID= +GOOGLE_CLIENT_SECRET= +# Comma separated list of domains to be allowed (optional) +# If not set, all Google apps domains are allowed by default +GOOGLE_ALLOWED_DOMAINS= + +# Third party credentials (optional) +SLACK_VERIFICATION_TOKEN=PLxk6OlXXXXXVj3YYYY +SLACK_APP_ID=A0XXXXXXX +SLACK_MESSAGE_ACTIONS=true +GOOGLE_ANALYTICS_ID= +BUGSNAG_KEY= +GITHUB_ACCESS_TOKEN= + +# AWS credentials (optional in dev) +AWS_ACCESS_KEY_ID=get_a_key_from_aws +AWS_SECRET_ACCESS_KEY=get_the_secret_of_above_key +AWS_REGION=xx-xxxx-x +AWS_S3_UPLOAD_BUCKET_URL=http://s3:4569 +AWS_S3_UPLOAD_BUCKET_NAME=bucket_name_here +AWS_S3_UPLOAD_MAX_SIZE=26214400 + +# Emails configuration (optional) +SMTP_HOST= +SMTP_PORT= +SMTP_USERNAME= +SMTP_PASSWORD= +SMTP_FROM_EMAIL= +SMTP_REPLY_EMAIL= \ No newline at end of file From b20d41a04787f210c0da2f4a3764557d24ed1398 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 21 Sep 2019 13:26:28 -0700 Subject: [PATCH 4/5] test: Update snapshots --- server/api/__snapshots__/users.test.js.snap | 26 +++++++------------ server/api/users.test.js | 2 +- .../__snapshots__/user.test.js.snap | 2 ++ 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/server/api/__snapshots__/users.test.js.snap b/server/api/__snapshots__/users.test.js.snap index 22e696a3a..aeb588f09 100644 --- a/server/api/__snapshots__/users.test.js.snap +++ b/server/api/__snapshots__/users.test.js.snap @@ -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, -} -`; +`; \ No newline at end of file diff --git a/server/api/users.test.js b/server/api/users.test.js index a13e67611..9f5841b0d 100644 --- a/server/api/users.test.js +++ b/server/api/users.test.js @@ -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 () => { diff --git a/server/presenters/__snapshots__/user.test.js.snap b/server/presenters/__snapshots__/user.test.js.snap index cba56d1bc..f1f3b40bc 100644 --- a/server/presenters/__snapshots__/user.test.js.snap +++ b/server/presenters/__snapshots__/user.test.js.snap @@ -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", } `; From 3f7d4f7873de962a95c74001534374c98c2f8ea9 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 21 Sep 2019 13:27:00 -0700 Subject: [PATCH 5/5] fix: tweak wording --- app/scenes/Settings/components/UserListItem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/scenes/Settings/components/UserListItem.js b/app/scenes/Settings/components/UserListItem.js index c615b294a..586ec92fd 100644 --- a/app/scenes/Settings/components/UserListItem.js +++ b/app/scenes/Settings/components/UserListItem.js @@ -51,7 +51,7 @@ class UserListItem extends React.Component { subtitle={ {user.email ? `${user.email} · ` : undefined} - Last Active