Recommendations are automatically disabled if dismissed by user

This commit is contained in:
Angel Perez
2018-07-11 21:45:28 -04:00
parent 0b7967440f
commit 463c753880
12 changed files with 74 additions and 19 deletions

View File

@@ -44,6 +44,14 @@ class DebatesController < ApplicationController
redirect_to request.query_parameters.merge(action: :index)
end
def disable_recommendations
if current_user.update(recommended_debates: false)
redirect_to debates_path, notice: t('debates.index.recommendations.actions.success')
else
redirect_to debates_path, error: t('debates.index.recommendations.actions.error')
end
end
private
def debate_params

View File

@@ -80,6 +80,14 @@ class ProposalsController < ApplicationController
@tag_cloud = tag_cloud
end
def disable_recommendations
if current_user.update(recommended_proposals: false)
redirect_to proposals_path, notice: t('proposals.index.recommendations.actions.success')
else
redirect_to proposals_path, error: t('proposals.index.recommendations.actions.error')
end
end
private
def proposal_params