[PATCH] Only displays pending roles to the product admin. #233
by Darryl L. Pierce
If the user is the product admin, then pending roles are shown and
called out as such. Otherwise, they are hidden from view and only
approved users are displayed.
Signed-off-by: Darryl L. Pierce <mcpierce(a)gmail.com>
---
app/views/roles/_list.html.erb | 31 +++++++++++++++++--------------
doc/ChangeLog | 1 +
2 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/app/views/roles/_list.html.erb b/app/views/roles/_list.html.erb
index 7ae4783..ead82dd 100644
--- a/app/views/roles/_list.html.erb
+++ b/app/views/roles/_list.html.erb
@@ -9,27 +9,30 @@
</caption>
<thead>
<tr>
- <th scope="col">#</th>
- <th scope="col" class="name">User</th>
- <th scope="col">Product</th>
- <th scope="col">Since</th>
+ <th scope="col">#</th>
+ <th scope="col" class="name">User</th>
+ <th scope="col">Product</th>
+ <th scope="col">Since</th>
</tr>
</thead>
<tbody>
<% product_roles.each do |product_role| %>
+ <% if !product_role.pending? || (product_role.pending? && @product.can_approve_roles?(@user)) %>
<tr class="<%= cycle('odd', 'even') %>">
- <td><%= product_role.id %></td>
- <td class="name">
- <% if product_role.user.avatar_url %>
- <div class="small-icon"><%= image_tag product_role.user.avatar_url %></div>
- <% end %>
- <%= link_to product_role.user.display_name, user_path(product_role.user) %>
- <%= link_to product_role.role.name, product_role_path(product_role.product, product_role) %>
- </td>
- <td><%= link_to product_role.product.name, product_roles_path(product_role.product) %></td>
- <td><%= show_date(product_role.created_at) %></td>
+ <td><%= product_role.id %></td>
+ <td class="name">
+ <% if product_role.user.avatar_url %>
+ <div class="small-icon"><%= image_tag product_role.user.avatar_url %></div>
+ <% end %>
+ <%= link_to product_role.user.display_name, user_path(product_role.user) %>
+ <%= link_to product_role.role.name, product_role_path(product_role.product, product_role) %>
+ <% if product_role.pending? %><b>(PENDING REQUEST)</b><% end %>
+ </td>
+ <td><%= link_to product_role.product.name, product_roles_path(product_role.product) %></td>
+ <td><%= show_date(product_role.created_at) %></td>
</tr>
<% end %>
+ <% end %>
</tbody>
</table>
</div>
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 736d3d2..6998f48 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -60,6 +60,7 @@ Change Log (0.3.0):
* #230 - Sprint not started but no error message is shown. (BUG)
* #231 - Fix the breadcrumb trail for the task page. (BUG)
* #232 - Only show approved product members as sprint team candidates. (BUG)
+ * #233 - Only approved members are displayed. (BUG)
* #234 - Fix the URL for user registration. (BUG)
* #235 - Recent activity is actually oldest activity. (BUG)
--
1.6.2
14 years, 5 months
[PATCH] Fixed sprint member list to only show approved members. #232
by Darryl L. Pierce
Only a user who is approved for a product role is displayed as a sprint candidate.
Signed-off-by: Darryl L. Pierce <mcpierce(a)gmail.com>
---
app/models/product.rb | 2 +-
doc/ChangeLog | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/app/models/product.rb b/app/models/product.rb
index cc238fa..8234e00 100644
--- a/app/models/product.rb
+++ b/app/models/product.rb
@@ -36,7 +36,7 @@ class Product < ActiveRecord::Base
belongs_to :project
belongs_to :owner, :class_name => 'User', :foreign_key => 'owner_id'
- has_many :product_roles, :dependent => :destroy
+ has_many :product_roles, :dependent => :destroy, :conditions => {:pending => false, :is_approved => true}
has_many :members, :through => :product_roles, :source => :user
has_many :user_stories, :dependent => :destroy
has_many :sprints, :dependent => :destroy
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 070818c..736d3d2 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -59,6 +59,7 @@ Change Log (0.3.0):
* #229 - Fixed when nil.name showed up when viewing sprints. (BUG)
* #230 - Sprint not started but no error message is shown. (BUG)
* #231 - Fix the breadcrumb trail for the task page. (BUG)
+ * #232 - Only show approved product members as sprint team candidates. (BUG)
* #234 - Fix the URL for user registration. (BUG)
* #235 - Recent activity is actually oldest activity. (BUG)
--
1.6.2
14 years, 5 months