diff --git a/moped-database/metadata/tables.yaml b/moped-database/metadata/tables.yaml index a4e99a2fba..d54e223f3f 100644 --- a/moped-database/metadata/tables.yaml +++ b/moped-database/metadata/tables.yaml @@ -2032,7 +2032,20 @@ insert: columns: '*' update: - columns: '*' + columns: + - interim_project_component_id + - project_component_id + - location_description + - component_id + - is_deleted + - phase_id + - completion_date + - project_id + - created_at + - subphase_id + - created_by_user_id + - description + - srts_id retry_conf: interval_sec: 10 num_retries: 0 diff --git a/moped-editor/src/utils/activityLogFormatters/mopedComponentsActivity.js b/moped-editor/src/utils/activityLogFormatters/mopedComponentsActivity.js index c7cd219ab7..9055980dba 100644 --- a/moped-editor/src/utils/activityLogFormatters/mopedComponentsActivity.js +++ b/moped-editor/src/utils/activityLogFormatters/mopedComponentsActivity.js @@ -1,6 +1,14 @@ import RoomOutlinedIcon from "@mui/icons-material/RoomOutlined"; import { ProjectActivityLogTableMaps } from "../../views/projects/projectView/ProjectActivityLogTableMaps"; +/** Fields which do not need to be rendered in the activity log */ +const CHANGE_FIELDS_TO_IGNORE = [ + "updated_by_user_id", + "created_by_user_id", + "created_at", + "updated_at", +]; + export const formatComponentsActivity = ( change, componentList, @@ -113,10 +121,18 @@ export const formatComponentsActivity = ( // loop through fields to check for differences, push label onto changes Array Object.keys(newRecord).forEach((field) => { if (newRecord[field] !== oldRecord[field]) { + if (CHANGE_FIELDS_TO_IGNORE.includes(field)) { + return; + } changes.push(entryMap.fields[field]?.label); } }); + // handle an edge case where only ignored fields were edited + if (changes.length === 0) { + return { changeIcon: null, changeText: null }; + } + return { changeIcon, changeText: [ diff --git a/moped-editor/src/views/projects/projectView/ProjectActivityLog.js b/moped-editor/src/views/projects/projectView/ProjectActivityLog.js index d460d36317..610e1434e5 100644 --- a/moped-editor/src/views/projects/projectView/ProjectActivityLog.js +++ b/moped-editor/src/views/projects/projectView/ProjectActivityLog.js @@ -230,6 +230,11 @@ const ProjectActivityLog = () => { lookupData, projectId ); + // allows log formatters to return a `null` changeText, causing the + // event to not be rendered at all + if (!changeText) { + return null; + } return (