Commit 52baa4618e5ec6413b1982a5512b9ee2ce3ca24c
1 parent
3b26008f
Exists in
federation-webfinger
Adapt external person attributes and current_user to allow for external login
Showing
23 changed files
with
151 additions
and
76 deletions
Show diff stats
app/concerns/authenticated_system.rb
... | ... | @@ -27,7 +27,7 @@ module AuthenticatedSystem |
27 | 27 | @current_user ||= begin |
28 | 28 | user = nil |
29 | 29 | if session[:external] |
30 | - user = User.new | |
30 | + user = User.new #FIXME: User needs to have at least email | |
31 | 31 | user.external_person_id = session[:external] |
32 | 32 | else |
33 | 33 | id = session[:user] | ... | ... |
app/controllers/my_profile/email_templates_controller.rb
... | ... | @@ -64,7 +64,7 @@ class EmailTemplatesController < ApplicationController |
64 | 64 | private |
65 | 65 | |
66 | 66 | def template_params |
67 | - {:profile_name => current_user.name, :environment_name => environment.name } | |
67 | + {:profile_name => current_person.name, :environment_name => environment.name } | |
68 | 68 | end |
69 | 69 | |
70 | 70 | def template_params_allowed params | ... | ... |
app/controllers/public/profile_controller.rb
... | ... | @@ -176,7 +176,7 @@ class ProfileController < PublicController |
176 | 176 | end |
177 | 177 | |
178 | 178 | def unblock |
179 | - if current_user.person.is_admin?(profile.environment) | |
179 | + if current_person.is_admin?(profile.environment) | |
180 | 180 | profile.unblock |
181 | 181 | session[:notice] = _("You have unblocked %s successfully. ") % profile.name |
182 | 182 | redirect_to :controller => 'profile', :action => 'index' |
... | ... | @@ -187,7 +187,7 @@ class ProfileController < PublicController |
187 | 187 | end |
188 | 188 | |
189 | 189 | def leave_scrap |
190 | - sender = params[:sender_id].nil? ? current_user.person : Person.find(params[:sender_id]) | |
190 | + sender = params[:sender_id].nil? ? current_person : Person.find(params[:sender_id]) | |
191 | 191 | receiver = params[:receiver_id].nil? ? @profile : Person.find(params[:receiver_id]) |
192 | 192 | @scrap = Scrap.new(params[:scrap]) |
193 | 193 | @scrap.sender= sender |
... | ... | @@ -270,7 +270,7 @@ class ProfileController < PublicController |
270 | 270 | |
271 | 271 | def remove_scrap |
272 | 272 | begin |
273 | - scrap = current_user.person.scraps(params[:scrap_id]) | |
273 | + scrap = current_person.scraps(params[:scrap_id]) | |
274 | 274 | scrap.destroy |
275 | 275 | finish_successful_removal 'Scrap successfully removed.' |
276 | 276 | rescue | ... | ... |
app/controllers/public/search_controller.rb
... | ... | @@ -247,7 +247,7 @@ class SearchController < PublicController |
247 | 247 | def visible_profiles(klass, *extra_relations) |
248 | 248 | relations = [:image, :domains, :environment, :preferred_domain] |
249 | 249 | relations += extra_relations |
250 | - if current_user && current_user.person.is_admin? | |
250 | + if current_user && current_person.is_admin? | |
251 | 251 | @environment.send(klass.name.underscore.pluralize).includes(relations) |
252 | 252 | else |
253 | 253 | @environment.send(klass.name.underscore.pluralize).visible.includes(relations) | ... | ... |
app/helpers/application_helper.rb
... | ... | @@ -146,12 +146,12 @@ module ApplicationHelper |
146 | 146 | end |
147 | 147 | |
148 | 148 | def link_to_cms(text, profile = nil, options = {}) |
149 | - profile ||= current_user.login | |
149 | + profile ||= current_person.identifier | |
150 | 150 | link_to text, myprofile_path(:controller => 'cms', :profile => profile), options |
151 | 151 | end |
152 | 152 | |
153 | 153 | def link_to_profile(text, profile = nil, options = {}) |
154 | - profile ||= current_user.login | |
154 | + profile ||= current_person.identifier | |
155 | 155 | link_to text, profile_path(:profile => profile) , options |
156 | 156 | end |
157 | 157 | |
... | ... | @@ -160,7 +160,7 @@ module ApplicationHelper |
160 | 160 | end |
161 | 161 | |
162 | 162 | def link_if_permitted(link, permission = nil, target = nil) |
163 | - if permission.nil? || current_user.person.has_permission?(permission, target) | |
163 | + if permission.nil? || current_person.has_permission?(permission, target) | |
164 | 164 | link |
165 | 165 | else |
166 | 166 | nil |
... | ... | @@ -813,8 +813,8 @@ module ApplicationHelper |
813 | 813 | {s_('contents|More viewed') => {href: url_for({host: host, controller: 'search', action: 'contents', filter: 'more_popular'})}}, |
814 | 814 | {s_('contents|Most commented') => {href: url_for({host: host, controller: 'search', action: 'contents', filter: 'more_comments'})}} |
815 | 815 | ] |
816 | - if logged_in? && !current_user.external_person_id | |
817 | - links.push(_('New content') => modal_options({:href => url_for({:controller => 'cms', :action => 'new', :profile => current_user.login, :cms => true})})) | |
816 | + if logged_in? | |
817 | + links.push(_('New content') => modal_options({:href => url_for({:controller => 'cms', :action => 'new', :profile => current_person.identifier, :cms => true})})) | |
818 | 818 | end |
819 | 819 | |
820 | 820 | link_to(content_tag(:span, _('Contents'), :class => 'icon-menu-articles'), {:controller => "search", :action => 'contents', :category_path => nil}, :id => 'submenu-contents') + |
... | ... | @@ -829,9 +829,9 @@ module ApplicationHelper |
829 | 829 | {s_('people|More active') => {href: url_for({host: host, controller: 'search', action: 'people', filter: 'more_active'})}}, |
830 | 830 | {s_('people|More popular') => {href: url_for({host: host, controller: 'search', action: 'people', filter: 'more_popular'})}} |
831 | 831 | ] |
832 | - if logged_in? && !current_user.external_person_id | |
833 | - links.push(_('My friends') => {:href => url_for({:profile => current_user.login, :controller => 'friends'})}) | |
834 | - links.push(_('Invite friends') => {:href => url_for({:profile => current_user.login, :controller => 'invite', :action => 'friends'})}) | |
832 | + if logged_in? | |
833 | + links.push(_('My friends') => {:href => url_for({:profile => current_person.identifier, :controller => 'friends'})}) | |
834 | + links.push(_('Invite friends') => {:href => url_for({:profile => current_person.identifier, :controller => 'invite', :action => 'friends'})}) | |
835 | 835 | end |
836 | 836 | |
837 | 837 | link_to(content_tag(:span, _('People'), :class => 'icon-menu-people'), {:controller => "search", :action => 'people', :category_path => ''}, :id => 'submenu-people') + |
... | ... | @@ -846,9 +846,9 @@ module ApplicationHelper |
846 | 846 | {s_('communities|More active') => {href: url_for({host: host, controller: 'search', action: 'communities', filter: 'more_active'})}}, |
847 | 847 | {s_('communities|More popular') => {href: url_for({host: host, controller: 'search', action: 'communities', filter: 'more_popular'})}} |
848 | 848 | ] |
849 | - if logged_in? && !current_user.external_person_id | |
850 | - links.push(_('My communities') => {:href => url_for({:profile => current_user.login, :controller => 'memberships'})}) | |
851 | - links.push(_('New community') => {:href => url_for({:profile => current_user.login, :controller => 'memberships', :action => 'new_community'})}) | |
849 | + if logged_in? | |
850 | + links.push(_('My communities') => {:href => url_for({:profile => current_person.identifier, :controller => 'memberships'})}) | |
851 | + links.push(_('New community') => {:href => url_for({:profile => current_person.identifier, :controller => 'memberships', :action => 'new_community'})}) | |
852 | 852 | end |
853 | 853 | |
854 | 854 | link_to(content_tag(:span, _('Communities'), :class => 'icon-menu-community'), {:controller => "search", :action => 'communities'}, :id => 'submenu-communities') + | ... | ... |
app/models/concerns/external_user.rb
... | ... | @@ -49,8 +49,9 @@ module ExternalUser |
49 | 49 | webfinger = OpenStruct.new( |
50 | 50 | identifier: user['user']['person']['identifier'], |
51 | 51 | name: user['user']['person']['name'], |
52 | + created_at: user['user']['person']['created_at'], | |
52 | 53 | domain: domain, |
53 | - email_md5: Digest::MD5.hexdigest(user['user']['email']) | |
54 | + email: user['user']['email'] | |
54 | 55 | ) |
55 | 56 | u.external_person_id = ExternalPerson.get_or_create(webfinger).id |
56 | 57 | return u | ... | ... |
app/models/concerns/profile_entity.rb
... | ... | @@ -35,4 +35,34 @@ module ProfileEntity |
35 | 35 | true |
36 | 36 | end |
37 | 37 | |
38 | + # returns +false+ | |
39 | + def person? | |
40 | + self.kind_of?(Person) | |
41 | + end | |
42 | + | |
43 | + def enterprise? | |
44 | + self.kind_of?(Enterprise) | |
45 | + end | |
46 | + | |
47 | + def organization? | |
48 | + self.kind_of?(Organization) | |
49 | + end | |
50 | + | |
51 | + def community? | |
52 | + self.kind_of?(Community) | |
53 | + end | |
54 | + | |
55 | + include ActionView::Helpers::TextHelper | |
56 | + def short_name(chars = 40) | |
57 | + if self[:nickname].blank? | |
58 | + if chars | |
59 | + truncate self.name, length: chars, omission: '...' | |
60 | + else | |
61 | + self.name | |
62 | + end | |
63 | + else | |
64 | + self[:nickname] | |
65 | + end | |
66 | + end | |
67 | + | |
38 | 68 | end | ... | ... |
app/models/environment.rb
... | ... | @@ -1010,8 +1010,7 @@ class Environment < ApplicationRecord |
1010 | 1010 | end |
1011 | 1011 | |
1012 | 1012 | def has_federated_network?(domain) |
1013 | - # FIXME: Should return whether "domain" is whitelisted in this environment as a federated network | |
1014 | - true | |
1013 | + self.federated_networks.map(&:url).any? {|url| /http[s]?:\/\/#{domain}\/?/ =~ url } | |
1015 | 1014 | end |
1016 | 1015 | |
1017 | 1016 | private | ... | ... |
app/models/external_person.rb
... | ... | @@ -6,7 +6,7 @@ class ExternalPerson < ActiveRecord::Base |
6 | 6 | |
7 | 7 | validates_uniqueness_of :identifier, scope: :source |
8 | 8 | |
9 | - attr_accessible :source, :email_md5_hash | |
9 | + attr_accessible :source, :email, :created_at | |
10 | 10 | |
11 | 11 | def self.get_or_create(webfinger) |
12 | 12 | user = ExternalPerson.find_by(identifier: webfinger.identifier, source: webfinger.domain) |
... | ... | @@ -14,7 +14,8 @@ class ExternalPerson < ActiveRecord::Base |
14 | 14 | user = ExternalPerson.create!(identifier: webfinger.identifier, |
15 | 15 | name: webfinger.name, |
16 | 16 | source: webfinger.domain, |
17 | - email_md5_hash: webfinger.email_md5 | |
17 | + email: webfinger.email, | |
18 | + created_at: webfinger.created_at | |
18 | 19 | ) |
19 | 20 | end |
20 | 21 | user |
... | ... | @@ -24,12 +25,83 @@ class ExternalPerson < ActiveRecord::Base |
24 | 25 | "http://#{self.source}/#{self.identifier}" |
25 | 26 | end |
26 | 27 | |
28 | + alias :public_profile_url :url | |
29 | + | |
27 | 30 | def avatar |
28 | - "http://#{self.source}/plugin/gravatar_provider/h/#{self.email_md5_hash}" | |
31 | + "http://#{self.source}/plugin/gravatar_provider/h/#{Digest::MD5.hexdigest(self.email)}" | |
32 | + end | |
33 | + | |
34 | + def admin_url | |
35 | + "http://#{self.source}/myprofile/#{self.identifier}" | |
36 | + end | |
37 | + | |
38 | + def profile_custom_icon(gravatar_default=nil) | |
39 | + self.avatar | |
29 | 40 | end |
30 | 41 | |
31 | 42 | def preferred_login_redirection |
32 | 43 | environment.redirection_after_login |
33 | 44 | end |
34 | 45 | |
46 | + def person? | |
47 | + true | |
48 | + end | |
49 | + | |
50 | + def is_admin?(environment = nil) | |
51 | + false | |
52 | + end | |
53 | + | |
54 | + def lat | |
55 | + nil | |
56 | + end | |
57 | + def lng | |
58 | + nil | |
59 | + end | |
60 | + | |
61 | + def role_assignments | |
62 | + RoleAssignment.none | |
63 | + end | |
64 | + | |
65 | + def favorite_enterprises | |
66 | + Enterprise.none | |
67 | + end | |
68 | + | |
69 | + def memberships | |
70 | + Profile.none | |
71 | + end | |
72 | + | |
73 | + def friendships | |
74 | + Profile.none | |
75 | + end | |
76 | + | |
77 | + def follows?(profile) | |
78 | + false | |
79 | + end | |
80 | + | |
81 | + def is_a_friend?(person) | |
82 | + false | |
83 | + end | |
84 | + | |
85 | + def already_request_friendship?(person) | |
86 | + false | |
87 | + end | |
88 | + | |
89 | + class ExternalPerson::Image | |
90 | + attr_accessor :path | |
91 | + def initialize(path) | |
92 | + self.path = path | |
93 | + end | |
94 | + def public_filename(size = nil) | |
95 | + self.path | |
96 | + end | |
97 | + | |
98 | + def content_type | |
99 | + 'image/png' | |
100 | + end | |
101 | + end | |
102 | + | |
103 | + def image | |
104 | + ExternalPerson::Image.new(avatar) | |
105 | + end | |
106 | + | |
35 | 107 | end | ... | ... |
app/models/profile.rb
... | ... | @@ -549,23 +549,6 @@ class Profile < ApplicationRecord |
549 | 549 | environment |
550 | 550 | end |
551 | 551 | |
552 | - # returns +false+ | |
553 | - def person? | |
554 | - self.kind_of?(Person) | |
555 | - end | |
556 | - | |
557 | - def enterprise? | |
558 | - self.kind_of?(Enterprise) | |
559 | - end | |
560 | - | |
561 | - def organization? | |
562 | - self.kind_of?(Organization) | |
563 | - end | |
564 | - | |
565 | - def community? | |
566 | - self.kind_of?(Community) | |
567 | - end | |
568 | - | |
569 | 552 | # returns false. |
570 | 553 | def is_validation_entity? |
571 | 554 | false |
... | ... | @@ -803,19 +786,6 @@ private :generate_url, :url_options |
803 | 786 | !forbidden.include?(cat.class) |
804 | 787 | end |
805 | 788 | |
806 | - include ActionView::Helpers::TextHelper | |
807 | - def short_name(chars = 40) | |
808 | - if self[:nickname].blank? | |
809 | - if chars | |
810 | - truncate self.name, length: chars, omission: '...' | |
811 | - else | |
812 | - self.name | |
813 | - end | |
814 | - else | |
815 | - self[:nickname] | |
816 | - end | |
817 | - end | |
818 | - | |
819 | 789 | def custom_header |
820 | 790 | self[:custom_header] || environment && environment.custom_header |
821 | 791 | end | ... | ... |
app/models/user.rb
app/views/account/welcome.html.erb
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | <%= _('%s was successfuly activated. Now you may go to your control panel or to the control panel of your enterprise') % @enterprise.name %> |
5 | 5 | |
6 | 6 | <%= button_bar do %> |
7 | - <%= button 'forward', _('Go to my control panel'), :action => 'index', :controller => 'profile_editor', :profile => current_user.person.identifier %> | |
7 | + <%= button 'forward', _('Go to my control panel'), :action => 'index', :controller => 'profile_editor', :profile => current_person.identifier %> | |
8 | 8 | <%= button 'forward', _('Go to my enterprise control panel') % @enterprise.name, :action => 'index', :controller => 'profile_editor', :profile => @enterprise.identifier %> |
9 | 9 | <% end %> |
10 | 10 | <% end %> | ... | ... |
app/views/enterprise_registration/basic_information.html.erb
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | </div> |
10 | 10 | |
11 | 11 | <%= button_bar do %> |
12 | - <%= button :back, _('Go back'), { :profile => current_user.person.identifier, :action=>"enterprises", :controller=>"profile" }%> | |
12 | + <%= button :back, _('Go back'), { :profile => current_person.identifier, :action=>"enterprises", :controller=>"profile" }%> | |
13 | 13 | <% end %> |
14 | 14 | <% else %> |
15 | 15 | <div class='atention'> |
... | ... | @@ -37,7 +37,7 @@ |
37 | 37 | <%= template_options(:enterprises, 'create_enterprise')%> |
38 | 38 | |
39 | 39 | <%= button_bar do %> |
40 | - <%= submit_button('next', _('Next'), :cancel => {:profile => current_user.person.identifier, :action=>"enterprises", :controller=>"profile"}) %> | |
40 | + <%= submit_button('next', _('Next'), :cancel => {:profile => current_person.identifier, :action=>"enterprises", :controller=>"profile"}) %> | |
41 | 41 | <% end %> |
42 | 42 | <% end %> |
43 | 43 | <% end %> | ... | ... |
app/views/environment_role_manager/affiliate.html.erb
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | |
3 | 3 | <%= form_tag( {:action => 'give_role'}, {:method => :post}) do %> |
4 | 4 | <%= select_tag 'role', options_for_select(@roles.map{|r|[r.name,r.id]}) %> |
5 | - <%= hidden_field_tag 'person', current_user.person.id %> | |
5 | + <%= hidden_field_tag 'person', current_person.id %> | |
6 | 6 | <%= button_bar do %> |
7 | 7 | <%= submit_button('affiliate', _('Affiliate', :cancel => {:action => 'index'}) %> |
8 | 8 | <% end %> | ... | ... |
app/views/layouts/_user.html.erb
app/views/profile_members/affiliate.html.erb
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | |
3 | 3 | <%= form_tag( {:action => 'give_role'}, {:method => :post}) do %> |
4 | 4 | <%= select_tag 'role', options_for_select(@roles.map{|r|[r.name,r.id]}) %> |
5 | - <%= hidden_field_tag 'person', current_user.person.id %> | |
5 | + <%= hidden_field_tag 'person', current_person.id %> | |
6 | 6 | <%= button_bar do %> |
7 | 7 | <%= submit_button('affiliate', _('Affiliate'), :cancel => {:action => 'index'}) %> |
8 | 8 | <% end %> | ... | ... |
db/migrate/20160420140141_create_external_person.rb
... | ... | @@ -4,9 +4,11 @@ class CreateExternalPerson < ActiveRecord::Migration |
4 | 4 | t.string :name |
5 | 5 | t.string :identifier |
6 | 6 | t.string :source |
7 | - t.string :email_md5_hash | |
7 | + t.string :email | |
8 | 8 | t.integer :environment_id |
9 | 9 | t.boolean :visible, default: true |
10 | + t.datetime :created_at | |
11 | + t.datetime :updated_at | |
10 | 12 | end |
11 | 13 | end |
12 | 14 | end | ... | ... |
plugins/organization_ratings/controllers/organization_ratings_plugin_profile_controller.rb
... | ... | @@ -38,7 +38,7 @@ class OrganizationRatingsPluginProfileController < ProfileController |
38 | 38 | |
39 | 39 | def create_new_rate |
40 | 40 | @rating = OrganizationRating.new(params[:organization_rating]) |
41 | - @rating.person = current_user.person | |
41 | + @rating.person = current_person | |
42 | 42 | @rating.organization = profile |
43 | 43 | @rating.value = params[:organization_rating_value] if params[:organization_rating_value] |
44 | 44 | ... | ... |
plugins/organization_ratings/views/organization_ratings_plugin_profile/_new_rating_fields.html.erb
... | ... | @@ -9,11 +9,11 @@ |
9 | 9 | |
10 | 10 | <div class="star-profile-information"> |
11 | 11 | <div class="star-profile-image"> |
12 | - <%= link_to profile_image(current_user.person, :portrait), current_user.person.url %> | |
12 | + <%= link_to profile_image(current_person, :portrait), current_person.url %> | |
13 | 13 | </div> |
14 | 14 | |
15 | 15 | <div class="star-profile-name"> |
16 | - <%= link_to current_user.person.name, current_user.person.url %> | |
16 | + <%= link_to current_person.name, current_person.url %> | |
17 | 17 | </div> |
18 | 18 | </div> |
19 | 19 | |
... | ... | @@ -59,14 +59,14 @@ |
59 | 59 | </div> |
60 | 60 | <% elsif env_organization_ratings_config.vote_once %> |
61 | 61 | <div class="star-rate-form rating-vote-once"> |
62 | - <%= _("Hi, %s! The administrators set that you can vote") % current_user.name %> | |
62 | + <%= _("Hi, %s! The administrators set that you can vote") % current_person.name %> | |
63 | 63 | <strong><%= _("only once") %></strong> |
64 | 64 | <%= _("for this %s.") % profile.class.name.downcase %> |
65 | 65 | <%= render :partial => 'shared/rating_button', :locals => { :disabled => true } %> |
66 | 66 | </div> |
67 | 67 | <% else %> |
68 | 68 | <div class="star-rate-form rating-cooldown"> |
69 | - <%= _("Hi, %s! The administrators set the minimum time of") % current_user.name %> | |
69 | + <%= _("Hi, %s! The administrators set the minimum time of") % current_person.name %> | |
70 | 70 | <strong><%= _("%d hour(s)") % env_organization_ratings_config.cooldown %></strong> |
71 | 71 | <%= _("between each evaluation.") %> |
72 | 72 | ... | ... |
plugins/organization_ratings/views/shared/_make_report_block.html.erb
1 | -<% logged_in_image = link_to profile_image(current_user.person, :portrait), current_user.person.url if current_user %> | |
2 | -<% logged_in_name = link_to current_user.person.name, current_user.person.url if current_user %> | |
1 | +<% logged_in_image = link_to profile_image(current_person, :portrait), current_person.url if current_user %> | |
2 | +<% logged_in_name = link_to current_person.name, current_person.url if current_user %> | |
3 | 3 | <% logged_out_image = image_tag('plugins/organization_ratings/public/images/user-not-logged.png') %> |
4 | 4 | |
5 | 5 | <div class="make-report-block"> |
... | ... | @@ -26,4 +26,4 @@ |
26 | 26 | </div> |
27 | 27 | <% end %> |
28 | 28 | </div> |
29 | -</div> | |
30 | 29 | \ No newline at end of file |
30 | +</div> | ... | ... |
plugins/responsive/lib/ext/application_helper.rb
... | ... | @@ -140,7 +140,7 @@ module ApplicationHelper |
140 | 140 | [s_('contents|Most commented'), {host: host, controller: :search, action: :contents, filter: 'more_comments'}], |
141 | 141 | ] |
142 | 142 | if logged_in? |
143 | - links.push [_('New content'), '', modal_options({href: url_for({controller: 'cms', action: 'new', profile: current_user.login, cms: true})})] | |
143 | + links.push [_('New content'), '', modal_options({href: url_for({controller: 'cms', action: 'new', profile: current_person.identifier, cms: true})})] | |
144 | 144 | end |
145 | 145 | |
146 | 146 | content_tag :li, class: 'dropdown' do |
... | ... | @@ -170,8 +170,8 @@ module ApplicationHelper |
170 | 170 | [s_('people|More popular'), {host: host, controller: :search, action: :people, filter: 'more_popular'}], |
171 | 171 | ] |
172 | 172 | if logged_in? |
173 | - links.push [_('My friends'), {profile: current_user.login, controller: 'friends'}] | |
174 | - links.push [_('Invite friends'), {profile: current_user.login, controller: 'invite', action: 'friends'}] | |
173 | + links.push [_('My friends'), {profile: current_person.identifier, controller: 'friends'}] | |
174 | + links.push [_('Invite friends'), {profile: current_person.identifier, controller: 'invite', action: 'friends'}] | |
175 | 175 | end |
176 | 176 | |
177 | 177 | content_tag :li, class: 'dropdown' do |
... | ... | @@ -201,8 +201,8 @@ module ApplicationHelper |
201 | 201 | [s_('communities|More popular'), {host: host, controller: :search, action: :communities, filter: 'more_popular'}], |
202 | 202 | ] |
203 | 203 | if logged_in? |
204 | - links.push [_('My communities'), {profile: current_user.login, controller: 'memberships'}] | |
205 | - links.push [_('New community'), {profile: current_user.login, controller: 'memberships', action: 'new_community'}] | |
204 | + links.push [_('My communities'), {profile: current_person.identifier, controller: 'memberships'}] | |
205 | + links.push [_('New community'), {profile: current_person.identifier, controller: 'memberships', action: 'new_community'}] | |
206 | 206 | end |
207 | 207 | |
208 | 208 | content_tag :li, class: 'dropdown' do | ... | ... |
plugins/sniffer/views/blocks/interests.html.erb
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | </ul> |
9 | 9 | |
10 | 10 | <div> |
11 | - <% if logged_in? and (current_user.person.is_admin?(environment) or profile.admins.include?(current_user.person)) %> | |
11 | + <% if logged_in? and (current_person.is_admin?(environment) or profile.admins.include?(current_person)) %> | |
12 | 12 | <%= _('Edit %{inputs} and %{block.interests}') % { |
13 | 13 | :inputs => link_to(_("products' inputs"), :controller => :manage_products, :action => :index), |
14 | 14 | :interests => link_to(_('declared interests'), :controller => :sniffer_plugin_myprofile, :action => :edit), | ... | ... |
plugins/solr/lib/solr_plugin/search_helper.rb
... | ... | @@ -12,9 +12,9 @@ module SolrPlugin::SearchHelper |
12 | 12 | :products => ActiveSupport::OrderedHash[ :none, {:label => _('Relevance')}, |
13 | 13 | :more_recent, {:label => c_('More recent'), :solr_opts => {:sort => 'updated_at desc, score desc'}}, |
14 | 14 | :name, {:label => _('Name'), :solr_opts => {:sort => 'solr_plugin_name_sortable asc'}}, |
15 | - :closest, {:label => _('Closest to me'), :if => proc{ logged_in? && (profile=current_user.person).lat && profile.lng }, | |
15 | + :closest, {:label => _('Closest to me'), :if => proc{ logged_in? && (profile=current_person).lat && profile.lng }, | |
16 | 16 | :solr_opts => {:sort => "geodist() asc", |
17 | - :latitude => proc{ current_user.person.lat }, :longitude => proc{ current_user.person.lng }}}, | |
17 | + :latitude => proc{ current_person.lat }, :longitude => proc{ current_person.lng }}}, | |
18 | 18 | ], |
19 | 19 | :events => ActiveSupport::OrderedHash[ :none, {:label => _('Relevance')}, |
20 | 20 | :name, {:label => _('Name'), :solr_opts => {:sort => 'solr_plugin_name_sortable asc'}}, | ... | ... |