Project

General

Profile

Actions

Patch #2576

open

Partially decouple application_helper.rb from Gravatar

Added by Brad Beattie almost 16 years ago. Updated over 15 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
2009-01-24
Due date:
% Done:

0%

Estimated time:

Description

The application_helper.rb directly accesses the Gravatar function by email. I would argue that it would be better to instead use vendor/plugins/gravatar/lib/gravatar.rb's gravatar_for function with the user object.

The situation I have here is that my local instance has modified the Gravatar plugin to use locally stored avatars linked by email address (as dictated by application_helper.rb). Occasionally, users change their email addresses, which requires renaming their avatar files. If the change I proposed was implemented, this local avatar plugin would be doable. Without it, the avatar system is intrinsically tied to email addresses.

I'm not sure what patch formats you prefer, so here's the proposed change:

def avatar(user, options = { })
    if Setting.gravatar_enabled?
      return gravatar_for(user) unless user.mail.blank? rescue nil
    end
  end

Apologies if my syntax is wrong. I'm so very, very new to Ruby.


Files

patch.txt (30.7 KB) patch.txt Brad Beattie, 2009-03-24 22:34
Actions

Also available in: Atom PDF