NotePlan / plugins

The main NotePlan repository, which contains the source code for all NotePlan plugins. If a release entry has been created, it will be available for installation from within NotePlan application.
MIT License
167 stars 58 forks source link

Link to create meeting note doesn't create link to event or allow reloading of note once created #524

Open ishirbhan opened 9 months ago

ishirbhan commented 9 months ago

Describe the bug After inserting a list of events using the "insert todays events as list" command, the Meeting Note link will indeed create a new note, but it is not linked to the calendar event. Going back to the Meeting Note link on the calendar page will load the created note but instead will offer to create a new one. If I do this, it realizes the note already exists and gives me various options.

To Reproduce Steps to reproduce the behavior:

  1. Go to today's daily note
  2. run the "Insert today's events as list" command (the same problem occurs if invoking via a template (My Events List display format is - |START| |TITLE| |EVENTLINK| |MEETINGNOTE|; sort order of events is time, Calendars to include is "Calendar" (which is an Exchange calendar); Meeting Note Template title is blank)
  3. Click on Meeting Note link - I am prompted to create a select a template - I do this and the Note loads
  4. Return to daily note
  5. Click on same Meeting Note link
  6. I again am given the prompt to select a template
  7. The note loads, but I get a warning that the note already exists and am given the option to open existing note, prepend, append, or create a new note with the same name.

Expected behavior After Step 5, I expected the note I created in step 3 to load without prompting for a template or warning that the note already exists.

Screenshots If applicable, add screenshots to help explain your problem.

System

Additional context I'm thinking the issue is that the event ID's don't match between the event and the Meeting Note links:

Event link in today's note ![📅](2024-01-31 08:00:::E5FD21CC-5DB5-4E77-9C9D-6499183F9365/RID=728398800:::NA:::ClinOps/ CR AGT :::#1BADF8)

Event link in meeting note (the same) ![📅](2024-01-31 08:00:::E5FD21CC-5DB5-4E77-9C9D-6499183F9365/RID=728398800:::NA:::ClinOps/ CR AGT :::#1BADF8)

Link to Meeting Note in Event List Meeting Note

Plugin Console Log To provide us with more clues about where the bug/error is occurring...

  1. Open the Plugin's Preferences by going to NotePlan's menu > Preferences > Plugins and clicking the settings "cog" icon next to the plugin in question. Scroll to the bottom and set the logging level to "DEBUG" and click "Save & Close"
  2. Now open the Plugin Console by going to Noteplan > Help > Plugin Console
  3. Run the plugin command you're reporting
  4. Copy the output from the Plugin Console and paste it below
  5. Delete any output that has personal information you don't want in there
    Executing function 'insertDaysEvents'
    2024-01-31 08:42:07 | DEBUG | jgclark.EventHelpers v0.21.0 :: insertDaysEvents: Starting
    2024-01-31 08:42:07 | DEBUG | jgclark.EventHelpers v0.21.0 :: listDaysEvents: starting for date 20240131 with paramString=''
    2024-01-31 08:42:07 | DEBUG | jgclark.EventHelpers v0.21.0 :: Start of getEventsSettings()
    2024-01-31 08:42:07 | DEBUG | tempTimeOptions:  :: {
    "minute": "2-digit",
    "hour12": true,
    "hour": "2-digit"
    }
    2024-01-31 08:42:07 | DEBUG |  :: [Calendar]
    2024-01-31 08:42:07 | DEBUG | NPCalendar / getEventsForDay :: - 6 of 10 Events kept for 20240131 after filtering with Calendar
    2024-01-31 08:42:07 | DEBUG | listDaysEvents :: - 6 events found on 20240131 from  1 calendars Calendar
    2024-01-31 08:42:07 | DEBUG | listDaysEvents :: - Processing event 'REDACTED1 ' (object)
    2024-01-31 08:42:07 | DEBUG | listDaysEvents :: - Processing event 'REDACTED2' (object)
    2024-01-31 08:42:07 | DEBUG | listDaysEvents :: - Processing event 'REDACTED3' (object)
    2024-01-31 08:42:07 | DEBUG | listDaysEvents :: - Processing event 'REDACTED4' (object)
    2024-01-31 08:42:07 | DEBUG | listDaysEvents :: - Processing event 'REDACTED5' (object)
    2024-01-31 08:42:07 | DEBUG | listDaysEvents :: - Processing event 'REDACTED6' (object)
    2024-01-31 08:42:07 | DEBUG | listDaysEvents :: ## Events
    - 08:00 AM REDACTED1  ![📅](2024-01-31 08:00:::E5FD21CC-5DB5-4E77-9C9D-6499183F9365/RID=728398800:::NA::: REDACTED1 :::#1BADF8) [Meeting Note](noteplan://x-callback-url/runPlugin?pluginID=np.MeetingNotes&command=newMeetingNoteFromEventID&arg0=7450A589-933C-44AA-A2A1-416636A38A72&arg1=)
    - 09:00 REDACTED2 ![📅](2024-01-31 09:00:::E3DB0622-744F-4935-90ED-EB2FD85925F7/RID=728402400:::NA:::REDACTED2:::#1BADF8) [Meeting Note](noteplan://x-callback-url/runPlugin?pluginID=np.MeetingNotes&command=newMeetingNoteFromEventID&arg0=6F480898-6A37-4EFF-8B10-E014CE9DBD85&arg1=)
    - 12:00 PM REDACTED3 ![📅](2024-01-31 12:00:::6E4F9A93-BB9A-4125-8E78-12A9A66A51AF:::NA::: REDACTED3:::#1BADF8) [Meeting Note](noteplan://x-callback-url/runPlugin?pluginID=np.MeetingNotes&command=newMeetingNoteFromEventID&arg0=DC31BF30-B280-4C72-AD71-1F24147BBA6B&arg1=)
    - 01:30 PM REDACTED4  ![📅](2024-01-31 13:30:::212D34EE-04B1-423A-B6FC-A661E6393302:::NA::: REDACTED4 :::#1BADF8) [Meeting Note](noteplan://x-callback-url/runPlugin?pluginID=np.MeetingNotes&command=newMeetingNoteFromEventID&arg0=0DA4F42E-48D1-4AA2-BDD0-52FC8F94C710&arg1=)
    - 02:30 PM REDACTED5 ![📅](2024-01-31 14:30:::BFE1800E-DE6A-41B5-8762-EC44AF7C66D0/RID=728330400:::NA::: REDACTED5:::#1BADF8) [Meeting Note](noteplan://x-callback-url/runPlugin?pluginID=np.MeetingNotes&command=newMeetingNoteFromEventID&arg0=5DA66D79-49CE-47F8-8D92-58D9654ABA05&arg1=)
    - 04:30 PM REDACTED6 ![📅](2024-01-31 16:30:::007E4092-B377-43C4-98A1-4D70B300AFEF:::NA::: REDACTED6:::#1BADF8) [Meeting Note](noteplan://x-callback-url/runPlugin?pluginID=np.MeetingNotes&command=newMeetingNoteFromEventID&arg0=1279A67A-DB19-41E0-815B-9E4A708B26C0&arg1=)
dwertheimer commented 9 months ago

@ishirbhan Thanks for this detailed report.

The behavior you are seeing is due to the way the MeetingNote function looks to see if a note already exists. Because a MeetingNote uses a template, you could name a meeting note absolutely anything, and so you need to tell it the 2nd time what template to use (should be the same as you used before) and it will look for a note with the proper title (after template processing) and should ask you:

Screen Cap 2024-01-31 at 09 08 17@2x

Is this not the behavior you are seeing?

All of this can be avoided if you set your meeting note template that the plugin should use in the Event Helpers plugin preferences:

Screen Cap 2024-01-31 at 09 14 31@2x

In that case, it will never ask you for a template and it will jump straight to the "Note exists" selector above.

You would think that rewriting the "Meeting Note" link in the daily note to just point to the newly created note would be an easy thing to do, but it's not that easy given how x-callback links work, we don't know what link you clicked (or even what note you clicked in or whether you were in NotePlan at all) that sent you to the "create meeting note for event" function. I have asked @EduardMe before if he could provide us with this information, but I'm sure that's at the very bottom of his todo list. So it is what it is. I can imagine ways that the plugin could scan notes trying to guess at the link you clicked, but still, you would be guessing. And recurring events have the same ID, so they could be in every one of your daily notes. So the way it works seemed like a good compromise, especially with the template setting. Thoughts?

cc: @jgclark

ishirbhan commented 9 months ago

My issue is actually not with being prompted for the template - I expect that and it's no problem.

The issue is that, once I create the note and go back to the daily note, I expect the Meeting Link would just take me to the note. However, it's not doing that. It's instead prompting me again for the template, and then gives me additional options once it finds the note already exists. Is this expected behavior?

dwertheimer commented 9 months ago

@ishirbhan Yes that's how it's supposed to work given the limitations I described previously.

dwertheimer commented 9 months ago

The issue is that a recurring calendar item has the exact same ID and so we need to know whether to create a note for this particular meeting or whether you want to have one note for the entire series. Also, you could have a name title collision with a note that already exists. Do you have suggestions on how to work around all of this? I really really wish we could rewrite the link. You clicked to know exactly what note you opened/created, but because that's not possible I'm not sure what the solution is. Ideas are welcome

ishirbhan commented 8 months ago

I'm still not getting this to work...I have a non-repeating event that I created via clicking on the "Meeting Note" link after triggering my template for my daily note. The line is:

The link correctly prompts me for a template and then creates a note the first time I click it. When I go back my daily note, I expect this link will now link to the meeting note I just created. However, it again prompts for a template selection and tries to create a new note (and later prompts for options when it finds a note already exists).

My "Lunch" meeting note has the following line: Event: ![📅](2024-02-06 12:00:::FE77F2F7-FED9-4C56-BD28-1D7B9F77BF73:::NA:::Lunch:::#1BADF8)

The question is why are the ID of the meeting not match? I assume that's why the meeting note link is not leading me back to the note.

I have no problem getting to the note via the popup on the calendar sidebar.

dwertheimer commented 8 months ago

Let's ask @EduardMe how he's doing it in the sidebar and if he can make the same available through the newMeetingNoteFromID function in np.MeetingNotes

dwertheimer commented 8 months ago

@ishirbhan I have found a partial workaround, but one of the APIs I need is crashing NotePlan. So I have asked @EduardMe in Discord

dwertheimer commented 8 months ago

@ishirbhan I think I have a solution for this. I uploaded the new MeetingNotes code. You need the latest Testflight beta of NotePlan to run it. I think a new release of NotePlan is coming out soon also.

ishirbhan commented 8 months ago

Thanks, I’ve been meaning to try the beta. I’ll sign up for the TestFlight.

On Feb 12, 2024 at 7:34:59 PM, David Wertheimer @.***> wrote:

@ishirbhan https://github.com/ishirbhan I think I have a solution for this. I uploaded the new MeetingNotes code. You need the latest Testflight beta of NotePlan to run it. I think a new release of NotePlan is coming out soon also.

— Reply to this email directly, view it on GitHub https://github.com/NotePlan/plugins/issues/524#issuecomment-1939874536, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEUF5NUOGBLYXOD2LR2AXLYTKYLHAVCNFSM6AAAAABCTDC5NSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZZHA3TINJTGY . You are receiving this because you were mentioned.Message ID: @.***>

ishirbhan commented 8 months ago

Based on quick testing on one meeting, it looks like it's fixed.