-
Notifications
You must be signed in to change notification settings - Fork 203
Bug 2043229 - Display a "Show External" button beneath attachments list to display all attachments that would redirect such as Github and Phabricator #2633
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 2 commits
fefa9ec
eae677c
94fdf6e
e50becc
0fe93aa
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 |
|---|---|---|
|
|
@@ -51,12 +51,24 @@ | |
| # count attachments | ||
| active_attachments = 0; | ||
| obsolete_attachments = 0; | ||
| external_attachments = 0; | ||
|
|
||
| attachment_hide_types = {}; | ||
| IF Param('attachment_hide_content_types'); | ||
| FOREACH _type IN Param('attachment_hide_content_types').split('[,\s]+'); | ||
| attachment_hide_types.$_type = 1 IF _type; | ||
| END; | ||
| END; | ||
|
|
||
| FOREACH attachment IN bug.attachments; | ||
| NEXT IF attachment.isprivate && !(user.is_insider || attachment.attacher.id == user.id || (attachment.is_bounty_attachment && bug.reporter.id == user.id)) ; | ||
| IF attachment.isobsolete; | ||
| obsolete_attachments = obsolete_attachments + 1; | ||
| ELSE; | ||
| active_attachments = active_attachments + 1; | ||
| IF attachment_hide_types.${attachment.contenttype}; | ||
| external_attachments = external_attachments + 1; | ||
| END; | ||
| END; | ||
|
Collaborator
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.
Following bug 2043229 requirements, a row which is both obsolete and external is only meant to show once both "Show External" and "Show Obsolete" are toggled on ( So a bug with only obsolete external attachments never displays the "Show External" button, also we need that button to reveal them. Quick-fix: I suggest to count obsolete and external attachments too when deciding whether to render the button, but to not include them in the subtitle number of external files |
||
| END; | ||
|
|
||
|
|
@@ -1391,11 +1403,15 @@ | |
| [% IF active_attachments || obsolete_attachments || user.id %] | ||
| [% | ||
| sub = []; | ||
| visible_attachments = active_attachments - external_attachments; | ||
| IF active_attachments + obsolete_attachments == 0; | ||
| sub.push("No files"); | ||
| END; | ||
| IF active_attachments; | ||
| sub.push(active_attachments _ " file" _ (active_attachments == 1 ? "" : "s")); | ||
| IF visible_attachments; | ||
| sub.push(visible_attachments _ " file" _ (visible_attachments == 1 ? "" : "s")); | ||
| END; | ||
| IF external_attachments; | ||
| sub.push(external_attachments _ " external file" _ (external_attachments == 1 ? "" : "s")); | ||
| END; | ||
| IF obsolete_attachments; | ||
| sub.push(obsolete_attachments _ " obsolete file" _ (obsolete_attachments == 1 ? "" : "s")); | ||
|
|
@@ -1408,6 +1424,8 @@ | |
| [% INCLUDE bug_modal/attachments.html.tmpl | ||
| active_attachments = active_attachments | ||
| obsolete_attachments = obsolete_attachments | ||
| external_attachments = external_attachments | ||
| attachment_hide_types = attachment_hide_types | ||
|
dklawren marked this conversation as resolved.
|
||
| %] | ||
| [% END %] | ||
| [% END %] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.