Skip to content

Commit

Permalink
Remove missing meta and $loki fields
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok committed Jul 6, 2018
1 parent 544c5e5 commit 6de47bc
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 18 deletions.
4 changes: 2 additions & 2 deletions packages/rocketchat-integrations/server/lib/triggerHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ RocketChat.integrations.triggerHandler = new class RocketChatIntegrationHandler
history.data = { ...data };

if (data.user) {
history.data.user = _.omit(data.user, ['meta', 'services']);
history.data.user = _.omit(data.user, ['services']);
}

if (data.room) {
history.data.room = _.omit(data.room, ['meta']);
history.data.room = data.room;
}
}

Expand Down
3 changes: 0 additions & 3 deletions packages/rocketchat-lib/client/lib/cachedCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ class CachedCollection {
Meteor.call(this.methodName, (error, data) => {
this.log(`${ data.length } records loaded from server`);
data.forEach((record) => {
delete record.$loki;
RocketChat.callbacks.run(`cachedCollection-loadFromServer-${ this.name }`, record, 'changed');
this.collection.upsert({ _id: record._id }, _.omit(record, '_id'));

Expand Down Expand Up @@ -276,7 +275,6 @@ class CachedCollection {
});

for (const record of changes) {
delete record.$loki;
RocketChat.callbacks.run(`cachedCollection-sync-${ this.name }`, record, record._deletedAt? 'removed' : 'changed');
if (record._deletedAt) {
this.collection.remove({ _id: record._id });
Expand Down Expand Up @@ -342,7 +340,6 @@ class CachedCollection {
this.collection.remove(record._id);
RoomManager.close(record.t+record.name);
} else {
delete record.$loki;
this.collection.upsert({ _id: record._id }, _.omit(record, '_id'));
}

Expand Down
1 change: 0 additions & 1 deletion packages/rocketchat-lib/client/lib/openRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ function openRoom(type, name) {
Session.set('roomNotFound', {type, name});
return BlazeLayout.render('main', {center: 'roomNotFound'});
} else {
delete record.$loki;
RocketChat.models.Rooms.upsert({ _id: record._id }, _.omit(record, '_id'));
RoomManager.close(type + name);
return openRoom(type, name);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*global OAuth2Server */
import _ from 'underscore';

const oauth2server = new OAuth2Server({
accessTokensCollectionName: 'rocketchat_oauth_access_tokens',
Expand Down Expand Up @@ -80,5 +79,5 @@ RocketChat.API.v1.addAuthMethod(function() {
if (user == null) {
return;
}
return { user: _.omit(user, '$loki') };
return { user };
});
10 changes: 0 additions & 10 deletions tests/end-to-end/api/11-permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ describe('[Permissions]', function() {
expect(firstElement).to.have.property('_id');
expect(firstElement).to.have.property('roles').and.to.be.a('array');
expect(firstElement).to.have.property('_updatedAt');
expect(firstElement).to.have.property('meta');
expect(firstElement.meta).to.have.property('revision');
expect(firstElement.meta).to.have.property('created');
expect(firstElement.meta).to.have.property('version');
expect(firstElement).to.have.property('$loki');
})
.end(done);
});
Expand All @@ -73,11 +68,6 @@ describe('[Permissions]', function() {
expect(firstElement).to.have.property('_id');
expect(firstElement).to.have.property('roles').and.to.be.a('array');
expect(firstElement).to.have.property('_updatedAt');
expect(firstElement).to.have.property('meta');
expect(firstElement.meta).to.have.property('revision');
expect(firstElement.meta).to.have.property('created');
expect(firstElement.meta).to.have.property('version');
expect(firstElement).to.have.property('$loki');
})
.end(done);
});
Expand Down

0 comments on commit 6de47bc

Please sign in to comment.