lib/talkie/permission.rb in talkie-0.3.1 vs lib/talkie/permission.rb in talkie-0.3.2
- old
+ new
@@ -1,8 +1,18 @@
# frozen_string_literal: true
module Talkie
- class Permission < Struct.new(:user)
+ class Permission
+ attr_reader :user
+
+ def initialize(user)
+ @user = user
+ end
+
+ def comment_form_displayable?
+ user.present?
+ end
+
def allow?(action, comment = Talkie::Comment.new)
action = action.to_s
if user
return true if action.in? %w[create index]