Skip to content

Commit

Permalink
revert alert unsubscribe active session constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
florpor committed Jun 20, 2021
1 parent 05ca721 commit ecc56e7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
7 changes: 0 additions & 7 deletions server/api/controller/alert.js
Expand Up @@ -41,13 +41,6 @@ class AlertController extends Controller {
// return successfully even if alert was not found since
// it is probably already unsubscribed
return null;
} else if (fetchedModel.get('person_id') !== req.session.person.id) {
Log.warn(
'unauthorized alert unsubscribe attempt:',
fetchedModel.get('id'),
req.session.person.id
);
return null;
}

Log.debug(
Expand Down
20 changes: 0 additions & 20 deletions server/tests/integration/controller/alert.test.js
Expand Up @@ -15,12 +15,6 @@ describe('Alert controller', function() {
status: 1,
id: 1
};
const person2 = {
email: 'test2@meirim.org',
password: 'xxxx',
status: 1,
id: 2
};

beforeEach(async function() {
await mockDatabase.createTables(tables);
Expand Down Expand Up @@ -70,20 +64,6 @@ describe('Alert controller', function() {
assert.isOk(alert);
assert.isOk(alert.unsubsribeToken());

// try to unsubscribe alert using a user who doesn't own the alert
const failedReq = {
params: {
token: alert.unsubsribeToken()
},
session: {
person: person2
}
};

// request should fail and return null
const failedRes = await alertController.unsubscribe(failedReq);
assert.isNull(failedRes);

// try to unsubscribe alert using the owning user
const successReq = {
params: {
Expand Down

0 comments on commit ecc56e7

Please sign in to comment.