Skip to content

[NEW] Added GET/POST channels.notifications#10128

Merged
rodrigok merged 3 commits intodevelopfrom
feature/rest-channel-notifications-settings
Mar 26, 2018
Merged

[NEW] Added GET/POST channels.notifications#10128
rodrigok merged 3 commits intodevelopfrom
feature/rest-channel-notifications-settings

Conversation

@MarcosSpessatto
Copy link
Copy Markdown
Contributor

Added two endpoints: GET/POST channels.notifications, that returns and updates the notification settings from a specific channel. Requested in this issue.

Added GET/POST channels.notifications
@rafaelks
Copy link
Copy Markdown
Contributor

@MarcosSpessatto Amazing! Do you have the docs already?

@MarcosSpessatto
Copy link
Copy Markdown
Contributor Author

@rafaelks, docs.

return RocketChat.API.v1.failure('The \'roomId\' param is required');
}

const subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(roomId, this.userId);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the fields in query, that will copy the object and remove the fields, example:

RocketChat.models.Subscriptions.findOne({}, {fields: {_room: 0, _user: 0, $loki: 0}});

};
const isInvalidNotification = !Object.keys(notifications).includes(field);
const basicValuesForNotifications = ['all', 'mentions', 'nothing', 'default'];
const fieldsMustHaveBasicValues = ['emailNotifications', 'audioNotifications', 'mobilePushNotifications'];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this missing desktopNotifications?

})
.end(done);

it('/channels.leave', async(done) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this it is inside the it('POST /channels.notifications', (done) => {?

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-10128 March 15, 2018 20:06 Inactive
}

const subscription = RocketChat.models.Subscriptions.findOneByRoomIdAndUserId(roomId, this.userId);
const subscription = RocketChat.models.Subscriptions.findOne({}, {fields: {_room: 0, _user: 0, $loki: 0}});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong find, please revert to the old one

@rodrigok rodrigok merged commit f50679d into develop Mar 26, 2018
@rodrigok rodrigok deleted the feature/rest-channel-notifications-settings branch March 26, 2018 14:08
@rodrigok rodrigok mentioned this pull request Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants