-
Notifications
You must be signed in to change notification settings - Fork 804
AO3-5556 Don't change collections on preview - Follow up PR #5820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 9 commits
a66de5d
7776fdd
947523a
a618435
fc6ef09
fe7fe28
f0479b2
81be419
4ef0c3f
7f8693c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -362,7 +362,7 @@ def update | |
| elsif params[:preview_button] | ||
| flash[:notice] = t(".unposted_notice") unless @work.posted? | ||
|
|
||
| in_moderated_collection | ||
| in_moderated_collection(flash.now) | ||
| @preview_mode = true | ||
| render :preview | ||
| else | ||
|
|
@@ -566,22 +566,23 @@ def send_external_invites(works) | |
| end | ||
|
|
||
| # check to see if the work is being added / has been added to a moderated collection, then let user know that | ||
| def in_moderated_collection | ||
| moderated_collections = [] | ||
| @work.collections.each do |collection| | ||
| next unless !collection.nil? && collection.moderated? && !collection.user_is_posting_participant?(current_user) | ||
| next unless @work.collection_items.present? | ||
| @work.collection_items.each do |collection_item| | ||
| next unless collection_item.collection == collection | ||
| if collection_item.approved_by_user? && collection_item.unreviewed_by_collection? | ||
| moderated_collections << collection | ||
| end | ||
| end | ||
| end | ||
| if moderated_collections.present? | ||
| flash[:notice] ||= '' | ||
| flash[:notice] += ts(" You have submitted your work to #{moderated_collections.size > 1 ? 'moderated collections (%{all_collections}). It will not become a part of those collections' : "the moderated collection '%{all_collections}'. It will not become a part of the collection"} until it has been approved by a moderator.", all_collections: moderated_collections.map(&:title).join(', ')) | ||
| def in_moderated_collection(flash = self.flash) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call, I'll rename it to show_moderated_collection_warning. |
||
| moderated_collections = @work.collection_items_after_saving | ||
| .select(&:approved_by_user?) | ||
| .select(&:unreviewed_by_collection?) | ||
| .map(&:collection) | ||
|
|
||
| return if moderated_collections.blank? | ||
|
|
||
| links = moderated_collections.map do |collection| | ||
| view_context.link_to(collection.title, collection_path(collection)) | ||
| end | ||
|
|
||
| message = t("works.moderated_collections_message_html", | ||
| count: moderated_collections.length, | ||
| collections: view_context.safe_join(links, ", ")) | ||
|
|
||
| flash[:notice] = view_context.safe_join([flash[:notice], message].compact, " ") | ||
| end | ||
|
|
||
| public | ||
|
|
@@ -786,7 +787,7 @@ def set_work_form_fields | |
| @serial_works = @work.serial_works | ||
|
|
||
| if @collection.nil? | ||
| @collection = @work.approved_collections.first | ||
| @collection = @work.approved_collections_after_saving.first | ||
| end | ||
|
|
||
| if params[:claim_id] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,15 @@ def work_meta_list(work, chapter = nil) | |
| content_tag(:dl, list.to_s, class: 'stats').html_safe | ||
| end | ||
|
|
||
| def collections_meta_tag(work) | ||
| collections_data = show_collections_data(work.approved_collections_after_saving) | ||
| return if collections_data.blank? | ||
|
|
||
| content_tag(:dt, t("works_helper.collections_meta_tag.collections"), class: "collections") + | ||
| "\n".html_safe + | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a way to join these with a newline that doesn't need
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, we do need a space between the |
||
| content_tag(:dd, collections_data, class: "collections") | ||
| end | ||
|
|
||
| def work_page_title(work, title, options = {}) | ||
| fandoms = work.fandoms | ||
| title_fandom = if fandoms.empty? | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be
collections_html? (Related to my question about the parent key name)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the parameter name doesn't need
_htmlonly the parent key does.