Redmine: Issueshttps://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292022-12-07T09:59:33ZRedmine
Redmine Redmine - Defect #38021 (Closed): Development mode, class-reloader is not work.https://www.redmine.org/issues/380212022-12-07T09:59:33ZHaihan Ji
<p><a class="external" href="http://127.0.0.1:3000/admin/info">http://127.0.0.1:3000/admin/info</a><br /><pre>
Environment:
Redmine version 5.0.4.stable
Ruby version 2.6.9-p207 (2021-11-24) [x64-mingw32]
Rails version 6.1.7
Environment development
Database adapter Mysql2
Mailer queue ActiveJob::QueueAdapters::AsyncAdapter
Mailer delivery smtp
Redmine settings:
Redmine theme Default
SCM:
Subversion 1.14.1
Git 2.34.1
Filesystem
Redmine plugins:
demo 0.0.1
</pre></p>
<p>make a plugin:<br /><pre>
rails g redmine_plugin demo
rails g redmine_plugin_controller demo test index
</pre></p>
<p>plugin/config/routes.rb<br /><pre>
# Plugin's routes
# See: http://guides.rubyonrails.org/routing.html
resources 'test'
</pre></p>
<p>plugins/demo/app/controllers/test_controller.rb<br /><pre>
class TestController < ApplicationController
def index
@var = 'abc'
end
end
</pre></p>
<p>plugins/demo/app/views/test/index.html.erb<br /><pre>
<h2>TestController#index</h2>
<h3>@var</h3>
<%= debug @var%>
</pre></p>
<p>If I change value of @var, I have to reboot the server to make it effective.</p>
<p>I read the rails guide ( <a class="external" href="https://guides.rubyonrails.org/autoloading_and_reloading_constants.html">https://guides.rubyonrails.org/autoloading_and_reloading_constants.html</a> ), made a simple try.<br />Append this line to <code>REDMINE_ROOT/config/application.rb</code><br /><pre>
config.autoload_paths << 'D:/Ruby/redmine-5.0.4/plugins/demo/app/controllers'
</pre></p>
<p>Class Reloader work again!</p>
<p>Maybe, <code>PluginLoader::add_autoload_paths</code> need upgrade, it seems that it does not work properly in Zeitwerk mode.</p>
<p><code>REDMINE_ROOT/lib/redmine/plugin_loader.rb:130</code> <br /><pre><code class="ruby syntaxhl"> <span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">add_autoload_paths</span>
<span class="n">directories</span><span class="p">.</span><span class="nf">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">directory</span><span class="o">|</span>
<span class="c1"># Add the plugin directories to rails autoload paths</span>
<span class="n">engine_cfg</span> <span class="o">=</span> <span class="no">Rails</span><span class="o">::</span><span class="no">Engine</span><span class="o">::</span><span class="no">Configuration</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">directory</span><span class="p">.</span><span class="nf">to_s</span><span class="p">)</span>
<span class="n">engine_cfg</span><span class="p">.</span><span class="nf">paths</span><span class="p">.</span><span class="nf">add</span> <span class="s1">'lib'</span><span class="p">,</span> <span class="ss">eager_load: </span><span class="kp">true</span>
<span class="n">engine_cfg</span><span class="p">.</span><span class="nf">eager_load_paths</span><span class="p">.</span><span class="nf">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">dir</span><span class="o">|</span>
<span class="no">Rails</span><span class="p">.</span><span class="nf">autoloaders</span><span class="p">.</span><span class="nf">main</span><span class="p">.</span><span class="nf">push_dir</span> <span class="n">dir</span> <span class="c1"># <== Here??</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span>
</code></pre></p> Redmine - Patch #25265 (Closed): QueriesController can not handle subclass of IssueQueryhttps://www.redmine.org/issues/252652017-03-06T07:09:28ZHaihan Ji
<p>I have a PivotQuery, it's a subclass of IssueQuery.<br />But Query don't think it is subclass of himself.<br />So, <a class="changeset" title="Makes QueriesController able to handle other Query subclasses." href="https://www.redmine.org/projects/redmine/repository/svn/revisions/15635">r15635</a> let my plugin down.</p>
<p>I changed QueriesController to fix it.</p>
<p>OLD CODE:<br /><pre><code class="ruby syntaxhl"><span class="k">def</span> <span class="nf">query_class</span>
<span class="no">Query</span><span class="p">.</span><span class="nf">get_subclass</span><span class="p">(</span><span class="n">params</span><span class="p">[</span><span class="ss">:type</span><span class="p">]</span> <span class="o">||</span> <span class="s1">'IssueQuery'</span><span class="p">)</span>
<span class="k">end</span></code></pre><br />New Code<br /><pre><code class="ruby syntaxhl"><span class="k">def</span> <span class="nf">query_class</span>
<span class="n">get_query_class</span><span class="p">(</span><span class="n">params</span><span class="p">[</span><span class="ss">:type</span><span class="p">]</span> <span class="o">||</span> <span class="s1">'IssueQuery'</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">def</span> <span class="nf">get_query_class</span><span class="p">(</span><span class="n">class_name</span><span class="p">)</span>
<span class="n">klass</span> <span class="o">=</span> <span class="kp">nil</span>
<span class="k">begin</span>
<span class="n">klass</span> <span class="o">=</span> <span class="n">class_name</span><span class="p">.</span><span class="nf">to_s</span><span class="p">.</span><span class="nf">classify</span><span class="p">.</span><span class="nf">constantize</span>
<span class="k">rescue</span>
<span class="c1"># invalid class name</span>
<span class="k">end</span>
<span class="k">unless</span> <span class="n">klass</span> <span class="o">&&</span> <span class="n">klass</span><span class="p">.</span><span class="nf">new</span><span class="p">.</span><span class="nf">is_a?</span><span class="p">(</span><span class="no">Query</span><span class="p">)</span>
<span class="n">klass</span> <span class="o">=</span> <span class="kp">nil</span>
<span class="k">end</span>
<span class="n">klass</span>
<span class="k">end</span></code></pre></p> Redmine - Defect #24019 (Closed): GIT not update https://www.redmine.org/issues/240192016-10-07T18:57:21ZHaihan Ji
<p><a class="external" href="https://github.com/redmine/redmine">https://github.com/redmine/redmine</a> no update.<br />The latest update about one month ago.<br />My sites follow cannot get latest version by git.</p> Redmine - Feature #23529 (Closed): Calculate parent Issue's done ratio from subtasks in case of '...https://www.redmine.org/issues/235292016-08-07T16:20:52ZHaihan Ji
<p>Admin -> Settings -> Issue Tracking:</p>
<blockquote>
<p>Calculate the issue done ratio with => 'Use the issue status'<br />Parent tasks attributes : % Done => Calculated from subtasks</p>
</blockquote>
<p>If I set NEW is 0%, CLOSED is 100%.<br />When all subtasks are closed, the parent issue still is 0% (status is NEW).<br />But I hope it be 100%.</p>
<p>Can you add a switch? Force calculate the parent done ratio from subtasks?</p> Redmine - Feature #23510 (Closed): Reuse an exist attachmenthttps://www.redmine.org/issues/235102016-08-04T15:17:21ZHaihan Ji
<p>Attach an exist attachment to an old issue.<br />(New one can use COPY.)</p> Redmine - Feature #23434 (Closed): Add hook to action_menuhttps://www.redmine.org/issues/234342016-07-26T00:06:12ZHaihan Ji
<p>Please add hook to app/views/issues/_action_menu.html.erb</p> Redmine - Feature #23282 (Closed): Range filterhttps://www.redmine.org/issues/232822016-07-09T00:23:57ZHaihan Ji
<p>I have 1000 issues in a project, and export limit is 500.<br />I can't export 501-1000 issues?<br />Now, I have to use some filters to split the list.<br />But, sometime it's difficult to chose suitable filter.<br />How about add a filter, set the offset for whole list (not for page).</p> Redmine - Feature #22997 (Closed): Administrative calendarhttps://www.redmine.org/issues/229972016-06-06T15:14:18ZHaihan Ji
<p>Not only Sat. and Sun don't work. For example.<br />2016-06-09 is the Dragon Boat Festival of China.<br />That mean's Chinese don't work from 2016-06-09 to 2016-06-11,<br />but they have to work at 2016-06-12 (Sunday).<br />So, I hope admin can set which non-workday need to convert workday , <br />and which workday don't need work.<br />And make it effective In gantt view, or calculate workdays.</p> Redmine - Patch #22983 (Closed): Simplified Chinese translation for Revision 15449https://www.redmine.org/issues/229832016-06-04T10:19:01ZHaihan Ji
<p>As subject.</p> Redmine - Feature #22982 (Closed): PM can manage local group in Project.https://www.redmine.org/issues/229822016-06-04T09:11:30ZHaihan Ji
<p>Project manager hope assign an issue to more than one user of his team.<br />So he has to send a request to administrator, "please create a group for me, the group include xxx, xxx, and xxx".<br />If member of group change, pm has to ask again. It's boring to admin and pm.</p>
<p>It would be great if pm can manage group in project by himself,</p> Redmine - Feature #22913 (Closed): Auto-select fields mapping in Importinghttps://www.redmine.org/issues/229132016-05-27T13:55:39ZHaihan Ji
<p>I hate to select many times in import-mapping.<br />This patch can auto select by label before you select it.</p> Redmine - Patch #22911 (Closed): Error raised when importing issue with Key/Value List custom fieldhttps://www.redmine.org/issues/229112016-05-27T12:04:15ZHaihan Ji
<p>Import issue with key/value list custom field will throw exception.<br />The exception is <code>NoMethodError (undefined method `id' for #<CustomFieldEnumeration......</code></p> Redmine - Defect #21453 (Closed): LDAP account creation fails when first name/last name contain n...https://www.redmine.org/issues/214532015-12-08T02:41:36ZHaihan Ji
<p>Maybe, redmine can add an <code>encoding</code> property to <code>AuthSource</code>.</p>
<pre>$ ruby bin/about
sh: svn: command not found
sh: darcs: command not found
sh: hg: command not found
sh: cvs: command not found
sh: bzr: command not found
sh: git: command not found
Environment:
Redmine version 3.2.0.stable
Ruby version 2.2.1-p85 (2015-02-26) [x86_64-linux]
Rails version 4.2.5
Environment production
Database adapter Mysql2
SCM:
Filesystem
Redmine plugins:
no plugin installed</pre>
<p>LOG<br /><pre>Started GET "/auth_sources/autocomplete_for_new_user?term=xxxx" for 10.10.93.107 at 2015-12-08 10:12:17 +0800
Processing by AuthSourcesController#autocomplete_for_new_user as JSON
Parameters: {"term"=>"xxxx"}
SQL (1.7ms) UPDATE `tokens` SET `tokens`.`updated_on` = '2015-12-08 10:12:17' WHERE `tokens`.`user_id` = 1 AND `tokens`.`value` = '5e869f0905478838585d8022d4347ea0cf68ee9e' AND `tokens`.`action` = 'session'
(0.5ms) SELECT MAX(`settings`.`updated_on`) FROM `settings`
User Load (0.5ms) SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`status` = 1 AND `users`.`id` = 1 LIMIT 1
Current user: admin (id=1)
AuthSource Load (0.5ms) SELECT `auth_sources`.* FROM `auth_sources`
Completed 500 Internal Server Error in 176ms (ActiveRecord: 3.2ms)
Encoding::UndefinedConversionError ("\xE5" from ASCII-8BIT to UTF-8):
app/controllers/auth_sources_controller.rb:79:in `autocomplete_for_new_user'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'
Rendered /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_source.erb (3.6ms)
Rendered /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_trace.text.erb (0.8ms)
Rendered /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb (0.9ms)
Rendered /usr/local/rvm/gems/ruby-2.2.1/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb (67.2ms)
</pre></p>
<p>The lastname is chinese.</p>
<pre>$ rails c
2.2.1 :001 > AuthSource.search(:xxxx)
AuthSource Load (0.4ms) SELECT `auth_sources`.* FROM `auth_sources`
=> [{:dn=>"************", :firstname=>" ", :lastname=>"\xE5\xA7\xAC\xE6\xB5\xB7\xE6\xB6\xB5", :mail=>"****", :auth_source_id=>1, :login=>"xxxx"}]
2.2.1 :002 > AuthSource.search(:xxxx).to_json
AuthSource Load (0.4ms) SELECT `auth_sources`.* FROM `auth_sources`
Encoding::UndefinedConversionError: "\xE5" from ASCII-8BIT to UTF-8
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/core_ext/object/json.rb:34:in `encode'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/core_ext/object/json.rb:34:in `to_json'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/core_ext/object/json.rb:34:in `to_json_with_active_support_encoder'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/json/encoding.rb:57:in `to_json'
from /usr/local/rvm/gems/ruby-2.2.1/gems/json-1.8.3/lib/json/common.rb:223:in `generate'
from /usr/local/rvm/gems/ruby-2.2.1/gems/json-1.8.3/lib/json/common.rb:223:in `generate'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/json/encoding.rb:101:in `stringify'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/json/encoding.rb:35:in `encode'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/json/encoding.rb:22:in `encode'
from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.5/lib/active_support/core_ext/object/json.rb:37:in `to_json_with_active_support_encoder'
from (irb):32
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/console.rb:110:in `start'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/console.rb:9:in `start'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:68:in `console'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'2.2.1 :003 > </pre> Redmine - Defect #21411 (Closed): MySQL 5.7: Mysql2::Error: Expression #1 of ORDER BY clause is n...https://www.redmine.org/issues/214112015-12-03T01:30:42ZHaihan Ji
<pre># ruby script/about
sh: darcs: command not found
sh: hg: command not found
sh: bzr: command not found
Environment:
Redmine version 2.5.2.stable
Ruby version 1.9.3-p545 (2014-02-24) [x86_64-linux]
Rails version 3.2.19
Environment production
Database adapter Mysql2
SCM:
Subversion 1.7.4
Git 1.7.12.4
Filesystem
Redmine plugins:
parent_issue_filter 1.0.1
redmine_code_review 0.7.0
redmine_importer 1.2
redmine_issue_templates 0.0.9
redmine_xls_export 0.2.1</pre>
<p>Upgrade database to MySQL 5.7, login is OK, project overview display '500 Internal Server Error'.</p>
<p><strong>stack trace</strong><br /><pre>Started GET "/naca00/projects/********" for xxx.xxx.xxx.xxx at 2015-11-28 11:47:17 +0800
Processing by ProjectsController#show as HTML
Parameters: {"id"=>"********"}
Current user: ******** (id=280)
Completed 500 Internal Server Error in 10.7ms
ActiveRecord::StatementInvalid (Mysql2::Error: Expression #1 of ORDER BY clause is not in SELECT list, references column 'redmine
.projects.name' which is not in SELECT list; this is incompatible with DISTINCT: SELECT DISTINCT `members`.id FROM `members` LEF
T OUTER JOIN `projects` ON `projects`.`id` = `members`.`project_id` LEFT OUTER JOIN `member_roles` ON `member_roles`.`member_id`
= `members`.`id` LEFT OUTER JOIN `roles` ON `roles`.`id` = `member_roles`.`role_id` WHERE `members`.`user_id` = 280 AND `members`
.`project_id` = 169 AND (projects.status<>9) ORDER BY projects.name LIMIT 1):
app/models/user.rb:464:in `block in membership'
app/models/user.rb:466:in `yield'
app/models/user.rb:466:in `default'
app/models/user.rb:466:in `membership'
app/models/user.rb:479:in `roles_for_project'
app/models/user.rb:538:in `allowed_to?'
app/controllers/application_controller.rb:257:in `authorize'</pre></p>