Merge pull request #6093 from overleaf/jpa-last-user-activity

[web] add a last active date for denoting account activity in groups mgt

GitOrigin-RevId: 32a9e5c1e8f63e794bf6d379685b6dda7e6d4d22
This commit is contained in:
Timothée Alby
2021-12-14 14:26:16 +01:00
committed by Copybot
parent e8029e6743
commit 0da151a99f
9 changed files with 47 additions and 10 deletions
@@ -58,7 +58,7 @@ describe('ProjectController', function () {
this.LimitationsManager = { hasPaidSubscription: sinon.stub() }
this.TagsHandler = { getAllTags: sinon.stub() }
this.NotificationsHandler = { getUserNotifications: sinon.stub() }
this.UserModel = { findById: sinon.stub() }
this.UserModel = { findById: sinon.stub(), updateOne: sinon.stub() }
this.AuthorizationManager = {
getPrivilegeLevelForProject: sinon.stub(),
isRestrictedUser: sinon.stub().returns(false),
@@ -939,7 +939,7 @@ describe('ProjectController', function () {
brandVariationId: '12',
}
this.user = {
_id: '588f3ddae8ebc1bac07c9fa4',
_id: this.user._id,
ace: {
fontSize: 'massive',
theme: 'sexy',
@@ -1048,6 +1048,18 @@ describe('ProjectController', function () {
this.ProjectController.loadEditor(this.req, this.res)
})
it('should mark user as active', function (done) {
this.res.render = (pageName, opts) => {
expect(this.UserModel.updateOne).to.have.been.calledOnce
expect(this.UserModel.updateOne.args[0][0]).to.deep.equal({
_id: ObjectId(this.user._id),
})
expect(this.UserModel.updateOne.args[0][1].$set.lastActive).to.exist
done()
}
this.ProjectController.loadEditor(this.req, this.res)
})
it('should mark project as opened', function (done) {
this.res.render = (pageName, opts) => {
this.ProjectUpdateHandler.markAsOpened