MayamaTakeshi / redmine_rt

Redmine plugin for Real-Time notification of events
GNU General Public License v3.0
24 stars 4 forks source link

Wrong generation of note user updated when note is updated #39

Open MayamaTakeshi opened 1 year ago

MayamaTakeshi commented 1 year ago

If user2 updates a note from user1, we were generating a journal update event with the href of user1. This is incorrect as the updater must show up if present.

MayamaTakeshi commented 1 year ago

Checking again, edited notes show up like this after page reload:

Updated by [Redmine Admin](http://192.168.225.201:3000/users/1) [21 minutes](http://192.168.225.201:3000/projects/mindcryme/activity?from=2023-05-06) ago Private · Edited

The 'Edited' responds to hover and shows the date of the modification and the author. See a full journal div below:

<div id="change-2264" class="journal has-notes private-notes">
    <div id="note-8" class="note">
    <div class="contextual">
      <span class="journal-actions"><span class="journal-2264-heart heart-link-with-count"><a class="icon icon-heart-off" data-remote="true" rel="nofollow" data-method="post" href="/hearts/heart?object_id=2264&amp;object_type=journal"><span class="heart-link-label">Like</span></a><a class="heart-count-number" href="/hearts/hearted_users?object_id=2264&amp;object_type=journal">0</a></span><a title="Quote" class="icon-only icon-comment" data-remote="true" rel="nofollow" data-method="post" href="/issues/44/quoted?journal_id=2264&amp;journal_indice=8">Quote</a> <a title="Edit" class="icon-only icon-edit" data-remote="true" data-method="get" href="/journals/2264/edit">Edit</a><span class="drdn"><span class="drdn-trigger"><span class="icon-only icon-actions" title="Actions">Actions</span></span><div class="drdn-content"><div class="drdn-items"><a href="#" onclick="copyTextToClipboard(this);; return false;" class="icon icon-copy-link" data-clipboard-text="http://192.168.225.201:3000/issues/44#note-8">Copy link</a> <a data-confirm="Are you sure?" class="icon icon-del" data-remote="true" rel="nofollow" data-method="put" href="/journals/2264?journal%5Bnotes%5D=">Delete</a></div></div></span></span>
      <a href="#note-8" class="journal-link">#8</a>
    </div>
    <h4 class="note-header">

      Updated by <a class="user active" href="/users/7">takeshi mayama</a> <a title="05/06/2023 05:02 PM" href="/projects/mindcryme/activity?from=2023-05-06">21 minutes</a> ago
      <span id="journal-2264-private_notes" class="badge badge-private private">Private</span>
      <span title="05/06/2023 05:22 PM by takeshi mayama" class="update-info">· Edited</span>
    </h4>

    <div id="journal-2264-notes" class="wiki"><p>fff ggg</p></div>
    </div>
  </div>

So we might need to modify the journal partial to include the name of 'editor' and also include data-editor attribute with its login name so that it can be compared as the name in loggedas:

<div id="loggedas">Logged in as <a class="user active" href="[/users/7](http://192.168.225.201:3000/users/7)">mayama</a></div> 
MayamaTakeshi commented 11 months ago

The change in 2ca9c6c10ffa2a26c58548551f0b16a88f416549 was undone by c7d883fe7847f0eeaae563f7ac1d0faa7c8d0160 as journal.updated_by seems to not be available in redmine4.