Commit e48eee72 authored by Vladimir Baranov's avatar Vladimir Baranov

rref #5392. Add all messaging API methods to service, create ui flow for new direct channel

parent 11302f66
...@@ -20,8 +20,13 @@ angular.module("ulakbus.messaging") ...@@ -20,8 +20,13 @@ angular.module("ulakbus.messaging")
$scope.directChannels = groupedChannels[MessagingService.CHANNEL_TYPE.DIRECT]; $scope.directChannels = groupedChannels[MessagingService.CHANNEL_TYPE.DIRECT];
}); });
this.startDirectChannel = function(){ this.createDirectChannel = function(user){
// user format is ['username', 'key', 'avatarUrl']
var key = user[1];
MessagingService.create_direct_channel(key)
.then(function(result){
$log.info("Channel for user ", user[0], "created: ", result);
});
}; };
$scope.hideApp = function(){ $scope.hideApp = function(){
......
...@@ -11,7 +11,7 @@ angular.module("ulakbus.messaging") ...@@ -11,7 +11,7 @@ angular.module("ulakbus.messaging")
}, },
link: function(iScope, iElem, iAttrs, messagingCtrl){ link: function(iScope, iElem, iAttrs, messagingCtrl){
iScope.selectUser = function(user){ iScope.selectUser = function(user){
messagingCtrl.startDirectChannel(user); messagingCtrl.createDirectChannel(user);
iScope.hide(); iScope.hide();
} }
}, },
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<ul class="direct-messages"> <ul class="direct-messages">
<li class="title">DIRECT MESSAGES <span class="add-action glyphicon glyphicon-plus-sign" ng-click="showSearch.user = true"></span></li> <li class="title">DIRECT MESSAGES <span class="add-action glyphicon glyphicon-plus-sign" ng-click="showSearch.user = true"></span></li>
<li class="online" ng-class="{'active':'active', 'notification': 'notification'}">Erkan Öğümsöğütlü</li> <li ng-class="{'notification': userChannel.unread}" ng-repeat="userChannel in directChannels">{{userChannel.name}}</li>
</ul> </ul>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment