Mercurial > bugzilla-dashboard
comparison js/modules/app.js @ 90:d48599d7a9ae
Fixed a bug where users going from unauthenticated -> authenticated wouldn't see their private bugs unless they hit 'refresh'
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Mon, 26 Apr 2010 18:16:56 -0700 |
parents | ee0a4597c067 |
children | e88fd29eee3a |
comparison
equal
deleted
inserted
replaced
89:ee0a4597c067 | 90:d48599d7a9ae |
---|---|
79 message.fadeIn(); | 79 message.fadeIn(); |
80 }; | 80 }; |
81 }; | 81 }; |
82 | 82 |
83 Require.modules["app/bugzilla-auth"] = function(exports, require) { | 83 Require.modules["app/bugzilla-auth"] = function(exports, require) { |
84 function onLoad(event) { | |
85 var xhr = event.target; | |
86 console.log("load", xhr); | |
87 } | |
88 | |
89 function onError(event) { | 84 function onError(event) { |
90 var xhr = event.target; | 85 var xhr = event.target; |
91 require("errors").log("bugzilla-api-error"); | 86 require("errors").log("bugzilla-api-error"); |
92 } | 87 } |
93 | 88 |
103 options.data.password = user.password; | 98 options.data.password = user.password; |
104 } | 99 } |
105 | 100 |
106 var xhr = Bugzilla.ajax.call(this, options); | 101 var xhr = Bugzilla.ajax.call(this, options); |
107 | 102 |
108 xhr.addEventListener("load", onLoad, false); | |
109 xhr.addEventListener("error", onError, false); | 103 xhr.addEventListener("error", onError, false); |
110 | 104 |
111 return xhr; | 105 return xhr; |
112 }; | 106 }; |
113 } | 107 } |
620 | 614 |
621 var defaults = { | 615 var defaults = { |
622 changed_after: timeAgo(MS_PER_WEEK * 14) | 616 changed_after: timeAgo(MS_PER_WEEK * 14) |
623 }; | 617 }; |
624 | 618 |
625 function update(myUsername, forceUpdate) { | 619 function update(myUsername, isAuthenticated, forceUpdate) { |
626 xhrQueue.clear(); | 620 xhrQueue.clear(); |
627 | 621 |
628 report("#code-reviews", myUsername, forceUpdate, | 622 var key = myUsername + "_" + (isAuthenticated ? "PRIVATE" : "PUBLIC"); |
623 | |
624 report("#code-reviews", key, forceUpdate, | |
629 {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], | 625 {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], |
630 flag_DOT_requestee: myUsername}); | 626 flag_DOT_requestee: myUsername}); |
631 | 627 |
632 report("#assigned-bugs", myUsername, forceUpdate, | 628 report("#assigned-bugs", key, forceUpdate, |
633 {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], | 629 {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], |
634 email1: myUsername, | 630 email1: myUsername, |
635 email1_type: "equals", | 631 email1_type: "equals", |
636 email1_assigned_to: 1}); | 632 email1_assigned_to: 1}); |
637 | 633 |
638 report("#reported-bugs", myUsername, forceUpdate, | 634 report("#reported-bugs", key, forceUpdate, |
639 {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], | 635 {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], |
640 email1: myUsername, | 636 email1: myUsername, |
641 email1_type: "equals", | 637 email1_type: "equals", |
642 email1_reporter: 1, | 638 email1_reporter: 1, |
643 email2: myUsername, | 639 email2: myUsername, |
644 email2_type: "not_equals", | 640 email2_type: "not_equals", |
645 email2_assigned_to: 1}); | 641 email2_assigned_to: 1}); |
646 | 642 |
647 report("#cc-bugs", myUsername, forceUpdate, | 643 report("#cc-bugs", key, forceUpdate, |
648 {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], | 644 {status: ["NEW", "UNCONFIRMED", "ASSIGNED", "REOPENED"], |
649 email1: myUsername, | 645 email1: myUsername, |
650 email1_type: "equals", | 646 email1_type: "equals", |
651 email1_cc: 1, | 647 email1_cc: 1, |
652 email2: myUsername, | 648 email2: myUsername, |
653 email2_type: "not_equals", | 649 email2_type: "not_equals", |
654 email2_assigned_to: 1, | 650 email2_assigned_to: 1, |
655 email2_reporter: 1}); | 651 email2_reporter: 1}); |
656 | 652 |
657 report("#fixed-bugs", myUsername, forceUpdate, | 653 report("#fixed-bugs", key, forceUpdate, |
658 {resolution: ["FIXED"], | 654 {resolution: ["FIXED"], |
659 changed_after: timeAgo(MS_PER_WEEK), | 655 changed_after: timeAgo(MS_PER_WEEK), |
660 email1: myUsername, | 656 email1: myUsername, |
661 email1_type: "equals", | 657 email1_type: "equals", |
662 email1_assigned_to: 1, | 658 email1_assigned_to: 1, |
667 var refreshCommand = { | 663 var refreshCommand = { |
668 name: "refresh-dashboard", | 664 name: "refresh-dashboard", |
669 execute: function execute() { | 665 execute: function execute() { |
670 var user = require("app/login").get(); | 666 var user = require("app/login").get(); |
671 if (user.isLoggedIn) | 667 if (user.isLoggedIn) |
672 update(user.username, true); | 668 update(user.username, user.isAuthenticated, true); |
673 } | 669 } |
674 }; | 670 }; |
675 | 671 |
676 exports.init = function init() { | 672 exports.init = function init() { |
677 require("app/commands").register(refreshCommand); | 673 require("app/commands").register(refreshCommand); |
678 require("app/login").whenChanged( | 674 require("app/login").whenChanged( |
679 function changeSearchCriteria(user) { | 675 function changeSearchCriteria(user) { |
680 if (user.isLoggedIn) { | 676 if (user.isLoggedIn) { |
681 update(user.username, false); | 677 update(user.username, user.isAuthenticated, false); |
682 } | 678 } |
683 }); | 679 }); |
684 }; | 680 }; |
685 }; | 681 }; |