talkie 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '055085e927b48a0239fc0995573549d98aa5af8c629ad811f6f5c414d11f5a78'
4
- data.tar.gz: 28b75ab802ed546ded2e3bcbaf28e2d63fcd5047d9c0a87ee75f88f4ef6f1c94
3
+ metadata.gz: 18c265fe490168c26b1f88b4d8ae41b4b87aca6b450a3eb1d96f6d8ab387ba84
4
+ data.tar.gz: 2c4d8fa7da2b3186f265e0e6ee86c37e4b0b55e0faf75178155d967b88488927
5
5
  SHA512:
6
- metadata.gz: 7cfcbe2157639e694949c51394d0ed166dc960fa7ba04da8a224f7a7c82f920761bff71b9cc07202662d8474f392b019e618b00f5a1a116e43d9da237272008e
7
- data.tar.gz: 73800409f18c9119270c8c909f830e109e1f5d947da68e5126c1e6b691c18f3cbd291100510d3bedf4718db55bad498921f5c417d2f089021d3134c8002c2bcf
6
+ metadata.gz: 3220ede1a388766d4b2f482d5530a0b71605bbb33744a34635438a1937460c6cb7c1a0ca11959c81d90ddeb716dbf9b9dd22cd5f0f66c54db9eedcc108fa6284
7
+ data.tar.gz: 6ad67be73a64f31c2b3cc7f98093f0c644df3cf6d4a8082aa3c77ba5c9e872c6cd6f5745772744041211c391e78543e1cdad13610a24b6367505912a5cef8b79
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- talkie (0.3.1)
4
+ talkie (0.3.2)
5
5
  awesome_nested_set (~> 3.1)
6
6
  blueprinter (~> 0.18.0)
7
7
  oj (~> 3.7)
@@ -24,7 +24,7 @@
24
24
  <%= link_to_delete_comment comment %>
25
25
  <% end %>
26
26
 
27
- <% if nested_enabled? %>
27
+ <% if nested_enabled? && comment_form_displayable? %>
28
28
  <div class="talkie-comment-reply">
29
29
  <a href="#" class="talkie-comment-reply-link"><%= t("talkie.comment.reply") %></a>
30
30
  <% if deletable_and_allowed? comment %>
@@ -1,3 +1,5 @@
1
- <%= render "talkie/comments/form" %>
1
+ <% if comment_form_displayable? %>
2
+ <%= render "talkie/comments/form" %>
3
+ <% end %>
2
4
 
3
5
  <%= render root_comments %>
@@ -5,8 +5,8 @@ module Talkie
5
5
  extend ActiveSupport::Concern
6
6
 
7
7
  included do
8
- delegate :allow?, to: :current_permission
9
- helper_method :allow?
8
+ delegate :allow?, :comment_form_displayable?, to: :current_permission
9
+ helper_method :allow?, :comment_form_displayable?
10
10
  end
11
11
 
12
12
  protected
@@ -1,7 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Talkie
4
- class Permission < Struct.new(:user)
4
+ class Permission
5
+ attr_reader :user
6
+
7
+ def initialize(user)
8
+ @user = user
9
+ end
10
+
11
+ def comment_form_displayable?
12
+ user.present?
13
+ end
14
+
5
15
  def allow?(action, comment = Talkie::Comment.new)
6
16
  action = action.to_s
7
17
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Talkie
4
- VERSION = '0.3.1'.freeze
4
+ VERSION = '0.3.2'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: talkie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abraham Kuri