Skip to content

Commit

Permalink
v5.53.0 take 2 (#1814)
Browse files Browse the repository at this point in the history
* fix: add user null check

* refactor(effects): refactor the new sequential queue type into the auto type
  • Loading branch information
ebiggz committed Jul 12, 2022
1 parent aef6593 commit b474898
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 28 deletions.
2 changes: 1 addition & 1 deletion backend/chat/chat-listeners/active-user-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ exports.addActiveUser = async (chatUser, includeInOnline = false, forceActive =
...(chatUser.isVip ? ['vip'] : [])
],
profilePicUrl: (await chatHelpers.getUserProfilePicUrl(chatUser.userId)),
disableViewerList: !!user.disableViewerList
disableViewerList: !!user?.disableViewerList
};

if (user == null) {
Expand Down
19 changes: 5 additions & 14 deletions backend/effects/queues/effect-queue-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ class EffectQueue {
}, this.interval * 1000);
} else if (this.mode === "auto") {
effectRunner.runEffects(runEffectsContext)
.then(() => {
resolve(this.runQueue());
})
.catch(err => {
logger.warn(`Error while processing effects for queue ${this.id}`, err);
resolve(this.runQueue());
})
.finally(() => {
setTimeout(() => {
resolve(this.runQueue());
}, (this.interval || 0) * 1000);
});
} else if (this.mode === "custom") {
effectRunner.runEffects(runEffectsContext)
Expand All @@ -66,16 +67,6 @@ class EffectQueue {
setTimeout(() => {
resolve(this.runQueue());
}, (duration || 0) * 1000);
} else if (this.mode === "sequential") {
effectRunner.runEffects(runEffectsContext)
.catch(err => {
logger.warn(`Error while processing effects for queue ${this.id}`, err);
})
.finally(() => {
setTimeout(() => {
resolve(this.runQueue());
}, (this.interval || 0) * 1000);
});
} else {
resolve();
}
Expand Down
4 changes: 2 additions & 2 deletions gui/app/controllers/effect-queues.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
}
},
{
name: "INTERVAL",
name: "INTERVAL/DELAY",
icon: "fa-clock",
cellTemplate: `{{(data.mode === 'interval' || data.mode === 'sequential') ? data.interval + 's' : 'n/a'}}`,
cellTemplate: `{{(data.mode === 'interval' || data.mode === 'auto') ? (data.interval || 0) + 's' : 'n/a'}}`,
cellController: () => {}
}
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
</div>
</div>
<div class="mt-6" ng-show="$ctrl.effectQueue.mode != null && ($ctrl.effectQueue.mode ==='interval' || $ctrl.effectQueue.mode ==='sequential')">
<div class="modal-subheader pb-2 pt-0 px-0">Interval (secs)</div>
<div class="mt-6" ng-show="$ctrl.effectQueue.mode != null && ($ctrl.effectQueue.mode ==='interval' || $ctrl.effectQueue.mode ==='auto')">
<div class="modal-subheader pb-2 pt-0 px-0">Interval/Delay (secs)</div>
<div style="width: 100%; position: relative;">
<div class="form-group">
<input type="number" class="form-control" ng-model="$ctrl.effectQueue.interval" placeholder="Enter interval">
Expand Down
12 changes: 3 additions & 9 deletions gui/app/services/effect-queues.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,15 @@
},
{
id: "auto",
display: "Delay",
description: "Requires a 'Delay Effect' to be present to have any effect.",
iconClass: "fa-hourglass-half"
display: "Sequential",
description: "Runs effect list in the queue sequentially. Priority items will be added before non-priority. Optional delay defaults to 0s.",
iconClass: "fa-arrow-down-1-9"
},
{
id: "interval",
display: "Interval",
description: "Runs effect lists on a set interval.",
iconClass: "fa-stopwatch"
},
{
id: "sequential",
display: "Sequential",
description: "Runs effects in the list sequentially. Priority items will be added before non-priority. Optional delay defaults to 0s.",
iconClass: "fa-arrow-down-1-9"
}
];

Expand Down

0 comments on commit b474898

Please sign in to comment.