diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/incoming_message.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 5e57694c2..7e3f65cf4 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -19,7 +19,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: incoming_message.rb,v 1.138 2008-08-29 22:39:36 francis Exp $ +# $Id: incoming_message.rb,v 1.139 2008-08-29 23:13:30 francis Exp $ # TODO # Move some of the (e.g. quoting) functions here into rblib, as they feel @@ -128,6 +128,16 @@ class FOIAttachment end end end + + def display_size + s = self.body.size + + if s > 1024 * 1024 + return sprintf("%.1f", s.to_f / 1024 / 1024) + 'M' + else + return (s / 1024).to_s + 'K' + end + end end class IncomingMessage < ActiveRecord::Base |