mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Prevented modal close and showed correct due class in modal
This commit is contained in:
@@ -42,10 +42,12 @@ habitrpg.controller('NotificationCtrl',
|
||||
showCompleted: false,
|
||||
type: 'daily',
|
||||
};
|
||||
modalScope.processingYesterdailies = true;
|
||||
|
||||
$scope.yesterDailiesModalOpen = true;
|
||||
$rootScope.openModal('yesterDailies', {
|
||||
scope: modalScope,
|
||||
backdrop: 'static',
|
||||
controller: ['$scope', 'Tasks', 'User', '$rootScope', function ($scope, Tasks, User, $rootScope) {
|
||||
$rootScope.$on('task:scored', function (event, data) {
|
||||
var task = data.task;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
scope: true,
|
||||
link: function($scope, element, attrs) {
|
||||
$scope.getClasses = function (task, user, list, main) {
|
||||
return Shared.taskClasses(task, user.filters, user.preferences.dayStart, user.lastCron, list.showCompleted, main);
|
||||
return Shared.taskClasses(task, user.filters, user.preferences.dayStart, user.lastCron, list.showCompleted, main, $scope.processingYesterdailies);
|
||||
}
|
||||
|
||||
$scope.showNoteDetails = function (task) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
shouldDo,
|
||||
} from '../cron';
|
||||
import moment from 'moment';
|
||||
|
||||
/*
|
||||
Task classes given everything about the class
|
||||
@@ -8,7 +9,7 @@ Task classes given everything about the class
|
||||
|
||||
// TODO move to the client
|
||||
|
||||
module.exports = function taskClasses (task, filters = [], dayStart = 0, lastCron = Number(new Date()), showCompleted = false, main = false) {
|
||||
module.exports = function taskClasses (task, filters = [], dayStart = 0, lastCron = Number(new Date()), showCompleted = false, main = false, processingYesterdailies = false) {
|
||||
if (!task) {
|
||||
return '';
|
||||
}
|
||||
@@ -34,7 +35,9 @@ module.exports = function taskClasses (task, filters = [], dayStart = 0, lastCro
|
||||
}
|
||||
|
||||
if (type === 'todo' || type === 'daily') {
|
||||
let notDue = !shouldDo(Number(new Date()), task, { dayStart });
|
||||
let dayShouldDo = moment();
|
||||
if (processingYesterdailies) dayShouldDo.subtract(1, 'days');
|
||||
let notDue = !shouldDo(Number(dayShouldDo), task, { dayStart });
|
||||
let isNotDueDaily = type === 'daily' && notDue;
|
||||
|
||||
if (completed || isNotDueDaily) {
|
||||
|
||||
Reference in New Issue
Block a user