Skip to content

Commit

Permalink
Refactor code to remove deprecated Meteor.callPromise method (#779)
Browse files Browse the repository at this point in the history
* Refactor code to remove deprecated Meteor.callPromise method

* docs: 📝 Add docs

* Add check functions

* style: format code with clang-format

* style: format code with prettier

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
  • Loading branch information
bubonicfred and deepsource-autofix[bot] authored May 31, 2024
1 parent 40e60a5 commit c9f3770
Show file tree
Hide file tree
Showing 16 changed files with 837 additions and 165 deletions.
25 changes: 21 additions & 4 deletions client/helpers/dateHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,40 @@ import { i18n } from "meteor/universe:i18n";

import { formatDateISO8601Time } from "../../imports/helpers/date";

Template.registerHelper("formatDateISO8601Time", (date) => {
/**
* Registers a helper function to format a date in ISO8601 time format.
* @borrows formatDateISO8601Time from imports/helpers/date.js
*/
Template.registerHelper("formatDateISO8601Time", (/** @type {Date} */ date) => {
return formatDateISO8601Time(date);
});

/**
* Registers a helper function to format the updated hint tooltip.
* @param {Date} dateCreate - The creation date of the topic.
* @param {string} userCreate - The user who created the topic.
* @param {Date} dateUpd - The update date of the topic.
* @param {string} userUpd - The user who updated the topic.
* @returns {string} The formatted tooltip string.
*/
Template.registerHelper(
"formateUpdatedHint",
(dateCreate, userCreate, dateUpd, userUpd) => {
(
/** @type {Date} */ dateCreate,
/** @type {any} */ userCreate,
/** @type {Date} */ dateUpd,
/** @type {any} */ userUpd,
) => {
const dateCreateStr = formatDateISO8601Time(dateCreate);
const dateUpdStr = formatDateISO8601Time(dateUpd);

let tooltip = `${i18n.__("Topic.TooltipCreated.date", {
const tooltip = `${i18n.__("Topic.TooltipCreated.date", {
dateCreateStr,
})} ${
userCreate ? i18n.__("Topic.TooltipCreated.user", { userCreate }) : ""
}`;
if (dateUpd && dateUpdStr > dateCreateStr) {
tooltip = `${tooltip}\n${i18n.__("Topic.TooltipUpdated.date", {
return `${tooltip}\n${i18n.__("Topic.TooltipUpdated.date", {
dateUpdStr,
})} ${userUpd ? i18n.__("Topic.TooltipUpdated.user", { userUpd }) : ""}`;
}
Expand Down
6 changes: 6 additions & 0 deletions imports/actionitem.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ import { Priority } from "./priority";
* @extends InfoItem
*/
export class ActionItem extends InfoItem {
/**
* Represents an ActionItem object.
* @constructs ActionItem
* @param {ParentTopic} parentTopic - The parent topic of the action item.
* @param {Source} source - The source of the action item.
*/
constructor(parentTopic, source) {
// constructs obj from item ID or document
super(parentTopic, source);
Expand Down
2 changes: 0 additions & 2 deletions imports/documentGeneration.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* - send meeting minutes as HTML eMails
*/

import "./helpers/promisedMethods";

import { Meteor } from "meteor/meteor";
import { FlowRouter } from "meteor/ostrio:flow-router-extra";
import { i18n } from "meteor/universe:i18n";
Expand Down
2 changes: 1 addition & 1 deletion imports/helpers/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Meteor } from "meteor/meteor";
/**
* Checks a variable against a pattern and throws a Meteor.Error if the check
* fails.
*
* @todo do we need this? is it an improvment over default check behaviour?
* @param {any} variable - The variable to check.
* @param {any} pattern - The pattern to check the variable against.
* @param {string} [message] - An optional error message to include in the
Expand Down
2 changes: 0 additions & 2 deletions imports/helpers/i18n.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import "./promisedMethods";

import { Meteor } from "meteor/meteor";
import { T9n } from "meteor/softwarerero:accounts-t9n";
import { i18n } from "meteor/universe:i18n";
Expand Down
21 changes: 0 additions & 21 deletions imports/helpers/promisedMethods.js

This file was deleted.

Loading

0 comments on commit c9f3770

Please sign in to comment.