// Written by Joshua Paul A. Chan
(function() {
"use strict";

// `convo`
// Controls the convo-list (conversation list pane), allowing for display of the
// conversations and bulk/singular book-keeping operations upon conversations.
//
angular.module('wr.controllers')
.controller('convo', function($scope, $state, $convoService) {
    var $ctrl = this;

    ////////////////////////// LOADING A CONVERATION //////////////////////////

    var loadConversation = function(id) {
        $convoService
            .loadConvo(id)
            .then(
                (conversation) => {
                    $ctrl.convo = conversation;
                    $scope.$apply();
                },
                (err) => {
                    console.error("[conversation]", err);
                    // FIXME: uncomment when notification service is implemented
                    // $notificationService.notify({
                    //     type: "error",
                    //     text: `There was an error loading conversation ${id} from the server.`
                    // });
                });
    };

    // Load conversation when initialized
    loadConversation($state.params.convoId);
});
}());

@@ -430,16 +430,494 @@
 //////%0A%0A
+    // %60loadConversation(pg)%60%0A    // Load the conversation from the server using the conversation service.%0A    //%0A    // @pre     : the conversation service must be initialized%0A    // @post    : %5Bsuccess%5D the conversation will be loaded into the view%0A    // @post    : %5Berror%5D if error, error will be sent to error service to%0A    // display on page and log for analytics%0A    //%0A    // @param   : id    : Number    : the id of the conversation to retrieve%0A    // @return  : null%0A
     var 
@@ -946,24 +946,24 @@
 ction(id) %7B%0A
-
         $con
@@ -1121,16 +1121,19 @@
         
+ //
  $scope.
@@ -1543,24 +1543,24 @@
      // %7D);%0A
-
             
@@ -1575,16 +1575,154 @@
     %7D;%0A%0A
+    ///////////////////////////////// REPLYING /////////////////////////////////%0A%0A    //%0A    $scope.replyDisabled = function() %7B%0A%0A    %7D;%0A%0A
     // L

Add stub for loadConversation