only requested lists can be updated

git-svn-id: http://redmine.rubyforge.org/svn/branches/work@270 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2007-02-25 18:14:43 +00:00
parent 159c23b943
commit 35cf1e6258
2 changed files with 3 additions and 4 deletions

View File

@@ -48,9 +48,8 @@ class MailingListsController < ApplicationController
end
end
def edit
@mailing_list = MailingList.find(params[:id])
if request.post? and @mailing_list.update_attributes(params[:mailing_list])
def edit
if request.post? && @mailing_list.status == MailingList::STATUS_REQUESTED && @mailing_list.update_attributes(params[:mailing_list])
flash[:notice] = l(:notice_successful_update)
redirect_to :controller => 'projects', :action => 'settings', :tab => 'mailing-lists', :id => @project
end

View File

@@ -70,7 +70,7 @@
<td><%=h mailing_list.description %></td>
<td align="center"><%= mailing_list.admin.name if mailing_list.admin %></td>
<td align="center"><%= l(mailing_list.status_name) if mailing_list.status_name %></td>
<td align="center" style="width:10%"><%= link_to_if_authorized(l(:button_edit), {:controller => 'mailing_lists', :action => 'edit', :id => mailing_list}, :class => 'icon icon-edit') %></td>
<td align="center" style="width:10%"><%= link_to_if_authorized(l(:button_edit), {:controller => 'mailing_lists', :action => 'edit', :id => mailing_list}, :class => 'icon icon-edit') if mailing_list.status==MailingList::STATUS_REQUESTED %></td>
<td align="center" style="width:10%"><%= link_to_if_authorized(l(:button_delete), {:controller => 'mailing_lists', :action => 'destroy', :id => mailing_list}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del') unless mailing_list.status==MailingList::STATUS_TO_BE_DELETED %></td>
</tr>
<% end; reset_cycle %>