fix in selecting messages from current folder

This commit is contained in:
Wojciech Todryk 2012-03-02 20:28:25 +01:00
parent f0dcdc3985
commit 9be6f493a3
3 changed files with 11 additions and 10 deletions

View file

@ -90,7 +90,7 @@ class MessagesController < ApplicationController
@text_part = nil
@html_part = nil
@message = @current_user.messages.find_by_uid(params[:id])
@message = @current_user.messages.where('folder_id = ? and uid = ?',@current_folder,params[:id]).first
@message.update_attributes(:unseen => false)
imap_message = @mailbox.fetch_body(@message.uid)
@ -145,7 +145,7 @@ class MessagesController < ApplicationController
end
def html_body
message = @current_user.messages.find(params[:id])
message = @current_user.messages.where('folder_id = ? and uid = ?',@current_folder,params[:id]).first
mail = Mail.new(@mailbox.fetch_body(message.uid))
if mail.multipart?
@body = mail.html_part.decoded_and_charseted
@ -170,7 +170,7 @@ class MessagesController < ApplicationController
def attachment
attachments = []
message = @current_user.messages.find(params[:id])
message = @current_user.messages.where('folder_id = ? and uid = ?',@current_folder,params[:id]).first
mail = Mail.new(@mailbox.fetch_body(message.uid))
if mail.multipart? == true
attachments = mail.attachments

View file

@ -67,14 +67,14 @@ class MessagesOpsController < ApplicationController
def set_unread
params["uids"].each do |uid|
@mailbox.set_unread(uid)
@current_user.messages.find_by_uid(uid).update_attributes(:unseen => 1)
@current_user.messages.where('folder_id = ? and uid = ?',@current_folder,uid).first.update_attributes(:unseen => 1)
end
end
def set_read
params["uids"].each do |uid|
@mailbox.set_read(uid)
@current_user.messages.find_by_uid(uid).update_attributes(:unseen => 0)
@current_user.messages.where('folder_id = ? and uid = ?',@current_folder,uid).first.update_attributes(:unseen => 0)
end
end
@ -260,7 +260,7 @@ class MessagesOpsController < ApplicationController
#FIXME edit does not support attachments
def edit
old_message = @current_user.messages.find(params[:id])
old_message = @current_user.messages.where('folder_id = ? and uid = ?',@current_folder,params[:uids].first).first
@message = Message.new
@message.to_addr = old_message.to_addr
@message.subject = old_message.subject
@ -279,7 +279,7 @@ class MessagesOpsController < ApplicationController
end
def reply
old_message = @current_user.messages.find(params[:uids].first)
old_message = @current_user.messages.where('folder_id = ? and uid = ?',@current_folder,params[:uids].first).first
@message = Message.new
@message.to_addr = old_message.from_addr
@message.subject = old_message.subject

View file

@ -10,11 +10,11 @@
<div class="navigation-tabs clearfix">
<%= raw single_navigation(:about,:internal) %>
</div>
<div class="content clearfix">
<div class="content">
<div class="header_info">
<h4>
<%= t(:current_version,:scope=>:internal) + ": " + $defaults["version"] %>
</div>
</h4>
<div class="md">
<%= raw BlueCloth::new(render :file => 'README.markdown').to_html %>
@ -28,5 +28,6 @@
<%= raw BlueCloth::new(render :file => 'TODO').to_html %>
</div>
</div>