Group plans misc fixes (#8388)

* Added notification for approval request in the group leaders language

* Added test for group task meta actions. Added sync when user claims

* Added tests for group task actions. Ensured assigned members are synce when added or removed

* Fixed approval required toggle

* Added support for users with comma in their name

* Fixed sync issue when user is approved and reloads the website

* Added advance options for group rewards

* Added back ticks to group claim message

* Fixed disappearing tasks that need approval

* Up chat limit to 400 for subbed groups

* Fixed line endings

* Updated activie subscription check

* Added group isSubscribed function

* Changed to isAfter
This commit is contained in:
Keith Holliday
2017-01-18 07:54:49 -07:00
committed by GitHub
parent e4bb82768c
commit 28fec237fe
16 changed files with 169 additions and 10 deletions

View File

@@ -37,6 +37,7 @@
allowedTags: allowedTags,
allowDuplicates: false,
preserveCase: true,
delimeter: '|',
placeholder: window.env.t('assignFieldPlaceholder'),
onBeforeTagAdd: function(event, tag) {
return confirm(window.env.t('confirmAddTag', {tag: tag}));

View File

@@ -3,16 +3,30 @@ habitrpg.controller('GroupTaskActionsCtrl', ['$scope', 'Shared', 'Tasks', 'User'
$scope.assignedMembers = [];
$scope.user = User.user;
// We must use a separate field here, because task.group is private. So, instead, we send this tmp field to alter the approval.
$scope.task._edit.requiresApproval = false;
if ($scope.task.group.approval.required) {
$scope.task._edit.requiresApproval = $scope.task.group.approval.required;
}
$scope.toggleTaskRequiresApproval = function () {
$scope.task._edit.group.approval.required = !$scope.task._edit.group.approval.required;
$scope.task._edit.requiresApproval = $scope.task._edit.group.approval.required;
}
$scope.$on('addedGroupMember', function(evt, userId) {
$scope.task.group.assignedUsers.push(userId);
if ($scope.task._edit) $scope.task._edit.group.assignedUsers.push(userId);
Tasks.assignTask($scope.task.id, userId);
});
$scope.$on('removedGroupMember', function(evt, userId) {
var index = $scope.task.group.assignedUsers.indexOf(userId);
$scope.task.group.assignedUsers.splice(index, 1);
if ($scope.task._edit) {
var index = $scope.task._edit.group.assignedUsers.indexOf(userId);
$scope.task._edit.group.assignedUsers.splice(index, 1);
}
Tasks.unAssignTask($scope.task.id, userId);
});
}]);

View File

@@ -7,6 +7,7 @@ habitrpg.controller('GroupTaskMetaActionsCtrl', ['$scope', 'Shared', 'Tasks', 'U
if (!confirm("Are you sure you want to claim this task?")) return;
Tasks.assignTask($scope.task.id, $scope.user._id);
$scope.task.group.assignedUsers.push($scope.user._id);
User.sync();
};
$scope.userIsAssigned = function () {

View File

@@ -177,7 +177,7 @@ habitrpg.controller('GroupTasksCtrl', ['$scope', 'Shared', 'Tasks', 'User', func
var claimingUsers = [];
task.group.assignedUsers.forEach(function (userId) {
claimingUsers.push(memberIdToProfileNameMap[userId]);
claimingUsers.push('"' + memberIdToProfileNameMap[userId] + '"');
})
if (claimingUsers.length > 0) content += window.env.t('claimedBy', {claimingUsers: claimingUsers.join(', ')});

View File

@@ -171,6 +171,7 @@ habitrpg.controller('NotificationCtrl',
if (scoreTaskNotification) {
Notification.markdown(scoreTaskNotification.data.message);
User.score({params:{task: scoreTaskNotification.data.scoreTask, direction: "up"}});
User.sync();
}
});
}

View File

@@ -109,6 +109,8 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
} else {
$scope.score(task, "down");
}
if (task.group && task.group.approval && task.group.approval.required && !task.group.approval.approved) task.completed = false;
};
$scope.saveTask = function(task, stayOpen, isSaveAndClose) {