enable write-only forums
when the role-write is lower than the role-read, a forum is considered write-only for anyone who can write, but not read, they can create posts, but they can only see and reply to their own posts. users who can read are able to see and reply to all posts in the forum.
This commit is contained in:
@@ -11,20 +11,28 @@
|
||||
|
||||
<div class="items bold">
|
||||
<% group.forums.sort_by{ |f| f.position || 0 }.each do |f| %>
|
||||
<% if f.can_read?(current_user) %>
|
||||
<% if f.can_view?(current_user) %>
|
||||
<div class="item">
|
||||
<%= link_to f.name, f, id: "forum-#{f.id}"%>
|
||||
<div class="item-info">
|
||||
<% if last_thread = f.threads.last %>
|
||||
<% last_reply = Threadreply.where(forumthread: f.threads).order(:created_at).last %>
|
||||
<% if last_reply && last_reply.created_at > last_thread.created_at %>
|
||||
<%= last_reply.author.name %>
|
||||
<%= link_to "replied", forumthread_path(last_reply.thread) + "#reply-#{last_reply.id}" %>
|
||||
<%= ago last_reply.created_at %>.
|
||||
<% if last_reply.thread.can_read?(current_user) %>
|
||||
<%= last_reply.author.name %>
|
||||
<%= link_to "replied", forumthread_path(last_reply.thread) + "#reply-#{last_reply.id}" %>
|
||||
<%= ago last_reply.created_at %>.
|
||||
<% else %>
|
||||
Hidden
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= last_thread.author.name %>
|
||||
<%= link_to "posted", forumthread_path(last_thread) %>
|
||||
<%= ago last_thread.created_at %>.
|
||||
<% if last_thread.can_read?(current_user) %>
|
||||
<%= last_thread.author.name %>
|
||||
<%= link_to "posted", forumthread_path(last_thread) %>
|
||||
<%= ago last_thread.created_at %>.
|
||||
<% else %>
|
||||
Hidden
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
No posts yet.
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
<% title @forum.name %>
|
||||
|
||||
<%= link_to @forum.group, forumgroup_path(@forum.group) %> → <%= @forum %>
|
||||
|
||||
<h1><%= @forum %></h1>
|
||||
<h1><%= title @forum %></h1>
|
||||
<% if @forum.can_write?(current_user) %>
|
||||
<p><%= link_to "New thread", new_forumthread_path(forum: @forum), class: "btn blue" %></p>
|
||||
<% end %>
|
||||
|
||||
<% if @forum.role_read && @forum.role_write && @forum.role_write < @forum.role_read %>
|
||||
<div class="lockednote">This forum is write-only. You can only see your own posts.</div>
|
||||
<% end %>
|
||||
|
||||
<div id="forum_groups">
|
||||
<% @threads.each do |thread| %>
|
||||
<div class="item-group with-avatar" id="thread-<%= thread.id %>">
|
||||
|
||||
Reference in New Issue
Block a user