From 59fd9fc63f87e927d90acf7a8121e1115e558343 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 21 Jan 2025 10:36:45 +0100 Subject: [PATCH 1/3] Add a line in the documentation about the role of prettier within eslint configuration --- docs/source/development/es-lint.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source/development/es-lint.rst b/docs/source/development/es-lint.rst index f9ca9f042..f8504e082 100644 --- a/docs/source/development/es-lint.rst +++ b/docs/source/development/es-lint.rst @@ -12,6 +12,8 @@ This runs eslint **not** taking the baseline into account, thus showing all exis A script was also added to package.json allowing you to execute ``yarn run eslint``. This will run eslint, but **taking the baseline into account**, thus only alerting to newly created errors. +The eslint command is configured to also run ``prettier`` which will simply format the code to look more uniform (takes care indentation for example). + Interesting options that can be used in combination with eslint are: - ``--quiet`` to only get errors and silence the warnings From 2755bc12c43f6a3467fc096a74c92958baeea42d Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 22 Jan 2025 15:41:25 +0100 Subject: [PATCH 2/3] Add current user to suggested users when creating activity --- .../Resources/public/vuejs/Activity/store.js | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/store.js b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/store.js index 7eb583aaf..26edac646 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/store.js +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/store.js @@ -2,6 +2,7 @@ import "es6-promise/auto"; import { createStore } from "vuex"; import { postLocation } from "./api"; import prepareLocations from "./store.locations.js"; +import { makeFetch } from "ChillMainAssets/lib/api/apiMethods"; const debug = process.env.NODE_ENV !== "production"; //console.log('window.activity', window.activity); @@ -23,6 +24,7 @@ const removeIdFromValue = (string, id) => { const store = createStore({ strict: debug, state: { + me: null, activity: window.activity, socialIssuesOther: [], socialActionsList: [], @@ -79,15 +81,25 @@ const store = createStore({ ); }, suggestedUser(state) { + // console.log('current user', state.me) const existingUserIds = state.activity.users.map((p) => p.id); - return state.activity.activityType.usersVisible === 0 - ? [] - : [state.activity.accompanyingPeriod.user].filter( - (u) => u !== null && !existingUserIds.includes(u.id), - ); + let suggestedUsers = + state.activity.activityType.usersVisible === 0 + ? [] + : [state.activity.accompanyingPeriod.user].filter( + (u) => u !== null && !existingUserIds.includes(u.id), + ); + + // Add the current user from the state + if (state.me && !existingUserIds.includes(state.me.id)) { + suggestedUsers.push(state.me); + } + console.log("suggested users", suggestedUsers); + + return suggestedUsers; }, suggestedResources(state) { - const resources = state.activity.accompanyingPeriod.resources; + // const resources = state.activity.accompanyingPeriod.resources; const existingPersonIds = state.activity.persons.map((p) => p.id); const existingThirdPartyIds = state.activity.thirdParties.map( (p) => p.id, @@ -111,6 +123,9 @@ const store = createStore({ }, }, mutations: { + setWhoAmI(state, me) { + state.me = me; + }, // SocialIssueAcc addIssueInList(state, issue) { //console.log('add issue list', issue.id); @@ -326,9 +341,17 @@ const store = createStore({ } commit("updateLocation", value); }, + getWhoAmI({ commit }) { + const url = `/api/1.0/main/whoami.json`; + makeFetch("GET", url).then((user) => { + commit("setWhoAmI", user); + }); + }, }, }); +store.dispatch("getWhoAmI"); + prepareLocations(store); export default store; From 03748a7e84444461748962a91a67c04c272951fb Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 30 Jan 2025 12:00:11 +0100 Subject: [PATCH 3/3] Add changie --- .changes/unreleased/Feature-20250130-115958.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Feature-20250130-115958.yaml diff --git a/.changes/unreleased/Feature-20250130-115958.yaml b/.changes/unreleased/Feature-20250130-115958.yaml new file mode 100644 index 000000000..ed5e05b35 --- /dev/null +++ b/.changes/unreleased/Feature-20250130-115958.yaml @@ -0,0 +1,6 @@ +kind: Feature +body: Suggest current user when creating an activity +time: 2025-01-30T11:59:58.608842881+01:00 +custom: + Issue: "334" + SchemaChange: No schema change