Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/lib/reaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ StreamReaction.prototype = {
qs.limit = 10;
}

if ((user_id ? 1 : 0 + activity_id ? 1 : 0 + reaction_id ? 1 : 0) != 1) {
if (
(user_id ? 1 : 0) + (activity_id ? 1 : 0) + (reaction_id ? 1 : 0) !=
1
) {
throw new errors.SiteError(
'Must provide exactly one value for one of these params: user_id, activity_id, reaction_id',
);
Expand Down
10 changes: 10 additions & 0 deletions test/integration/cloud/reaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ describe('Reaction pagination', () => {
describe('Paginate the whole thing', () => {
let resp;

ctx.test('errors with multiple lookup types', async () => {
let conditions = {
activity_id: eatActivity.id,
user_id: ctx.alice.userId,
};
expect(ctx.alice.reactions.filter)
.withArgs(conditions)
.to.throwError();
});

ctx.test('reactions should be enriched when filtering', async () => {
let conditions = {
activity_id: eatActivity.id,
Expand Down