MayamaTakeshi / redmine_rt

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

some another incompatibles with another plugin #32

Closed AndreySolod closed 1 year ago

AndreySolod commented 1 year ago

Hi, I find some another Incompatibles with plugins: 1) Incompatibles with redmine_issue_dynamic_edit - when Issue updated by redmine_rt, Redmine itself begins to believe that someone else has updated the task and shows the following picture: image And when Issue updates via issue_dynamics_edit the plugin adds 2 entries about this to the "notes" tab, although it should not add any: image 2) With plugins redmine_hearts: sometimes He just stop working with next error: image

c7f99df6-dbe4-4f45-a0bc-2032796c7e74] plugins/redmine_rt/lib/redmine_rt/journals_controller_patch.rb:24:in `show'
[c7f99df6-dbe4-4f45-a0bc-2032796c7e74] lib/redmine/sudo_mode.rb:61:in `sudo_mode'
I, [2023-04-22T13:59:09.766358 #29]  INFO -- : [8ff6c332-ce58-45ad-b148-2eba15778b3d] Started GET "/journals/71?indice=1" for 172.18.0.1 at 2023-04-22 13:59:09 +0000
I, [2023-04-22T13:59:09.767090 #29]  INFO -- : [8ff6c332-ce58-45ad-b148-2eba15778b3d] Processing by JournalsController#show as */*
I, [2023-04-22T13:59:09.767165 #29]  INFO -- : [8ff6c332-ce58-45ad-b148-2eba15778b3d]   Parameters: {"indice"=>"1", "id"=>"71"}
I, [2023-04-22T13:59:09.772958 #29]  INFO -- : [8ff6c332-ce58-45ad-b148-2eba15778b3d]   Current user: admin (id=1)
I, [2023-04-22T13:59:09.775856 #29]  INFO -- : [8ff6c332-ce58-45ad-b148-2eba15778b3d] Completed 404 Not Found in 9ms (ActiveRecord: 1.8ms | Allocations: 1406)
F, [2023-04-22T13:59:09.776509 #29] FATAL -- : [8ff6c332-ce58-45ad-b148-2eba15778b3d]   
[8ff6c332-ce58-45ad-b148-2eba15778b3d] ActiveRecord::RecordNotFound (Couldn't find Journal with 'id'=71):
[8ff6c332-ce58-45ad-b148-2eba15778b3d]   
[8ff6c332-ce58-45ad-b148-2eba15778b3d] plugins/redmine_rt/lib/redmine_rt/journals_controller_patch.rb:24:in `show'
[8ff6c332-ce58-45ad-b148-2eba15778b3d] lib/redmine/sudo_mode.rb:61:in `sudo_mode'

and when he add the comment, comment does not have a heart - we need to refrest the page:(

MayamaTakeshi commented 1 year ago

I tried to use the latest https://github.com/Ilogeek/redmine_issue_dynamic_edit commit:

$ git log |head -n 5
commit 17714c542b39b67ad5b061bfbb64d2c000fcd64c
Author: Hugo Zilliox <hello@hzilliox.fr>
Date:   Tue Dec 27 23:58:11 2022 +0100

    JSToolbar fixed (#100)

But I get this error constantly in the web console:

        Error: Error occured: 
    checkVersion http://192.168.225.201:3000/plugin_assets/redmine_issue_dynamic_edit/javascripts/issue_dynamic_edit.js?1682683385:328
    promise callback*checkVersion http://192.168.225.201:3000/plugin_assets/redmine_issue_dynamic_edit/javascripts/issue_dynamic_edit.js?1682683385:306
    checkVersionInterval http://192.168.225.201:3000/plugin_assets/redmine_issue_dynamic_edit/javascripts/issue_dynamic_edit.js?1682683385:342
    setInterval handler*setCheckVersionInterval http://192.168.225.201:3000/plugin_assets/redmine_issue_dynamic_edit/javascripts/issue_dynamic_edit.js?1682683385:341
    <anonymous> http://192.168.225.201:3000/plugin_assets/redmine_issue_dynamic_edit/javascripts/issue_dynamic_edit.js?1682683385:350

The redmine_rt plugin is not installed. Which version of redmine_issue_dynamic_edit are you using?

UPDATE: The above problem was caused because I got this in my redmine URL

  http://192.168.225.201:3000/issues/19?tab=history

So in client javascript I have LOCATION_HREF="http://192.168.225.201:3000/issues/19?tab=history" But the code in issue_dynamic_edit.js has this:

    fetch(LOCATION_HREF + ".json", {
        method: 'GET',
        crossDomain: true,
    }).then(res => res.text()).then(...)

So it would try to get

http://192.168.225.201:3000/issues/19?tab=history.json

which of course would fail. I added code to clean up the LOCATION_HREF:

let clean_url = (url) => {
    let nu = new URL(url);
    return `${nu.protocol}//${nu.host}${nu.pathname}`;
}

let LOCATION_HREF = typeof custom_location_href !== 'undefined' ? custom_location_href : clean_url(window.location.href);

and then this issue was solved and i could see the issue details being updated in realtime. But this work only for one change as there is another problem:

Uncaught TypeError: Node.appendChild: Argument 1 is not an object.
    onreadystatechange http://192.168.225.201:3000/plugin_assets/redmine_issue_dynamic_edit/javascripts/issue_dynamic_edit.js?1682748498:412
    updateIssue http://192.168.225.201:3000/plugin_assets/redmine_issue_dynamic_edit/javascripts/issue_dynamic_edit.js?1682748498:377
    sendData http://192.168.225.201:3000/plugin_assets/redmine_issue_dynamic_edit/javascripts/issue_dynamic_edit.js?1682748498:443
    checkVersion http://192.168.225.201:3000/plugin_assets/redmine_issue_dynamic_edit/javascripts/issue_dynamic_edit.js?1682748498:325
    promise callback*checkVersion http://192.168.225.201:3000/plugin_assets/redmine_issue_dynamic_edit/javascripts/issue_dynamic_edit.js?1682748498:306
    sendData http://192.168.225.201:3000/plugin_assets/redmine_issue_dynamic_edit/javascripts/issue_dynamic_edit.js?1682748498:441
    getEditFormHTML http://192.168.225.201:3000/plugin_assets/redmine_issue_dynamic_edit/javascripts/issue_dynamic_edit.js?1682748498:94
issue_dynamic_edit.js:412:53

The above happens no matter if the LOCATION_HREF is clean or not. There is an error in this line:

https://github.com/Ilogeek/redmine_issue_dynamic_edit/blob/17714c542b39b67ad5b061bfbb64d2c000fcd64c/assets/javascripts/issue_dynamic_edit.js#L412

As the result of

doc.querySelector('#history .journal.has-details:last-child')

is null.

However, since you are not seeing these problems probably you are using a different or a patched version of this plugin.

Anyway, since I can see the issue, I have created an PR: https://github.com/Ilogeek/redmine_issue_dynamic_edit/pull/110

Also this explains the journal being added in duplicity. Because in fact, any change in journals will be notified and updated by redmine_rt (journals are not only notes, but changes in properties too). However, the above code in redmine_issue_dynamic_edit is doing the same thing after it changes something. So that is why you see that journal being added two times. (this could be solved by modifying redmine_issue_dynamic_edit to check if redmine_rt is present, and if yes, to ignore the update of the notes. This should not be difficult to do but since it is not critical and I have very limited time to work on redmine tasks I will not prepare a PR for it yet).

MayamaTakeshi commented 1 year ago

In case of redmine hearts, I could not reproduce the problem. But I can see when a note is added dynamically by redmine_rt, the heart will not be present. This is because redmine_rt doesn't know about any GUI additions that might have been added to notes. So it just adds a plain note:

image

MayamaTakeshi commented 1 year ago

I could not recreate the error with redmine_hearts yet but regarding the heart not showing up in added notes it is documented here (but no solution): #34

MayamaTakeshi commented 1 year ago

Also, to simplify discussion, it is better to report only one problem per issue.

MayamaTakeshi commented 1 year ago

Regarding the "This issue has been updated by someone else while you are editing it. ", this is not an issue with redmine_rt. If you open 2 tabs and change something in one tab using redmine_issue_dynamic_edit , the other tab will show that message (you don't need to have redmine_rt installed to reproduce this). But the documentation of the plugin says this check can be disabled:

$ grep CONFLICT plugins/redmine_issue_dynamic_edit/assets/javascripts/issue_dynamic_edit_configuration_file.js 
 * _CONF_CHECK_ISSUE_UPDATE_CONFLICT (boolean)
var _CONF_CHECK_ISSUE_UPDATE_CONFLICT = false;

I tested and it works. However since it doesn't check for realtime changes, the fields are not updated when someone else updates the fields. I'm planning to eventually work to integrate redmine_issue_dynamic_edit with redmine_rt.

MayamaTakeshi commented 1 year ago

Checking again, you are correct when you say "And when Issue updates via issue_dynamics_edit the plugin adds 2 entries about this to the "notes" tab, although it should not add any"

The problem is that both redmine_rt and redmine_issue_dynamic_edit are not checking which is the tab that is currently active. The journal must be added anyway but it must have visibility adjusted according to the active tab. In redmine_rt this is set to be solved by #4 (but very low priority).

AndreySolod commented 1 year ago

Hi, I am here. Sorry for the delay in responding. Regarding the issue of Issue_dynamics_edit versions - it is almost entirely written in JavaScript, which I do not know (but I am learning), so I cannot edit it. I use the standard version obtained from GitHub by "git clone ...". I installed Kubuntu 22.10 system on the virtual machine, ruby - standard, obtained via apt-get install ruby ruby-dev, database - postgres, downloaded redmine, cloned issue_dynamics_edit to the plugins folder, start redmine in production environment and on the webrick. I am check your solution about Issue_dynamics_edit and wrote some comment - apparently, there is a problem with the readme, which I did not have, since docker-entrypoint included some of the specified actions. Then I am try to install redmine_rt. Downloaded the redis image via docker, launched it with the following parameters: docker run --name redis -p 6379:6379 -d redis The cable.yml file has the following configuration (I want to test error #29):

development:
  adapter: redis
  url: redis://localhost:637
  channel_prefix: redmine_rt

test:
  adapter: async

production:
  adapter: redis
  url: redis://localhost:637
  channel_prefix: redmine_rt

As expected, nothing works - not even issue_dynamics_edit (it's a bit weird, but it doesn't matter). ok, let's fix our error with port: url: redis://localhost:6379 Now the plugin works partially: issue_dynamics_edit works, comments are added, but not dynamically: in the console I get the following error: action_cable.js?1682889850:239 WebSocket connection to 'ws://localhost:3000/cable' failed: Error during WebSocket handshake: Unexpected response code: 500 Full error record in production.log:

[71517628-9e22-44f0-95cd-9e8ec658613f]   Rendered issues/show.api.rsb (Duration: 13.6ms | Allocations: 2433)
I, [2023-05-01T07:41:51.391809 #15324]  INFO -- : [71517628-9e22-44f0-95cd-9e8ec658613f] Completed 200 OK in 279ms (Views: 16.4ms | ActiveRecord: 47.7ms | Allocations: 52443)
I, [2023-05-01T07:41:51.771736 #15324]  INFO -- : [f1a41dda-671b-452b-a6f9-62b4a2801d0b] Started GET "/cable" for 127.0.0.1 at 2023-05-01 07:41:51 +1000
I, [2023-05-01T07:41:51.772304 #15324]  INFO -- : [f1a41dda-671b-452b-a6f9-62b4a2801d0b] Started GET "/cable/" [WebSocket] for 127.0.0.1 at 2023-05-01 07:41:51 +1000
I, [2023-05-01T07:41:51.772434 #15324]  INFO -- : [f1a41dda-671b-452b-a6f9-62b4a2801d0b] Successfully upgraded to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
F, [2023-05-01T07:41:51.784385 #15324] FATAL -- : [f1a41dda-671b-452b-a6f9-62b4a2801d0b]   
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] NotImplementedError (only partial hijack is supported.):
[f1a41dda-671b-452b-a6f9-62b4a2801d0b]   
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] rack (2.2.7) lib/rack/handler/webrick.rb:83:in `block in service'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actioncable (6.1.7.2) lib/action_cable/connection/stream.rb:102:in `hijack_rack_socket'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actioncable (6.1.7.2) lib/action_cable/connection/client_socket.rb:59:in `start_driver'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actioncable (6.1.7.2) lib/action_cable/connection/client_socket.rb:70:in `rack_response'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actioncable (6.1.7.2) lib/action_cable/connection/web_socket.rb:34:in `rack_response'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actioncable (6.1.7.2) lib/action_cable/connection/base.rb:217:in `respond_to_successful_request'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actioncable (6.1.7.2) lib/action_cable/connection/base.rb:75:in `process'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actioncable (6.1.7.2) lib/action_cable/server/base.rb:33:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/routing/mapper.rb:20:in `block in <class:Constraints>'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/routing/mapper.rb:49:in `serve'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/journey/router.rb:50:in `block in serve'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/journey/router.rb:32:in `each'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/journey/router.rb:32:in `serve'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/routing/route_set.rb:842:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] rack (2.2.7) lib/rack/tempfile_reaper.rb:15:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] rack (2.2.7) lib/rack/etag.rb:27:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] rack (2.2.7) lib/rack/conditional_get.rb:27:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] rack (2.2.7) lib/rack/head.rb:12:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/http/permissions_policy.rb:22:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/http/content_security_policy.rb:19:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] rack (2.2.7) lib/rack/session/abstract/id.rb:266:in `context'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] rack (2.2.7) lib/rack/session/abstract/id.rb:260:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/middleware/cookies.rb:697:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] activesupport (6.1.7.2) lib/active_support/callbacks.rb:98:in `run_callbacks'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] railties (6.1.7.2) lib/rails/rack/logger.rb:37:in `call_app'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] railties (6.1.7.2) lib/rails/rack/logger.rb:26:in `block in call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] activesupport (6.1.7.2) lib/active_support/tagged_logging.rb:99:in `block in tagged'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] activesupport (6.1.7.2) lib/active_support/tagged_logging.rb:37:in `tagged'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] activesupport (6.1.7.2) lib/active_support/tagged_logging.rb:99:in `tagged'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] railties (6.1.7.2) lib/rails/rack/logger.rb:26:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] request_store (1.5.1) lib/request_store/middleware.rb:19:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/middleware/request_id.rb:26:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] rack (2.2.7) lib/rack/method_override.rb:24:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] rack (2.2.7) lib/rack/runtime.rb:22:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] activesupport (6.1.7.2) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/middleware/executor.rb:14:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/middleware/static.rb:24:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] rack (2.2.7) lib/rack/sendfile.rb:110:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] rack (2.2.7) lib/rack/content_length.rb:17:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] actionpack (6.1.7.2) lib/action_dispatch/middleware/host_authorization.rb:142:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] railties (6.1.7.2) lib/rails/engine.rb:539:in `call'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] rack (2.2.7) lib/rack/handler/webrick.rb:95:in `service'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] webrick (1.8.1) lib/webrick/httpserver.rb:140:in `service'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] webrick (1.8.1) lib/webrick/httpserver.rb:96:in `run'
[f1a41dda-671b-452b-a6f9-62b4a2801d0b] webrick (1.8.1) lib/webrick/server.rb:310:in `block in start_thread'

Question: What did I forget? To run redmine, I use the command: rails server -u webrick -e production Perhaps this error is related to edits for redmine_checklists? Then I'll check these plugins for compatibility - I had both plugins installed, and I didn't get the errors described in #33.

MayamaTakeshi commented 1 year ago

webrick probably doesn't have full WebSocket support as seen by

NotImplementedError (only partial hijack is supported.):

Try using default webserver puma by doing:

bundle exec rails server -e production -b 0.0.0.0

UPDATE: also, webrick can be used at most for development. It is not suitable for production.

MayamaTakeshi commented 1 year ago

I think issues mentioned here were solved/explained. I'm closing this how.

MayamaTakeshi commented 1 year ago

Regarding your comment in redmine_issue_dynamic_edit PR 110, it is better to remove it as it will confuse the author (he doesn't need to know those details and the more he has to read and try to understand, the more time it will take for the PR to be accepted). Also, PRs are not the place to report problems: they are used to offer a solution to a problem or offer new features.