Local avatars Plugin v.0.0.1
Added by Andrew Chaika over 15 years ago
I use Redmine in intranet, and can't register corporate emails in gravatar.
Because of it I decide to make this plugin.
- Avatars can be changed only by administrator for any user (Avatar Tab)
- No modifications or restrictions on avatar size
- No settings to disable avatars
- Avatars can't be deleted once uploaded, only replaced
Replies (51)
RE: Local avatars Plugin v.0.0.1 - Added by Tim Aleinikoff over 15 years ago
Thank you, Andrew.
I use your issues_group plugin on trunk version. It works nice, but local_avatars call Internal error in my redmine.
Do you test it on Redmine 0.8.0.devel.2670 or subsequent?
RE: Local avatars Plugin v.0.0.1 - Added by Andrew Chaika over 15 years ago
There are 0.0.2 version, it works well on trunk and stable branches of Redmine.
RE: Local avatars Plugin v.0.0.1 - Added by Tim Aleinikoff over 15 years ago
thanx, for your quick replay.
I test 0.0.2 version and receive similar error.
Do you can assume wtf happens?
My plugins list:
Customer plugin
Redmine Issues Group plugin
Redmine My Widgets plugin
There are not modifications in redmine source code.
RE: Local avatars Plugin v.0.0.1 - Added by Andrew Chaika over 15 years ago
Tim Aleinikoff wrote:
thanx, for your quick replay.
I test 0.0.2 version and receive similar error.
Can you post log part with error?
RE: Local avatars Plugin v.0.0.1 - Added by Tim Aleinikoff over 15 years ago
=) RTFLogs.
Thank you, i had found soution in log file.
/!\ FAILSAFE /!\ Wed Apr 22 11:20:21 +0400 2009 Status: 500 Internal Server Error A secret is required to generate an integrity hash for cookie session data. Use config.action_controller.session = { :session_key => "_myapp_session", :secret => "some secret phrase of at least 30 characters" } in config/environment.rb
After adding
config.action_controller.session = { :session_key => "_myapp_session", :secret => "some secret phrase of at least 30 characters" }
redmine successfully started, but =)
on page http://hostname/users i had receive error
ActionView::TemplateError (undefined method `attachments' for #<User:0xb6fde8bc>) on line #32 of app/views/users/list.rhtml: 29: <tbody> 30: <% for user in @users -%> 31: <tr class="user <%= cycle("odd", "even") %> <%= %w(anon active registered locked)[user.status] %>"> 32: <td class="username"><%= avatar(user, :size => "14") %><%= link_to h(user.login), :action => 'edit', :id => user %></td> 33: <td class="firstname"><%= h(user.firstname) %></td> 34: <td class="lastname"><%= h(user.lastname) %></td> 35: <td class="email"><%= mail_to(h(user.mail)) %></td>
RE: Local avatars Plugin v.0.0.1 - Added by Andrew Chaika over 15 years ago
I think that in production environment It will work :)
I suppose, that the problem is within disabled classes caching in development environment, Rails reload classes but forget about reloading my plugin patches to them, restart server and reload error page, it will work only for first request.
There are related settings for environment (plugin should work with them):
config.cache_classes = true config.action_controller.perform_caching = true
RE: Local avatars Plugin v.0.0.1 - Added by Tim Aleinikoff over 15 years ago
Andrew Chaika wrote:
I think that in production environment It will work :)
I suppose, that the problem is within disabled classes caching in development environment, Rails reload classes but forget about reloading my plugin patches to them, restart server and reload error page, it will work only for first request.
There are related settings for environment (plugin should work with them):
[...]
My problem had been solved. Thank you.
Can I talk to you in Russian? English language is good, but it isn't easy for me =).
I have another question.
RE: Local avatars Plugin v.0.0.1 - Added by Andrew Chaika over 15 years ago
Tim Aleinikoff wrote:
Can I talk to you in Russian? English language is good, but it isn't easy for me =).
I have another question.
Да, конечно
RE: Local avatars Plugin v.0.0.2 - Added by Victor Torres over 15 years ago
Hello Andrew,
First of all,thanks for sharing this plugin. It sounds very good. I say it sounds because it is not working for me, but I cant seem to find anyone with the same problem.
Right now, I am to the point where I click on save to send the avatar file (a jpg file in this case), and I get a successful message, but the avatar is not recorded.
I have checked the steps of the process, and I can see where the file is stored on the server (and it is there), but the attach_file operation doesn't seem to create the entry in the attachments table.
I tried different redmine modules that store data on that table (like documents, files, etc.) and they all work.
The only difference I see is the location of the file, but I don't believe that is the problem.
I also dont know why it doesn't report any issues when trying to create the entry on the table.
Any ideas?
RE: Local avatars Plugin v.0.0.1 - Added by Markus Knittig over 15 years ago
Andrew, can you upload this plugin on GitHub? Thanks...
RE: Local avatars Plugin v.0.0.1 - Added by Andrew Chaika over 15 years ago
Markus Knittig wrote:
Andrew, can you upload this plugin on GitHub? Thanks...
I have uploaded this plugin to GitHub - http://github.com/Ubik/redmine_local_avatars/tree/master
RE: Local avatars Plugin v.0.0.1 - Added by Markus Knittig over 15 years ago
Thanks. Unfortunaly I get an error:
Status: 500 Internal Server Error A secret is required to generate an integrity hash for cookie session data. Use config.action_controller.session = { :session_key => "_myapp_session", :secret => "some secret phrase of at least 30 characters" } in config/environment.rb
Everything works fine without the plugin...
RE: Local avatars Plugin v.0.0.1 - Added by Jens Goldhammer over 15 years ago
Please look at the post of Tim above. He describes the solution of that error.
RE: Local avatars Plugin v.0.0.1 - Added by Charles Martin over 15 years ago
Hi Andrew,
We've been using your avatar plugin here for a couple of days, and noticed that only administrators could view the avatars.
Turns out the require_admin filter was also run before sending the avatar to the browser.
This simple addition to users_controllers.rb in your plugin did the trick :
before_filter :require_admin, :except => [:get_avatar]
There might even be a clearer way to remove the filter, I'm not very fluent with rails
Thanks again!
RE: Local avatars Plugin v.0.0.1 - Added by Chris Ligon over 15 years ago
I've noticed this too. I am not proficient at ruby so, could you tell me where exactly would this line of code go in users_controller.rb? Thanks.
RE: Local avatars Plugin v.0.0.1 - Added by Chris Ligon over 15 years ago
There are only so many places to put the code. ;) I figured it out.
RE: Local avatars Plugin v.0.0.1 - Added by Jay Rowe over 15 years ago
Please share the location for this:
before_filter :require_admin, :except => [:get_avatar]
I have the same issue but haven't gotten it right yet.
Thanks.
RE: Local avatars Plugin v.0.0.1 - Added by Charles Martin over 15 years ago
In file vendor/plugins/redmine_local_avatars/app/controllers/users_controller.rb
Insert the provided line at line 6, so it looks like :
class UsersController < ApplicationController
before_filter :require_admin, :except => [:get_avatar]
helper :attachments
RE: Local avatars Plugin v.0.0.1 - Added by Jay Rowe over 15 years ago
Thank you very much, works like a charm.
BTW - http://www.gamedition.com/31/Avatar_Creator quick and easy avatar creation.
Jay
RE: Local avatars Plugin v.0.0.1 - Added by Paul paul over 15 years ago
A minor point - For some reason the title of the tab is "label_avatar" (and the same name repeated underneath). Using v.0.0.2
How do I change it to say "Avatars" or whatever it's supposed to say?
thanks!
RE: Local avatars Plugin v.0.0.1 - Added by Strubbl Master over 15 years ago
you're using a language which is noch english or russian. just go to the plugins config/locales dir and copy the en.yml to yourlang.yml and edit analog to the en.yml.
for german (de.yml) it worked for me :)
RE: Local avatars Plugin v.0.0.1 - Added by Alexey Lustin about 15 years ago
in r2887 Redmine migrate to Rails 2.3.4
the plugin are not compartible with it because http://afreshcup.com/2008/11/17/rails-2x-the-death-of-applicationrb/
thats why have an exception after update redmine
the error looks like this
$script/about RAILS_ENV='production' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- application (MissingSourceFile) from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' ...
the patch what fix this:
lib/users_avatar_patch.rb | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/users_avatar_patch.rb b/lib/users_avatar_patch.rb index a07a9c0..2443a77 100644 --- a/lib/users_avatar_patch.rb +++ b/lib/users_avatar_patch.rb @@ -1,4 +1,4 @@ -require 'application' +require 'application_controller' #require 'user' module LocalAvatarsPlugin
RE: Local avatars Plugin v.0.0.1 - Added by Jérémy Lal about 15 years ago
I tried the plugin version 0.0.2 against redmine trunk (before rails 2.3.4 migration), and i get this when i start redmine with webrick :
=> Booting WEBrick... /usr/share/redmine/vendor/rails/activesupport/lib/active_support/dependencies.rb:428:in `load_missing_constant': Expected /usr/share/redmine/app/models/user.rb to define User (LoadError)
Tell me if you want the full stack trace.
Spam removed - Added by AAlibFoviblebam AAlibFoviblebam about 15 years ago
Spam removed by Mischa The Evil.
RE: Local avatars Plugin v.0.0.1 - Added by Tyler Mulligan about 15 years ago
Has anyone gotten this working for r3009+ ? I'm getting a 500 internal server error when I try to upload the avatars.
NoMethodError (undefined method `original_filename' for "z.gif":String): app/models/attachment.rb:58:in `file=' app/controllers/application_controller.rb:199:in `attach_files' app/controllers/application_controller.rb:196:in `each_value' app/controllers/application_controller.rb:196:in `attach_files' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/rack/request_handler.rb:81:in `process_request' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_request_handler.rb:203:in `main_loop' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/railz/application_spawner.rb:340:in `start_request_handler' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/railz/application_spawner.rb:298:in `handle_spawn_application' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/utils.rb:181:in `safe_fork' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/railz/application_spawner.rb:296:in `handle_spawn_application' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:337:in `__send__' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:337:in `main_loop' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:187:in `start_synchronously' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:154:in `start' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/railz/application_spawner.rb:192:in `start' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:257:in `spawn_rails_application' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:251:in `spawn_rails_application' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:250:in `spawn_rails_application' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:153:in `spawn_application' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:282:in `handle_spawn_application' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:337:in `__send__' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:337:in `main_loop' /var/lib/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:187:in `start_synchronously'