You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2016/10/02 15:36:57 UTC
[whimsy] branch master updated: skip messages that only have
signature attachments
This is an automated email from the ASF dual-hosted git repository.
rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 676fc04 skip messages that only have signature attachments
676fc04 is described below
commit 676fc043cf2f8c7bda79fff67b2cbce832016dea
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sun Oct 2 11:36:21 2016 -0400
skip messages that only have signature attachments
---
www/secmail/models/mailbox.rb | 2 +-
www/secmail/models/message.rb | 10 ++++++++--
www/secmail/views/index.json.rb | 2 +-
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/www/secmail/models/mailbox.rb b/www/secmail/models/mailbox.rb
index 8873651..4a449b5 100644
--- a/www/secmail/models/mailbox.rb
+++ b/www/secmail/models/mailbox.rb
@@ -156,7 +156,7 @@ class Mailbox
def client_headers
# fetch a list of headers for all messages in the maibox with attachments
headers = self.headers.to_a.select do |id, message|
- message[:attachments]
+ not Message.attachments(message).empty?
end
# extract relevant fields from the headers
diff --git a/www/secmail/models/message.rb b/www/secmail/models/message.rb
index 58a6f3d..56b7ae0 100644
--- a/www/secmail/models/message.rb
+++ b/www/secmail/models/message.rb
@@ -97,13 +97,19 @@ class Message
mail.text_part
end
- def attachments
- @headers[:attachments].
+ def self.attachments(headers)
+ attachments = headers[:attachments]
+ return [] unless attachments
+ attachments.
reject {|attachment| SIG_MIMES.include? attachment[:mime]}.
map {|attachment| attachment[:name]}.
select {|name| name != 'signature.asc'}
end
+ def attachments
+ Message.attachments(@headers)
+ end
+
#
# attachment operations: update, replace, delete
#
diff --git a/www/secmail/views/index.json.rb b/www/secmail/views/index.json.rb
index 54c1d06..c685b42 100644
--- a/www/secmail/views/index.json.rb
+++ b/www/secmail/views/index.json.rb
@@ -9,7 +9,7 @@ if index
if index > 0
prevmbox = available[index-1].untaint
prevmbox = nil unless YAML.load_file(prevmbox).any? do |key, mail|
- mail[:status] != :deleted and mail[:attachments]
+ mail[:status] != :deleted and not Message.attachments(mail).empty?
end
end
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].