Fix linelenght over 100 on multiple files

This commit is contained in:
Bertocq
2018-01-26 00:27:03 +01:00
parent 34b2a27357
commit 070c94494e
4 changed files with 33 additions and 19 deletions

View File

@@ -44,11 +44,13 @@ class CommentsController < ApplicationController
private
def comment_params
params.require(:comment).permit(:commentable_type, :commentable_id, :parent_id, :body, :as_moderator, :as_administrator)
params.require(:comment).permit(:commentable_type, :commentable_id, :parent_id,
:body, :as_moderator, :as_administrator)
end
def build_comment
@comment = Comment.build(@commentable, current_user, comment_params[:body], comment_params[:parent_id].presence)
@comment = Comment.build(@commentable, current_user, comment_params[:body],
comment_params[:parent_id].presence)
check_for_special_comments
end
@@ -61,30 +63,32 @@ class CommentsController < ApplicationController
end
def load_commentable
@commentable = Comment.find_commentable(comment_params[:commentable_type], comment_params[:commentable_id])
@commentable = Comment.find_commentable(comment_params[:commentable_type],
comment_params[:commentable_id])
end
def administrator_comment?
["1", true].include?(comment_params[:as_administrator]) && can?(:comment_as_administrator, @commentable)
["1", true].include?(comment_params[:as_administrator]) &&
can?(:comment_as_administrator, @commentable)
end
def moderator_comment?
["1", true].include?(comment_params[:as_moderator]) && can?(:comment_as_moderator, @commentable)
["1", true].include?(comment_params[:as_moderator]) &&
can?(:comment_as_moderator, @commentable)
end
def add_notification(comment)
if comment.reply?
notifiable = comment.parent
else
notifiable = comment.commentable
notifiable = comment.reply? ? comment.parent : comment.commentable
unless comment.author_id == notifiable.author_id
Notification.add(notifiable.author_id, notifiable)
end
Notification.add(notifiable.author_id, notifiable) unless comment.author_id == notifiable.author_id
end
def verify_resident_for_commentable!
return if current_user.administrator? || current_user.moderator?
if @commentable.respond_to?(:comments_for_verified_residents_only?) && @commentable.comments_for_verified_residents_only?
if @commentable.respond_to?(:comments_for_verified_residents_only?) &&
@commentable.comments_for_verified_residents_only?
verify_resident!
end
end