Skip to content

Commit

Permalink
Revert "refactor(lodash): convert lodash to native js"
Browse files Browse the repository at this point in the history
This reverts commit fe2bdf6.
  • Loading branch information
bubonicfred committed Jul 9, 2024
1 parent 38947c2 commit 9e48e39
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions imports/topic.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
* system. It provides methods for resolving parent elements, resolving topics,
* finding topic index in an array, checking if a topic has open action items,
* and more.
* @module Topic
*/

import "./collections/minutes_private";

import { subElementsHelper } from "./helpers/subElements";
import { subElementsHelper } from "/imports/helpers/subElements";
import { _ } from "lodash";
import { Meteor } from "meteor/meteor";
import { Random } from "meteor/random";

import { InfoItem } from "./infoitem";
import { InfoItemFactory } from "./InfoItemFactory";
import { MeetingSeries } from "./meetingseries";
Expand Down Expand Up @@ -67,19 +70,20 @@ function resolveTopic(parentElement, source) {
}
}

Object.assign({
_.defaults(source, {
isOpen: true,
isNew: true,
isRecurring: false,
labels: [],
isSkipped: false,
}, source);
});

return source;
}

/**
* Represents a topic in a meeting or minute.
* @class
*/
export class Topic {
/**
Expand Down Expand Up @@ -111,6 +115,7 @@ export class Topic {
}
}

// ################### static methods
/**
* Finds the index of a topic in an array based on its ID.
*
Expand Down Expand Up @@ -141,6 +146,7 @@ export class Topic {
return false;
}

// ################### object methods

/**
* Returns a string representation of the Topic object.
Expand Down Expand Up @@ -172,13 +178,12 @@ export class Topic {
}

/**
* Checks if the topic is finally completed (will not show up in future minutes).
* A topic is considered finally completed if:
* - The document is not open
* - There are no open action items
* - The topic is not recurring
*
* @returns {boolean} True if the topic is finally completed, false otherwise.
* A topic is finally completed (and will not show up in future minutes) if it
* is
* - not checked as dicussed and
* - has no more open AIs and
* - is not marked as recurring
* @returns {boolean}
*/
isFinallyCompleted() {
return (
Expand Down Expand Up @@ -311,7 +316,9 @@ export class Topic {
}

/**
* Filters the infoItems in the topic document based on a condition.
* Removes all fire-and-forget elements as well
* as closed AIs from this topic (info items which are
* no action items)
*/
tailorTopic() {
this._topicDoc.infoItems = this._topicDoc.infoItems.filter(
Expand Down Expand Up @@ -366,6 +373,11 @@ export class Topic {
});
}

/**
* Returns an array of open action items from the topic document.
*
* @returns {Array} An array of open action items.
*/
/**
* Returns an array of open action items from the topic document.
*
Expand Down

0 comments on commit 9e48e39

Please sign in to comment.