Skip to content

Commit

Permalink
Daily message now being emailed again.
Browse files Browse the repository at this point in the history
  • Loading branch information
aantix committed Sep 24, 2015
1 parent 9f8ac91 commit 02c5fcf
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 85 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ gem 'devise', github: 'plataformatec/devise'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'modernizr-rails'
gem "jquery-rails"
gem 'turbolinks', github: 'rails/turbolinks'
gem 'rails_12factor'
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ GEM
mini_portile (0.6.2)
minitest (5.8.0)
mixpanel-ruby (2.1.0)
modernizr-rails (2.7.1)
multi_json (1.11.0)
multi_test (0.1.2)
multi_xml (0.5.5)
Expand Down Expand Up @@ -521,6 +522,7 @@ DEPENDENCIES
jquery-rails
mail
mixpanel-ruby
modernizr-rails
mysql2
nokogiri
omniauth
Expand Down
2 changes: 2 additions & 0 deletions app/jobs/followup_inbox_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ def perform(user_id)

adapter = Mail::Adapters::GmailAdapter.new(user, count_callback, message_callback)
adapter.messages

FollowupMailer.daily(User.find(user_id)).deliver_now
end

def count_callback
Expand Down
5 changes: 3 additions & 2 deletions app/views/emails/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
<%= stylesheet_link_tag "animate.min" %>
<% end %>


<p/>
<p/>
<p/>

<%= render partial: "shared/progress_bar", locals: {percent: 0} %>
<% if params[:job_id] %>
<%= render partial: "shared/progress_bar", locals: {percent: 0} %>
<% end %>

<div id="emails">
<% if @email_threads.size == 0 %>
Expand Down
168 changes: 86 additions & 82 deletions app/views/followup_mailer/_email.html.erb
Original file line number Diff line number Diff line change
@@ -1,95 +1,99 @@
<% email = email.emails.last %>
<% span = email.questions.empty? ? 0 : 150 %>
<% col_span_inc = span > 0 ? 1 : 0 %>
<table cellspacing="0" cellpadding="0" border="0" class="email-html" width="940px" id="email_#{email.id}">
<% if email %>
<% span = email.questions.empty? ? 0 : 150 %>
<% col_span_inc = span > 0 ? 1 : 0 %>

<tr class="email-time">
<td width="50px text-center">
<h4>
<%= email.received_on.strftime("%I:%M %p") %>
</h4>
</td>
<td width="790px" colspan="<%= 4 + col_span_inc %>">
<hr/>
</td>
</tr>
<table cellspacing="0" cellpadding="0" border="0" class="email-html" width="940px" id="email_#{email.id}">

<tr class="email-data">
<td width="50px" class="email-image text-center">
<% if email.active_profile_images.present? %>
<%= image_tag email.active_profile_images.first.image_url(:bright_face_small), class: "img-circle" %>
<% else %>
<div class="first-letter text-uppercase img-rounded" style="background: #<%= string_color(email.from_name) %>;">
<%= name_initials(email.from_name) %>
</div>
<% end %>
</td>
<tr class="email-time">
<td width="50px text-center">
<h4>
<%= email.received_on.strftime("%I:%M %p") %>
</h4>
</td>
<td width="790px" colspan="<%= 4 + col_span_inc %>">
<hr/>
</td>
</tr>

<tr class="email-data">
<td width="50px" class="email-image text-center">
<% if email.active_profile_images.present? %>
<%= image_tag email.active_profile_images.first.image_url(:bright_face_small), class: "img-circle" %>
<% else %>
<div class="first-letter text-uppercase img-rounded" style="background: #<%= string_color(email.from_name) %>;">
<%= name_initials(email.from_name) %>
</div>
<% end %>
</td>

<td width="10px">
&nbsp;
</td>
<td width="10px">
&nbsp;
</td>


<td class="email-body" width="<%= 590 - span %>px">
<table width="<%= 590 - span %>px">
<tr>
<td>
<span class="email-displayname text-capitalize">
<%= subject_label(email, current_user) %>
</span>
<span class="email-displayname-action">
<%= action_label(email, current_user, email.email_thread.emails_count) %>..
</span>
</td>
</tr>
<td class="email-body" width="<%= 590 - span %>px">
<table width="<%= 590 - span %>px">
<tr>
<td>
<span class="email-displayname text-capitalize">
<%= subject_label(email, current_user) %>
</span>
<span class="email-displayname-action">
<%= action_label(email, current_user, email.email_thread.emails_count) %>..
</span>
</td>
</tr>

<tr>
<td>
<h4 class="email-subject">
<span class="subject text-uppercase <%= muted_text(email) %>">
<%= email.subject %>
</span>
</h4>
</td>
</tr>
<tr>
<td>
<h4 class="email-subject">
<span class="subject text-uppercase <%= muted_text(email) %>">
<%= email.subject %>
</span>
</h4>
</td>
</tr>

<tr>
<td>
<span class="<%= email_body_class(email.body) %> <%= muted_text(email) %>">
<% if muted_text?(email) %>
<%= truncate_html(highlight_body(email_body_display("<s>#{email.body}</s>".html_safe, email.content_type), email.questions), length: 100) %>
<br/>
(NO FOLLOW UP NEEDED)
<% else %>
<%= highlight_body(email_body_display(email.body, email.content_type), email.questions) %>
<% end %>
</span>
</td>
</tr>
</table>
</td>
<tr>
<td>
<span class="<%= email_body_class(email.body) %> <%= muted_text(email) %>">
<% if muted_text?(email) %>
<%= truncate_html(highlight_body(email_body_display("<s>#{email.body}</s>".html_safe, email.content_type), email.questions), length: 100) %>
<br/>
(NO FOLLOW UP NEEDED)
<% else %>
<%= highlight_body(email_body_display(email.body, email.content_type), email.questions) %>
<% end %>
</span>
</td>
</tr>
</table>
</td>

<% if span > 0 %>
<td width="<%= span %>px" class="email-highlighs">
<% if email.questions.present? %>
<blockquote>
<%= highlight_questions(email.questions) %>
</blockquote>
<% end %>
<% if span > 0 %>
<td width="<%= span %>px" class="email-highlighs">
<% if email.questions.present? %>
<blockquote>
<%= highlight_questions(email.questions) %>
</blockquote>
<% end %>
</td>
<% end %>

<tr>
<td colspan="2">
&nbsp;
</td>
<td colspan="<%= 2 + col_span_inc %>" class="email-actions">
<% c = muted_text(email) ? "" : "btn-primary" %>
<%= render partial: "shared/follow_up_respond_buttons", locals: {email: email, current_user: current_user, btn_class: c} %>
&nbsp;&nbsp;
<%= link_to "Ignore&nbsp;".html_safe, email_url(email, destroy: true), target: "_blank", class: "btn btn-danger" %>
</td>
<% end %>
</tr>

<tr>
<td colspan="2">
&nbsp;
</td>
<td colspan="<%= 2 + col_span_inc %>" class="email-actions">
<% c = muted_text(email) ? "" : "btn-primary" %>
<%= render partial: "shared/follow_up_respond_buttons", locals: {email: email, current_user: current_user, btn_class: c} %>
&nbsp;&nbsp;
<%= link_to "Ignore&nbsp;".html_safe, email_url(email, destroy: true), target: "_blank", class: "btn btn-danger" %>
</td>
</tr>
</table>

</table>
<% end %>
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<title>Add a Reminder for Gmail and Google Business; a Daily Summary of the Emails you Need to Follow up On</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= javascript_include_tag :modernizr %>
<meta name="google-site-verification" content="6O6X0lz0eOg_8INHMqcY2ntltw7AFi1bN9viwrH4gBQ" />
<%= render partial: "shared/mixpanel" %>
<%= Gon::Base.render_data %>
Expand Down
2 changes: 1 addition & 1 deletion lib/mail/filters/from_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FromFilter < BaseFilter
"service@", "services@", "ship-confirm@", "slashdot.org", "smtp@", "spam@", "studio@", "subscribe@",
"supervisor@", "support@", "technique@", "theoffice@", "undisclosed-recipients@", "update@",
"uk-info@", "usenet@", "uucp@", "vets@", "www@", "webadmin@", "webmail@", "webmaster@",
"whois@", "yahoogroups.com", "builds@"]
"whois@", "yahoogroups.com", "builds@", "ebay@"]

attr_reader :from, :owner

Expand Down

0 comments on commit 02c5fcf

Please sign in to comment.