mysociety / popit

DEPRECATED - Development on PopIt has stopped and it is no longer being maintained
https://goo.gl/Vvej4Q
Other
76 stars 33 forks source link

Render errors when empty values accidentally submitted #709

Open kaerumy opened 9 years ago

kaerumy commented 9 years ago

org: https://sinar-malaysia.popit.mysociety.org/organizations/549211f833aed1a20f97d7fb person: https://sinar-malaysia.popit.mysociety.org/persons/545e459c5222837c2c058f9d#sources

500 Error: Error rendering 'organization/view.html': TypeError: Cannot set property 'id' of undefined
   at Template.render (/data/vhost/popit.mysociety.org/popit/node_modules/underscore-template-additions/index.js:106:11)
   at /data/vhost/popit.mysociety.org/popit/node_modules/underscore-template-additions/index.js:174:26
   at Template.loadFromDir (/data/vhost/popit.mysociety.org/popit/node_modules/underscore-template-additions/index.js:27:12)
   at View.engine (/data/vhost/popit.mysociety.org/popit/node_modules/underscore-template-additions/index.js:168:10)
   at View.render (/data/vhost/popit.mysociety.org/popit/node_modules/express/lib/view.js:76:8)
   at Function.app.render (/data/vhost/popit.mysociety.org/popit/node_modules/express/lib/application.js:523:10)
   at ServerResponse.res.render (/data/vhost/popit.mysociety.org/popit/node_modules/express/lib/response.js:828:7)
   at /data/vhost/popit.mysociety.org/popit/lib/apps/organization.js:49:9
   at callbacks (/data/vhost/popit.mysociety.org/popit/node_modules/express/lib/router/index.js:164:37)
   at param (/data/vhost/popit.mysociety.org/popit/node_modules/express/lib/router/index.js:138:11)
   at Template.render (/data/vhost/popit.mysociety.org/popit/node_modules/underscore-template-additions/index.js:106:11)
   at /data/vhost/popit.mysociety.org/popit/node_modules/underscore-template-additions/index.js:174:26
   at Template.loadFromDir (/data/vhost/popit.mysociety.org/popit/node_modules/underscore-template-additions/index.js:27:12)
   at View.engine (/data/vhost/popit.mysociety.org/popit/node_modules/underscore-template-additions/index.js:168:10)
   at View.render (/data/vhost/popit.mysociety.org/popit/node_modules/express/lib/view.js:76:8)
   at Function.app.render (/data/vhost/popit.mysociety.org/popit/node_modules/express/lib/application.js:523:10)
   at ServerResponse.res.render (/data/vhost/popit.mysociety.org/popit/node_modules/express/lib/response.js:828:7)
   at /data/vhost/popit.mysociety.org/popit/lib/apps/organization.js:49:9
   at callbacks (/data/vhost/popit.mysociety.org/popit/node_modules/express/lib/router/index.js:164:37)
   at param (/data/vhost/popit.mysociety.org/popit/node_modules/express/lib/router/index.js:138:11)
struan commented 9 years ago

Hi @kaerumy,

out of interest, did you mange to submit this value using the API or the web site?

kaerumy commented 9 years ago

Web UI. Steps to reproduce. Edit organization or people add empty field for source or membership and save.

struan commented 9 years ago

Ah, so that's two bugs then :/

struan commented 9 years ago

@kaerumy the above fix should stop any more data like this getting in. Preventing the error when this data exists is proving a bit harder. If there aren't too many of them it may be quicker in the short term for you to update the problem records over the API to remove the nulls.

kaerumy commented 9 years ago

I think there is only 2 or 3. I'll use API to fill it up.

On Fri, 19 Dec 2014 18:31 Struan Donald notifications@github.com wrote:

@kaerumy https://github.com/kaerumy the above fix should stop any more data like this getting in. Preventing the error when this data exists is proving a bit harder. If there aren't too many of them it may be quicker in the short term for you to update the problem records over the API to remove the nulls.

— Reply to this email directly or view it on GitHub https://github.com/mysociety/popit/issues/709#issuecomment-67622007.