Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

uploaded_files_list: Fix id pollution.

Anders Kaseorgb0653d1ea47e
diff --git a/web/src/attachments_ui.ts b/web/src/attachments_ui.ts
index e9b8776768e..af86d028932 100644
--- a/web/src/attachments_ui.ts
+++ b/web/src/attachments_ui.ts
@@ -184,7 +184,7 @@ export function set_up_attachments(): void {
});
$("#uploaded_files_table").on("click", ".remove-attachment", (e) => {
- const file_name = $(e.target).closest(".uploaded_file_row").attr("id");
+ const file_name = $(e.target).closest(".uploaded_file_row").attr("data-attachment-name");
delete_attachments(
$(e.target).closest(".uploaded_file_row").attr("data-attachment-id")!,
file_name!,
diff --git a/web/styles/settings.css b/web/styles/settings.css
index 8b48621c505..efcc2d6096a 100644
--- a/web/styles/settings.css
+++ b/web/styles/settings.css
@@ -526,7 +526,7 @@ input[type="checkbox"] {
margin-left: 5px;
}
-.edit-attachment-buttons #download_attachment {
+.edit-attachment-buttons .download-attachment {
display: block;
padding: 6px 9px;
text-decoration: none;
diff --git a/web/templates/settings/uploaded_files_list.hbs b/web/templates/settings/uploaded_files_list.hbs
index 0475fd5d247..d173e49d8a2 100644
--- a/web/templates/settings/uploaded_files_list.hbs
+++ b/web/templates/settings/uploaded_files_list.hbs
@@ -1,5 +1,5 @@
{{#with attachment}}
-<tr class="uploaded_file_row" id="{{name}}" data-attachment-id="{{id}}">
+<tr class="uploaded_file_row" data-attachment-name="{{name}}" data-attachment-id="{{id}}">
<td>
<a type="submit" class="tippy-zulip-delayed-tooltip" href="/user_uploads/{{path_id}}" target="_blank" rel="noopener noreferrer" data-tippy-content="{{t 'View file' }}">
{{ name }}
@@ -20,7 +20,7 @@
<td class="upload-size" >{{ size_str }}</td>
<td class="actions">
<span class="edit-attachment-buttons">
- <a type="submit" href="/user_uploads/{{path_id}}" class="button rounded small sea-green tippy-zulip-delayed-tooltip" data-tippy-content="{{t 'Download' }}" id="download_attachment" download>
+ <a type="submit" href="/user_uploads/{{path_id}}" class="button rounded small sea-green tippy-zulip-delayed-tooltip download-attachment" data-tippy-content="{{t 'Download' }}" download>
<i class="fa fa-download sea-green" aria-hidden="true"></i>
</a>
</span>