mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
return whole group.chat after chat message is sent
This commit is contained in:
@@ -87,7 +87,7 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
|
|||||||
if (_.isEmpty(message) || $scope._sending) return;
|
if (_.isEmpty(message) || $scope._sending) return;
|
||||||
$scope._sending = true;
|
$scope._sending = true;
|
||||||
Groups.Group.postChat({gid: group._id, message:message}, undefined, function(data){
|
Groups.Group.postChat({gid: group._id, message:message}, undefined, function(data){
|
||||||
group.chat.unshift(data.message);
|
group.chat = data.chat;
|
||||||
$scope._chatMessage = '';
|
$scope._chatMessage = '';
|
||||||
$scope._sending = false;
|
$scope._sending = false;
|
||||||
}, function(err){
|
}, function(err){
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ api.postChat = function(req, res, next) {
|
|||||||
group.save(function(err, saved){
|
group.save(function(err, saved){
|
||||||
if (err) return res.json(500, {err:err});
|
if (err) return res.json(500, {err:err});
|
||||||
|
|
||||||
res.json({message: saved.chat[0]});
|
res.json({chat: saved.chat});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user