[openstreetmap/openstreetmap-website] add icon for OSMF membership to user page (#1914)

Andy Allan notifications at github.com
Sat Feb 23 10:22:01 UTC 2019


gravitystorm commented on this pull request.



> +module UserMembershipHelper
+  def membership_icons(user)
+    UserMembership::ALL_MEMBERSHIPS.reduce("".html_safe) do |acc, elem|
+      acc + " " + membership_icon(user, elem)
+    end
+  end
+
+  def membership_icon(user, membership)
+    if user.show_membership?(membership)
+      image = "membership/#{membership}"
+      alt = t("user.view.membership.#{membership}")
+      title = t("user.view.membership.#{membership}")
+      id = "badge-membership-#{membership}"
+    end
+
+    if image

This will always evaluate to true, if the `user.show_membership?` evaluated to true. So I think it would be better to combine the two if statements

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/1914#pullrequestreview-207104809
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190223/f7979a6e/attachment-0001.html>


More information about the rails-dev mailing list