src/js/widgets/polemicWidget.js
branchpopcorn-port
changeset 631 70e6ec9d9f65
parent 624 177dfeacc7a6
child 648 431b3495f958
--- a/src/js/widgets/polemicWidget.js	Fri Jan 13 15:46:23 2012 +0100
+++ b/src/js/widgets/polemicWidget.js	Fri Jan 13 15:46:44 2012 +0100
@@ -138,7 +138,10 @@
           var view = json.views[0];
           
           if(typeof(view.annotation_types) !== "undefined") {
-            if (view.annotation_types.length > 1) {
+            /* we need to be backward compatible with the old files which used to
+               feature only two lines : Chapitrage and Tweets. We've added a
+               "Contributions" line so we need to discriminate against that */
+            if (view.annotation_types.length === 2 && typeof(this._serializer.getContributions()) === "undefined") {
               var view_type = view.annotation_types[1];
             } else {
               console.log("PolemicWidget: invalid file - minimizing");