diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8e190454..d03680a8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -40,4 +40,8 @@ module ApplicationHelper html.gsub!(/\(.*?)\<\/a\>/mi, '\2') html.html_safe end + + def show_notice?(id: nil) + user_signed_in? && current_user.notice_dismissals.where(notice_id: id).none? + end end diff --git a/app/views/notice_dismissal/messages/_02.html.erb b/app/views/notice_dismissal/messages/_02.html.erb index f211ea56..0590262a 100644 --- a/app/views/notice_dismissal/messages/_02.html.erb +++ b/app/views/notice_dismissal/messages/_02.html.erb @@ -1,4 +1,4 @@ -<% unless user_signed_in? && current_user.notice_dismissals.where(notice_id: 2).any? %> +<% unless show_notice?(id: 2) %>
diff --git a/app/views/notice_dismissal/messages/_06.html.erb b/app/views/notice_dismissal/messages/_06.html.erb index 58b35ad9..7c0c1a16 100644 --- a/app/views/notice_dismissal/messages/_06.html.erb +++ b/app/views/notice_dismissal/messages/_06.html.erb @@ -1,5 +1,5 @@ <% if PromoService.active?(:promo_bogo) %> - <% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 6).none? %> + <% if show_notice?(id: 6) %>
<%= link_to 'Dismiss this notice.', notice_dismissal_dismiss_path(notice_id: 6), class: 'blue-text right', style: 'padding: 0 10px;' %> diff --git a/app/views/notice_dismissal/messages/_07.html.erb b/app/views/notice_dismissal/messages/_07.html.erb index bcfc3b10..3a1655df 100644 --- a/app/views/notice_dismissal/messages/_07.html.erb +++ b/app/views/notice_dismissal/messages/_07.html.erb @@ -1,11 +1,9 @@ -<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 7).none? %> -
-
- help - These associations are automatically created whenever you mention this page from another page. - Only you can see this message. +<% if show_notice?(id: 7) %> +
+ help + These associations are automatically created whenever you mention this page from another page. + Only you can see this message. - <%= link_to 'Dismiss this notice.', notice_dismissal_dismiss_path(notice_id: 7), class: 'blue-text' %> -
+ <%= link_to 'Dismiss this notice.', notice_dismissal_dismiss_path(notice_id: 7), class: 'blue-text' %>
<% end %> \ No newline at end of file diff --git a/app/views/notice_dismissal/messages/_08.html.erb b/app/views/notice_dismissal/messages/_08.html.erb index d3b0807d..8f9b43b6 100644 --- a/app/views/notice_dismissal/messages/_08.html.erb +++ b/app/views/notice_dismissal/messages/_08.html.erb @@ -1,4 +1,4 @@ -<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 8).none? && false %> +<% if show_notice?(id: 8) && false %>
<%= link_to 'Dismiss this notice.', notice_dismissal_dismiss_path(notice_id: 8), class: 'blue-text right', style: 'padding: 0 10px;' %> diff --git a/app/views/notice_dismissal/messages/_09.html.erb b/app/views/notice_dismissal/messages/_09.html.erb index 8a06c953..f6412ccb 100644 --- a/app/views/notice_dismissal/messages/_09.html.erb +++ b/app/views/notice_dismissal/messages/_09.html.erb @@ -1,4 +1,4 @@ -<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 9).none? %> +<% if show_notice?(id: 9) %>
help Links will automatically appear here whenever you add this page to a public collection.
diff --git a/app/views/notice_dismissal/messages/_10.html.erb b/app/views/notice_dismissal/messages/_10.html.erb index 2d5c0528..25fd350d 100644 --- a/app/views/notice_dismissal/messages/_10.html.erb +++ b/app/views/notice_dismissal/messages/_10.html.erb @@ -1,4 +1,4 @@ -<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 10).none? %> +<% if show_notice?(id: 10) %>
help Documents will automatically appear here whenever you add this page to a document.
diff --git a/app/views/notice_dismissal/messages/_11.html.erb b/app/views/notice_dismissal/messages/_11.html.erb index be127da6..ae583f49 100644 --- a/app/views/notice_dismissal/messages/_11.html.erb +++ b/app/views/notice_dismissal/messages/_11.html.erb @@ -1,4 +1,4 @@ -<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 11).none? %> +<% if show_notice?(id: 11) %>
help Links will automatically appear here whenever you share this page to your followers.
diff --git a/app/views/notice_dismissal/messages/_12.html.erb b/app/views/notice_dismissal/messages/_12.html.erb index 713ca678..767c6f4b 100644 --- a/app/views/notice_dismissal/messages/_12.html.erb +++ b/app/views/notice_dismissal/messages/_12.html.erb @@ -1,4 +1,4 @@ -<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 12).none? %> +<% if show_notice?(id: 12) %>
You can now share your notebook pages to your Stream!

diff --git a/app/views/notice_dismissal/messages/_13.html.erb b/app/views/notice_dismissal/messages/_13.html.erb index b8dbeb5e..d0541828 100644 --- a/app/views/notice_dismissal/messages/_13.html.erb +++ b/app/views/notice_dismissal/messages/_13.html.erb @@ -1,4 +1,4 @@ -<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 13).none? %> +<% if show_notice?(id: 13) %> <% example_character_name = @current_user_content.fetch('Character', []).sample.try(:name) || 'Alice' %> diff --git a/app/views/notice_dismissal/messages/_14.html.erb b/app/views/notice_dismissal/messages/_14.html.erb index b0281937..fa0c013c 100644 --- a/app/views/notice_dismissal/messages/_14.html.erb +++ b/app/views/notice_dismissal/messages/_14.html.erb @@ -1,4 +1,4 @@ -<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 14).none? %> +<% if show_notice?(id: 14) %>
help Timelines will automatically appear here whenever you link this page to those timelines in Notebook.ai. diff --git a/app/views/notice_dismissal/messages/_15.html.erb b/app/views/notice_dismissal/messages/_15.html.erb index cb3fa590..c20947f3 100644 --- a/app/views/notice_dismissal/messages/_15.html.erb +++ b/app/views/notice_dismissal/messages/_15.html.erb @@ -1,4 +1,4 @@ -<% if user_signed_in? && current_user.notice_dismissals.where(notice_id: 15).none? %> +<% if show_notice?(id: 15) %>

Collections on Notebook.ai are a brand new feature and I'd love to get your feedback on how you would like to use them.