restrict comments for new users that haven't updated their site

This commit is contained in:
Kyle Drake 2014-09-05 22:23:23 -07:00
parent 305bb71aa3
commit 96e277c331
6 changed files with 63 additions and 18 deletions

View file

@ -22,7 +22,7 @@
<% event_site = event.site_dataset.select(:id, :username, :title, :domain).first %>
<a href="/site/<%= actioning_site.username %>" class="user" title="<%= actioning_site.title %>"><%= actioning_site.title.shorten(40) %></a>
is following
<% if event_site.id == current_site.id %>
<% if current_site && event_site.id == current_site.id %>
your site!
<% else %>
<a href="/site/<%= event_site.username %>" class="user" title="<%= event_site.title %>"><%= event_site.title.shorten(40) %></a>
@ -36,7 +36,7 @@
<div class="title">
<div class="icon"></div>
<% event_site = event.site_dataset.select(:id, :username, :title, :domain).first %>
<% if event_site.id == current_site.id %>
<% if current_site && event_site.id == current_site.id %>
Your site was updated.
<% else %>
<a href="/site/<%= event_site.username %>" class="user"><%= event_site.title %></a> has been updated.

View file

@ -7,7 +7,7 @@
<%= event_likes_count %>&nbsp;<%= event_likes_count == 1 ? 'like' : 'likes' %>
<% end %>
<% end %>
<% if current_site && event.site.profile_comments_enabled %>
<% if current_site && event.site.profile_comments_enabled && current_site.commenting_allowed? %>
<a id="reply" href="#" onclick="Template.renderComment(<%= event.id %>); return false">
<% if event.profile_comment_id %>
Reply

View file

@ -67,13 +67,32 @@
<div class="content misc-page columns right-col"><div class="col-left">
<div class="col col-66">
<% if current_site && site.profile_comments_enabled %>
<div class="post-comment">
<form method="POST" action="/site/<%= site.username %>/comment">
<input name="csrf_token" type="hidden" value="<%= csrf_token %>">
<input name="message" type="text" placeholder="Post a message..." autocomplete="off" maxlength="<%= Site::MAX_COMMENT_SIZE %>">
<button class="btn-Action">Post</button>
</form>
</div>
<div class="post-comment">
<form method="POST" action="/site/<%= site.username %>/comment">
<input name="csrf_token" type="hidden" value="<%= csrf_token %>">
<input name="message"
type="text"
placeholder="Post a message..."
autocomplete="off"
maxlength="<%= Site::MAX_COMMENT_SIZE %>"
<% unless current_site.commenting_allowed? %>disabled<% end %>
>
<button class="btn-Action"
<% unless current_site.commenting_allowed? %>disabled<% end %>
>Post</button>
</form>
</div>
<% unless current_site.commenting_allowed? %>
<div class="post-comment">
<p>
<small>
Note: To prevent spam, you cannot comment until you have updated your site <strong><%= Site::COMMENTING_ALLOWED_UPDATED_COUNT %></strong> times (on <%= Site::COMMENTING_ALLOWED_UPDATED_COUNT %> separate days),<br> and your account is one week old. While waiting, now is a great time to <a href="/dashboard">start building your awesome site!</a>
</small>
</p>
</div>
<% end %>
<% end %>
<% if @latest_events.empty? %>