Skip to content

Commit

Permalink
fix: dont show hidden cases without -hidden arg (#477)
Browse files Browse the repository at this point in the history
* fix: dont show hidden cases without -hidden arg

* fix: almeida has eagle eyes
  • Loading branch information
rubyowo authored Jun 2, 2024
1 parent 21e2e58 commit 4fa77d5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/src/plugins/ModActions/commands/CasesUserCmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,24 +102,24 @@ export const CasesUserCmd = modActionsCmd({
// Compact view (= regular message with a preview of each case)
const casesPlugin = pluginData.getPlugin(CasesPlugin);

const totalPages = Math.max(Math.ceil(cases.length / casesPerPage), 1);
const totalPages = Math.max(Math.ceil(casesToDisplay.length / casesPerPage), 1);
const prefix = getGuildPrefix(pluginData);

createPaginatedMessage(
pluginData.client,
msg.channel,
totalPages,
async (page) => {
const chunkedCases = chunkArray(cases, casesPerPage)[page - 1];
const chunkedCases = chunkArray(casesToDisplay, casesPerPage)[page - 1];
const lines = await asyncMap(chunkedCases, (c) => casesPlugin.getCaseSummary(c, true, msg.author.id));

const isLastPage = page === totalPages;
const firstCaseNum = (page - 1) * casesPerPage + 1;
const lastCaseNum = isLastPage ? cases.length : page * casesPerPage;
const lastCaseNum = isLastPage ? casesToDisplay.length : page * casesPerPage;
const title =
totalPages === 1
? `Cases for ${userName} (${lines.length} total)`
: `Most recent cases ${firstCaseNum}-${lastCaseNum} of ${cases.length} for ${userName}`;
: `Most recent cases ${firstCaseNum}-${lastCaseNum} of ${casesToDisplay.length} for ${userName}`;

const embed = {
author: {
Expand Down

0 comments on commit 4fa77d5

Please sign in to comment.