diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c89b2d48..5bcffad4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,13 @@ - 🐛 \[Bug\] Update maintenance page email [\#1731](https://github.com/Human-Connection/Human-Connection/issues/1731) - 🐛 \[Bug\] Editing comments is not reactive again [\#1718](https://github.com/Human-Connection/Human-Connection/issues/1718) - 🐛 \[Bug\] Comments with mentions in the end not displayed [\#1665](https://github.com/Human-Connection/Human-Connection/issues/1665) +- 🐛 \[Bug\] Moderators and Admins can be blocked [\#1663](https://github.com/Human-Connection/Human-Connection/issues/1663) +- 🐛 \[Bug\] Links in Comments don't show up [\#1661](https://github.com/Human-Connection/Human-Connection/issues/1661) - 🐛 \[Bug\] Delete the Sleep Icon [\#1659](https://github.com/Human-Connection/Human-Connection/issues/1659) +- 🐛 \[Bug\] Mail Layout German/English not working in Webmail [\#1656](https://github.com/Human-Connection/Human-Connection/issues/1656) - 🐛 \[Bug\] Far to less Characters per Contribution \(2000\) [\#1639](https://github.com/Human-Connection/Human-Connection/issues/1639) - 🐛 \[Bug\] Notifications do just update with page reload [\#1637](https://github.com/Human-Connection/Human-Connection/issues/1637) +- 🐛 \[Bug\] Admin statistics entries are missing [\#1633](https://github.com/Human-Connection/Human-Connection/issues/1633) - 🐛 \[Bug\] Can no users used all hashtags be correct? [\#1632](https://github.com/Human-Connection/Human-Connection/issues/1632) - 🐛 \[Bug\] Create account has no info about email, no localisation, no HC logo [\#1631](https://github.com/Human-Connection/Human-Connection/issues/1631) - 🐛 \[Bug\] Embeds are displayed when creating comments but get removed [\#1547](https://github.com/Human-Connection/Human-Connection/issues/1547) @@ -21,14 +25,35 @@ **Closed issues:** - 🚀 \[Feature\] Extend Emoticons [\#1745](https://github.com/Human-Connection/Human-Connection/issues/1745) +- 🚀 \[Feature\] Show "Edited" on comments and Posts [\#1669](https://github.com/Human-Connection/Human-Connection/issues/1669) - 🚀 \[Feature\] Change slug [\#1650](https://github.com/Human-Connection/Human-Connection/issues/1650) - 🚀 \[Feature\] Make the slug more visible and usable [\#1486](https://github.com/Human-Connection/Human-Connection/issues/1486) - 🚀 \[Feature\] Report with reason [\#1469](https://github.com/Human-Connection/Human-Connection/issues/1469) +- 🚀 \[Feature\] Update `lastActiveAt` on every JWT token check [\#1305](https://github.com/Human-Connection/Human-Connection/issues/1305) - 🚀 \[Feature\] Make Invite an Registration E-Mails translatable and pretty [\#1186](https://github.com/Human-Connection/Human-Connection/issues/1186) - 🚀 \[Feature\] @Username: Unique user identification if identical profile names exist [\#1069](https://github.com/Human-Connection/Human-Connection/issues/1069) +- 🚀 \[Feature\] UserSettings - YourData - Email [\#407](https://github.com/Human-Connection/Human-Connection/issues/407) **Merged pull requests:** +- fixes\#1305 lastActiveAt [\#1809](https://github.com/Human-Connection/Human-Connection/pull/1809) ([iylim](https://github.com/iylim)) +- Show that a Post/Comment has been edited [\#1807](https://github.com/Human-Connection/Human-Connection/pull/1807) ([mattwr18](https://github.com/mattwr18)) +- fix invites count calculation for admin dashboard [\#1806](https://github.com/Human-Connection/Human-Connection/pull/1806) ([vbelolapotkov](https://github.com/vbelolapotkov)) +- build\(deps\): bump nuxt from 2.9.2 to 2.10.0 in /webapp [\#1804](https://github.com/Human-Connection/Human-Connection/pull/1804) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) +- build\(deps\): bump cross-env from 6.0.2 to 6.0.3 in /webapp [\#1803](https://github.com/Human-Connection/Human-Connection/pull/1803) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) +- build\(deps\): bump @hapi/joi from 16.1.4 to 16.1.5 in /backend [\#1802](https://github.com/Human-Connection/Human-Connection/pull/1802) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) +- build\(deps\): bump cross-env from 6.0.2 to 6.0.3 in /backend [\#1801](https://github.com/Human-Connection/Human-Connection/pull/1801) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) +- build\(deps-dev\): bump cross-env from 6.0.2 to 6.0.3 [\#1800](https://github.com/Human-Connection/Human-Connection/pull/1800) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) +- Remove language toggle from email template [\#1798](https://github.com/Human-Connection/Human-Connection/pull/1798) ([alina-beck](https://github.com/alina-beck)) +- Max aspect ratio of 1:1 for Post index page [\#1796](https://github.com/Human-Connection/Human-Connection/pull/1796) ([mattwr18](https://github.com/mattwr18)) +- build\(deps\): bump cross-env from 6.0.0 to 6.0.2 in /backend [\#1794](https://github.com/Human-Connection/Human-Connection/pull/1794) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) +- build\(deps-dev\): bump cross-env from 6.0.0 to 6.0.2 [\#1793](https://github.com/Human-Connection/Human-Connection/pull/1793) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) +- build\(deps\): bump metascraper-description from 5.7.5 to 5.7.6 in /backend [\#1792](https://github.com/Human-Connection/Human-Connection/pull/1792) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) +- build\(deps\): bump cross-env from 6.0.0 to 6.0.2 in /webapp [\#1791](https://github.com/Human-Connection/Human-Connection/pull/1791) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) +- build\(deps\): bump @nuxtjs/apollo from 4.0.0-rc13.1 to 4.0.0-rc14 in /webapp [\#1790](https://github.com/Human-Connection/Human-Connection/pull/1790) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) +- Update Post query for blockedByUsers [\#1788](https://github.com/Human-Connection/Human-Connection/pull/1788) ([mattwr18](https://github.com/mattwr18)) +- Update neo4j to Enterprise edition [\#1787](https://github.com/Human-Connection/Human-Connection/pull/1787) ([mattwr18](https://github.com/mattwr18)) +- Update to 0.1.2 [\#1786](https://github.com/Human-Connection/Human-Connection/pull/1786) ([mattwr18](https://github.com/mattwr18)) - Bump metascraper-logo from 5.7.5 to 5.7.6 in /backend [\#1783](https://github.com/Human-Connection/Human-Connection/pull/1783) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) - Bump metascraper-url from 5.7.5 to 5.7.6 in /backend [\#1782](https://github.com/Human-Connection/Human-Connection/pull/1782) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) - Bump graphql-middleware from 3.0.5 to 4.0.1 in /backend [\#1781](https://github.com/Human-Connection/Human-Connection/pull/1781) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) @@ -77,6 +102,7 @@ - Bump date-fns from 2.2.1 to 2.3.0 in /backend [\#1714](https://github.com/Human-Connection/Human-Connection/pull/1714) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) - Bump @babel/cli from 7.6.0 to 7.6.2 in /backend [\#1713](https://github.com/Human-Connection/Human-Connection/pull/1713) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) - \[WIP\]1706 refactor shout spec [\#1712](https://github.com/Human-Connection/Human-Connection/pull/1712) ([aonomike](https://github.com/aonomike)) +- 407 change your email address [\#1711](https://github.com/Human-Connection/Human-Connection/pull/1711) ([roschaefer](https://github.com/roschaefer)) - Remove repetitive labels from emote button [\#1702](https://github.com/Human-Connection/Human-Connection/pull/1702) ([roschaefer](https://github.com/roschaefer)) - fix the bug with scrolling post comments into view [\#1701](https://github.com/Human-Connection/Human-Connection/pull/1701) ([vbelolapotkov](https://github.com/vbelolapotkov)) - Bump metascraper-description from 5.7.4 to 5.7.5 in /backend [\#1700](https://github.com/Human-Connection/Human-Connection/pull/1700) ([dependabot-preview[bot]](https://github.com/apps/dependabot-preview)) diff --git a/VERSION b/VERSION index d917d3e26..b1e80bb24 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.2 +0.1.3 diff --git a/backend/src/jwt/decode.js b/backend/src/jwt/decode.js index d022f3512..842f8f537 100644 --- a/backend/src/jwt/decode.js +++ b/backend/src/jwt/decode.js @@ -14,6 +14,7 @@ export default async (driver, authorizationHeader) => { const session = driver.session() const query = ` MATCH (user:User {id: $id, deleted: false, disabled: false }) + SET user.lastActiveAt = toString(datetime()) RETURN user {.id, .slug, .name, .avatar, .email, .role, .disabled, .actorId} LIMIT 1 ` diff --git a/backend/src/jwt/decode.spec.js b/backend/src/jwt/decode.spec.js index df6914f25..9ea858304 100644 --- a/backend/src/jwt/decode.spec.js +++ b/backend/src/jwt/decode.spec.js @@ -1,9 +1,10 @@ import Factory from '../seed/factories/index' -import { getDriver } from '../bootstrap/neo4j' +import { getDriver, neode as getNeode } from '../bootstrap/neo4j' import decode from './decode' const factory = Factory() const driver = getDriver() +const neode = getNeode() // here is the decoded JWT token: // { @@ -85,6 +86,33 @@ describe('decode', () => { }) }) + it('sets `lastActiveAt`', async () => { + let user = await neode.first('User', { id: 'u3' }) + await expect(user.toJson()).resolves.not.toHaveProperty('lastActiveAt') + await decode(driver, authorizationHeader) + user = await neode.first('User', { id: 'u3' }) + await expect(user.toJson()).resolves.toMatchObject({ + lastActiveAt: expect.any(String), + }) + }) + + it('updates `lastActiveAt` for every authenticated request', async () => { + let user = await neode.first('User', { id: 'u3' }) + await user.update({ + updatedAt: new Date().toISOString(), + lastActiveAt: '2019-10-03T23:33:08.598Z', + }) + await expect(user.toJson()).resolves.toMatchObject({ + lastActiveAt: '2019-10-03T23:33:08.598Z', + }) + await decode(driver, authorizationHeader) + user = await neode.first('User', { id: 'u3' }) + await expect(user.toJson()).resolves.toMatchObject({ + // should be a different time by now ;) + lastActiveAt: expect.not.stringContaining('2019-10-03T23:33'), + }) + }) + describe('but user is deleted', () => { beforeEach(async () => { await user.update({ updatedAt: new Date().toISOString(), deleted: true }) @@ -92,6 +120,7 @@ describe('decode', () => { it('returns null', returnsNull) }) + describe('but user is disabled', () => { beforeEach(async () => { await user.update({ updatedAt: new Date().toISOString(), disabled: true }) diff --git a/backend/src/models/User.js b/backend/src/models/User.js index 4bab080ca..6448d7450 100644 --- a/backend/src/models/User.js +++ b/backend/src/models/User.js @@ -49,6 +49,7 @@ module.exports = { direction: 'in', }, invitedBy: { type: 'relationship', relationship: 'INVITED', target: 'User', direction: 'in' }, + lastActiveAt: { type: 'string', isoDate: true }, createdAt: { type: 'string', isoDate: true, default: () => new Date().toISOString() }, updatedAt: { type: 'string', diff --git a/webapp/components/Comment/Comment.vue b/webapp/components/Comment/Comment.vue index 31bbc811f..534c45e6b 100644 --- a/webapp/components/Comment/Comment.vue +++ b/webapp/components/Comment/Comment.vue @@ -12,8 +12,13 @@