Compatibility with redmine 2.0

Bug #1010406 reported by Alexey Slynko
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Redmine Local Avatars Plugin
New
High
Luca Pireddu

Bug Description

This patch implement compatibility with redmine 2.0

Revision history for this message
Alexey Slynko (slynko) wrote :
Revision history for this message
Luca Pireddu (pireddu) wrote :

Thanks for the patch Alexey. Does it affect backwards compatibility to older versions of Redmine?

Changed in redminelocalavatars:
importance: Undecided → High
assignee: nobody → Luca Pireddu (pireddu)
Revision history for this message
Alexey Slynko (slynko) wrote :

I think, it incompatible with earlier Redmine versions

Revision history for this message
Ivan Cenov (i-cenov) wrote :

Hi,

I applied the patch of Alexey Slynco; generally, it works but when I press 'Profile' link, it raises Internal server error. Here is the log:

Started GET "/my/account" for 192.168.2.100 at Fri Jun 29 19:05:30 +0300 2012
Processing by MyController#account as HTML
  Rendered my/account.html.erb within layouts/base (156.2ms)
Completed 500 Internal Server Error in 297ms

ActionView::Template::Error (Missing partial hooks/redmine_local_avatars/view_my_account_contextual with {:handlers=>[:b
uilder, :rsb, :erb, :rjs], :formats=>[:html], :locale=>[:bg, :en]}. Searched in:
  * "D:/biz/apps/redmine_trunk/plugins/redmine_theme_changer/app/views"
  * "D:/biz/apps/redmine_trunk/plugins/redmine_local_avatars/app/views"
  * "D:/biz/apps/redmine_trunk/plugins/redmine_knowledgebase/app/views"
  * "D:/biz/apps/redmine_trunk/plugins/redmine_code_review/app/views"
  * "D:/biz/apps/redmine_trunk/plugins/projects_tree_view/app/views"
  * "D:/biz/apps/redmine_trunk/app/views"
):
    1: <div class="contextual">
    2: <%= link_to(l(:button_change_password), {:action => 'password'}, :class => 'icon icon-passwd') if @user.change_pa
ssword_allowed? %>
    3: <%= call_hook(:view_my_account_contextual, :user => @user)%>
    4: </div>
    5:
    6: <h2><%=l(:label_my_account)%></h2>
  lib/redmine/hook.rb:111:in `send'
  lib/redmine/hook.rb:111:in `view_my_account_contextual'
  lib/redmine/hook.rb:61:in `send'
  lib/redmine/hook.rb:61:in `call_hook'
  lib/redmine/hook.rb:61:in `each'
  lib/redmine/hook.rb:61:in `call_hook'
  lib/redmine/hook.rb:58:in `tap'
  lib/redmine/hook.rb:58:in `call_hook'
  lib/redmine/hook.rb:158:in `call_hook'
  app/views/my/account.html.erb:3:in `_app_views_my_account_html_erb___296452356_49987416'

Revision history for this message
Mathias Schreiber (mathias-schreiber) wrote :

This part of the bug is related to the fact that you need to rename the files in the app/views/ folder to [partialname].html.erb (don't forget to restart redmine).

So far to good, but now I run into another error that says that the method "include" is not defined.

Help is highly appreciated.

Revision history for this message
dave1822 (dhoelker) wrote :

i have the same Problem like Ivan... plz help....

Revision history for this message
Soonoh (chk0ndanger) wrote :

> "include" is not defined

lib/my_controller_patch.rb (comment render line)

#render :partial => 'users/avatar', :layout => false

I fixed "[partialname].html.erb" and..

app/views/users/_avatar.html.erb (add "=" before form_tag)

<%= form_tag( { :action => 'save_avatar', :id => @user }, :multipart => true) do %>

cp app/views/users/_avatar.html.erb app/views/my/avatar.html.erb

Revision history for this message
Luca Pireddu (pireddu) wrote :

Hello fellows,

I don't have time to look into this at the moment. Would you like to submit a patch? If you provide me a tested patch I would be willing to apply it to the plugin's development branch.

Revision history for this message
konstantin (saip07) wrote :

Tried patch redmine_local_avatar on redmine 2.0.3, but it doesn't work, who can help?

Revision history for this message
Ivan Cenov (i-cenov) wrote :

After applying the patches from comment #7 things go alright now.

Revision history for this message
Ashwin (imdx) wrote :
Revision history for this message
Luca Pireddu (pireddu) wrote :

I looked at the archive Ashwin attached and compared it to the development trunk (rev 26):

[pireddu@pear tmp] diff -rq redmine_local_avatars-0.1.1 ../redminelocalavatars/
Only in ../redminelocalavatars/: .bzr
Only in ../redminelocalavatars/config/locales: bg.yml
Only in ../redminelocalavatars/config/locales: es.yml
Only in ../redminelocalavatars/config/locales: ru.yml
Only in ../redminelocalavatars/config/locales: zh-TW.yml
Only in ../redminelocalavatars/config/locales: zh.yml
Only in ../redminelocalavatars/config: routes.rb

That archive only removes a number of locales and the routes.

I've applied Alexey Slynko's patch from comment #1 and pushed rev 27 to the development branch.

Regarding the changes suggested by Soonoh in comment #7, if you comment out the render call for the partial "users/avatar" does the avatar still get rendered? I've applied the other changes suggested in the same comment. I've also renamed app/views/hooks/redmine_local_avatars/_view_my_account_contextual.rhtml to end with .erb.html.

Please test...

Revision history for this message
Ashwin (imdx) wrote :

With rev. 28 I get:

 ActionView::Template::Error (Missing partial users/avatar with {:handlers=>[:rjs, :erb, :rsb, :builder], :locale=>[:nl, :en], :formats=>[:html]}. Searched in:
   * "/usr/share/redmine-2.0/plugins/redmine_local_avatars/app/views"
   * "/usr/share/redmine-2.0/plugins/redmine_issue_history_tabs/app/views"
   * "/usr/share/redmine-2.0/plugins/redmine_inline_attach_screenshot/app/views"
   * "/usr/share/redmine-2.0/plugins/redmine_dmsf/app/views"
   * "/usr/share/redmine-2.0/app/views"
 ):
  21: </script>
  22:
  23: <% tabs.each do |tab| -%>
  24: <%= content_tag('div', render(:partial => tab[:partial], :locals => {:tab => tab} ),
  25: :id => "tab-content-#{tab[:name]}",
  26: :style => (tab[:name] != selected_tab ? 'display:none' : nil),
  27: :class => 'tab-content') %>
   app/views/common/_tabs.html.erb:24:in `_app_views_common__tabs_html_erb___367283638_70145606982060'
   app/views/common/_tabs.html.erb:23:in `each'
   app/views/common/_tabs.html.erb:23:in `_app_views_common__tabs_html_erb___367283638_70145606982060'
   app/helpers/application_helper.rb:231:in `render_tabs'
   app/views/users/edit.html.erb:9:in `_app_views_users_edit_html_erb__300962180_70145611415480'

This is due to the missing app/views/users/avatar.html.erb

The same error for my/avatar

Revision history for this message
Luca Pireddu (pireddu) wrote :

Hi Ashwin,

so are you saying that to work with redmine 2 I need to rename the partial
  app/views/users/_avatar.erb.html
to
  app/views/users/avatar.erb.html ?

Thanks for testing.

Revision history for this message
Ashwin (imdx) wrote :

Yes thats works for me

Revision history for this message
unsicherheitsagent (sven-eisenschmidt) wrote :
Download full text (5.1 KiB)

Thank you for the patch. Everything works except editing a user as a admin. There is a attachement not exist error.

Started GET "/redmine-test/users/1/edit" for 192.168.0.134 at Fri Sep 28 12:04:42 +0200 2012
Processing by UsersController#edit as HTML
  Parameters: {"id"=>"1"}
  Setting Load (2.6ms) SELECT `settings`.* FROM `settings` WHERE `settings`.`name` = 'session_lifetime' LIMIT 1
  Setting Load (0.2ms) SELECT `settings`.* FROM `settings` WHERE `settings`.`name` = 'session_timeout' LIMIT 1
   (0.2ms) SELECT MAX(`settings`.`updated_on`) AS max_id FROM `settings`
  User Load (17.8ms) SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`id` = ? AND (users.status = 1) LIMIT 1 [["id", 1]]
  Current user: admin (id=1)
  User Load (0.7ms) SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`id` = ? LIMIT 1 [["id", "1"]]
  AuthSource Load (0.2ms) SELECT `auth_sources`.* FROM `auth_sources`
  Group Load (0.7ms) SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('Group')
  Setting Load (16.0ms) SELECT `settings`.* FROM `settings` WHERE `settings`.`name` = 'openid' LIMIT 1
  CustomField Load (0.4ms) SELECT `custom_fields`.* FROM `custom_fields` WHERE (type = 'UserCustomField') ORDER BY position
  Setting Load (0.2ms) SELECT `settings`.* FROM `settings` WHERE `settings`.`name` = 'password_min_length' LIMIT 1
  SQL (0.6ms) SELECT `members`.`id` AS t0_r0, `members`.`user_id` AS t0_r1, `members`.`project_id` AS t0_r2, `members`.`created_on` AS t0_r3, `members`.`mail_notification` AS t0_r4, `projects`.`id` AS t1_r0, `projects`.`name` AS t1_r1, `projects`.`description` AS t1_r2, `projects`.`homepage` AS t1_r3, `projects`.`is_public` AS t1_r4, `projects`.`parent_id` AS t1_r5, `projects`.`created_on` AS t1_r6, `projects`.`updated_on` AS t1_r7, `projects`.`identifier` AS t1_r8, `projects`.`status` AS t1_r9, `projects`.`lft` AS t1_r10, `projects`.`rgt` AS t1_r11, `roles`.`id` AS t2_r0, `roles`.`name` AS t2_r1, `roles`.`position` AS t2_r2, `roles`.`assignable` AS t2_r3, `roles`.`builtin` AS t2_r4, `roles`.`permissions` AS t2_r5, `roles`.`issues_visibility` AS t2_r6 FROM `members` LEFT 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` = 1 AND (projects.status<>9) ORDER BY projects.name
   (0.3ms) SELECT COUNT(*) FROM `projects` INNER JOIN `members` ON `projects`.`id` = `members`.`project_id` WHERE `members`.`user_id` = 1 AND (projects.status<>9)
  Project Load (0.2ms) SELECT `projects`.* FROM `projects` INNER JOIN `members` ON `projects`.`id` = `members`.`project_id` WHERE `members`.`user_id` = 1 AND (projects.status<>9)
  UserPreference Load (0.1ms) SELECT `user_preferences`.* FROM `user_preferences` WHERE `user_preferences`.`user_id` = 1 LIMIT 1
  Rendered users/_mail_notifications.html.erb (376.5ms)
  Rendered users/_preferences.html.erb (440.2ms)
  Rendered users/_form.html.erb (1014.7ms)
  Rendered users/_general.html.erb (1024.5ms)
  Role Load (1.4ms) SELECT `roles`.*...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.