mirror of
https://github.com/discourse/discourse.git
synced 2025-02-15 08:52:56 +08:00
![Guo Xiang Tan](/assets/img/avatar_default.png)
``` MemoryProfiler.report do Jobs::UserEmail.new.execute(type: :mailing_list, user_id: user.id) end.pretty_print ``` Before: ``` Total allocated: 180096119 bytes (1962025 objects) Total retained: 2194 bytes (16 objects) allocated memory by gem ----------------------------------- 66979096 activerecord-4.2.8 43507184 nokogiri-1.7.1 43365188 mail-2.6.4 5960201 activesupport-4.2.8 5056267 discourse/lib 4835284 rack-mini-profiler-0.10.1 3825817 arel-6.0.4 2186088 i18n-0.8.1 1719330 discourse/app ``` After: ``` Total allocated: 161935975 bytes (1473940 objects) Total retained: 2234 bytes (17 objects) allocated memory by gem ----------------------------------- 45430264 activerecord-4.2.8 43568627 nokogiri-1.7.1 43430754 mail-2.6.4 11233878 rack-mini-profiler-0.10.1 5260825 activesupport-4.2.8 5054491 discourse/lib 2186088 i18n-0.8.1 1822494 arel-6.0.4 ```
34 lines
1.1 KiB
Plaintext
34 lines
1.1 KiB
Plaintext
<%- site_link = raw(@markdown_linker.create(@site_name, '/')) %>
|
|
<%= raw(t 'user_notifications.mailing_list.why', site_link: site_link, date: @since_formatted) %>
|
|
|
|
<%- if @new_topics.present? -%>
|
|
### <%= t 'user_notifications.mailing_list.new_topics' %>
|
|
<%- @new_topics.each do |topic| %>
|
|
<%= mailing_list_topic_text(topic) %>
|
|
<%- end -%>
|
|
<%- end -%>
|
|
|
|
<%- if @existing_topics.present? -%>
|
|
### <%= t 'user_notifications.mailing_list.new_topics' %>
|
|
<%- @existing_topics.each do |topic| -%>
|
|
<%= mailing_list_topic_text(topic) %>
|
|
<%= topic.posts.length %>
|
|
<%- end -%>
|
|
<%- end -%>
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
<%- unless SiteSetting.private_email? %>
|
|
<%- @topics.each do |topic| %>
|
|
### <%= raw(@markdown_linker.create(topic.title, topic.relative_url)) %>
|
|
|
|
<%- topic.posts.each do |post| -%>
|
|
<%= post.user.name || post.user.username %> - <%= post.created_at %>
|
|
--------------------------------------------------------------------------------
|
|
<%= post.raw %>
|
|
|
|
|
|
<%- end -%>
|
|
<%- end %>
|
|
<%- end %>
|