make notifs and follows work for all users
This commit is contained in:
parent
3482e799fd
commit
d87bb7c75c
5 changed files with 22 additions and 24 deletions
|
@ -23,15 +23,15 @@ class UsersController < ApplicationController
|
||||||
if user_params[:password] == '' && user_params[:password_confirmation] == ''
|
if user_params[:password] == '' && user_params[:password_confirmation] == ''
|
||||||
# not trying to change the password
|
# not trying to change the password
|
||||||
if @user.update_attributes(user_params.except(:password, :password_confirmation))
|
if @user.update_attributes(user_params.except(:password, :password_confirmation))
|
||||||
update_follow_settings(@user, params[:settings]) if is_tester(@user)
|
update_follow_settings(@user, params[:settings])
|
||||||
@user.image = nil if params[:remove_image] == '1'
|
@user.image = nil if params[:remove_image] == '1'
|
||||||
@user.save
|
@user.save
|
||||||
sign_in(@user, bypass: true)
|
bypass_sign_in(@user)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to root_url, notice: 'Settings updated' }
|
format.html { redirect_to root_url, notice: 'Settings updated' }
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
sign_in(@user, bypass: true)
|
bypass_sign_in(@user)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to edit_user_path(@user), notice: @user.errors.to_a[0] }
|
format.html { redirect_to edit_user_path(@user), notice: @user.errors.to_a[0] }
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@ class FollowService
|
||||||
class << self
|
class << self
|
||||||
def follow(entity, user, reason)
|
def follow(entity, user, reason)
|
||||||
|
|
||||||
return unless user && is_tester(user)
|
return unless user
|
||||||
|
|
||||||
return if (reason == 'created' || reason == 'contributed') && !should_auto_follow(entity, user, reason)
|
return if (reason == 'created' || reason == 'contributed') && !should_auto_follow(entity, user, reason)
|
||||||
|
|
||||||
|
|
|
@ -45,24 +45,22 @@
|
||||||
<%= form.check_box :emails_allowed, class: 'inline' %>
|
<%= form.check_box :emails_allowed, class: 'inline' %>
|
||||||
Send Metamaps notifications to my email.
|
Send Metamaps notifications to my email.
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if is_tester(@user) %>
|
<%= fields_for :settings, @user.settings do |settings| %>
|
||||||
<%= fields_for :settings, @user.settings do |settings| %>
|
<%= settings.label :follow_topic_on_created, class: 'firstFieldText' do %>
|
||||||
<%= settings.label :follow_topic_on_created, class: 'firstFieldText' do %>
|
<%= settings.check_box :follow_topic_on_created, class: 'inline' %>
|
||||||
<%= settings.check_box :follow_topic_on_created, class: 'inline' %>
|
Auto-follow topics you create.
|
||||||
Auto-follow topics you create.
|
<% end %>
|
||||||
<% end %>
|
<%= settings.label :follow_topic_on_contributed, class: 'firstFieldText' do %>
|
||||||
<%= settings.label :follow_topic_on_contributed, class: 'firstFieldText' do %>
|
<%= settings.check_box :follow_topic_on_contributed, class: 'inline' %>
|
||||||
<%= settings.check_box :follow_topic_on_contributed, class: 'inline' %>
|
Auto-follow topics you edit
|
||||||
Auto-follow topics you edit.
|
<% end %>
|
||||||
<% end %>
|
<%= settings.label :follow_map_on_created, class: 'firstFieldText' do %>
|
||||||
<%= settings.label :follow_map_on_created, class: 'firstFieldText' do %>
|
<%= settings.check_box :follow_map_on_created, class: 'inline' %>
|
||||||
<%= settings.check_box :follow_map_on_created, class: 'inline' %>
|
Auto-follow maps you create.
|
||||||
Auto-follow maps you create.
|
<% end %>
|
||||||
<% end %>
|
<%= settings.label :follow_map_on_contributed, class: 'firstFieldText' do %>
|
||||||
<%= settings.label :follow_map_on_contributed, class: 'firstFieldText' do %>
|
<%= settings.check_box :follow_map_on_contributed, class: 'inline' %>
|
||||||
<%= settings.check_box :follow_map_on_contributed, class: 'inline' %>
|
Auto-follow maps you edit.
|
||||||
Auto-follow maps you edit.
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -38,7 +38,7 @@ class Menu extends Component {
|
||||||
<ul className='menuItems' style={ style }>
|
<ul className='menuItems' style={ style }>
|
||||||
<li className='star' onClick={ () => { this.toggle() && onStar(map) }}>Star Map</li>
|
<li className='star' onClick={ () => { this.toggle() && onStar(map) }}>Star Map</li>
|
||||||
{ !map.authorizeToEdit(currentUser) && <li className='request' onClick={ () => { this.toggle() && onRequest(map) }}>Request Access</li> }
|
{ !map.authorizeToEdit(currentUser) && <li className='request' onClick={ () => { this.toggle() && onRequest(map) }}>Request Access</li> }
|
||||||
{ Util.isTester(currentUser) && <li className='follow' onClick={ () => { this.toggle() && onMapFollow(map) }}>{isFollowing ? 'Unfollow' : 'Follow'}</li> }
|
<li className='follow' onClick={ () => { this.toggle() && onMapFollow(map) }}>{isFollowing ? 'Unfollow' : 'Follow'}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ class ReactTopicCard extends Component {
|
||||||
authorizedToEdit={authorizedToEdit}
|
authorizedToEdit={authorizedToEdit}
|
||||||
updateTopic={wrappedUpdateTopic}
|
updateTopic={wrappedUpdateTopic}
|
||||||
/>
|
/>
|
||||||
{Util.isTester(currentUser) && <Follow isFollowing={isFollowing} onTopicFollow={wrappedTopicFollow} />}
|
<Follow isFollowing={isFollowing} onTopicFollow={wrappedTopicFollow} />
|
||||||
<div className="clearfloat"></div>
|
<div className="clearfloat"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue