Port FileAttachmentThumbnailView to TS/spina.
Review Request #13221 — Created Aug. 17, 2023 and submitted
This ports the
FileAttachmentThumbnail
view to TS/spina. The view is also
renamed toFileAttachmentThumbnailView
to follow our naming conventions.
- Ran JS unit tests.
- Tested using/viewing file attachment thumbnails on the review request,
in change descriptions, and in file review UIs. - Tested uploading/deleting files.
- Tested all the file actions.
Summary |
---|
Description | From | Last Updated |
---|---|---|
The summary and description need to be separated by a blank line. |
|
|
I don't know that we've standardized this yet for TypeScript, but we should probably have required fields before optional fields. … |
|
|
While here, can you turn this (and others) into a dedent, so we can save on the join? |
|
|
Worth mentioning, we'll do a $() for every one of these when constructing the object (since these are instance attributes, … |
|
|
Let's organize _ before #, since _ is semi-public and # is semi-private. We haven't done this elsewhere, but we … |
|
|
onInitialRender() shouldn't return anything. If it did, we'd actually want to use this instead of the class name as the … |
|
|
Missing a trailing comma. |
|
|
Missing a trailing comma. |
|
|
ESLint will complain about the ordering here. This should be in alphabetical order. |
|
|
Let's define the types for these here. |
|
|
Since we're touching this, can we change var to const, add a trailing comma on canEdit, and sort the object … |
|
|
These default values can all be specified in the instance definitions. |
|
|
Parens around val aren't necessary here. |
|
|
If you pull, you can now add: import { suite } from '@beanbag/jasmine-suites'; |
|
|
Just realized, since we renamed FileAttachmentThumbnail to FileAttachmentThumbnailView, we should at least document the name in a Version Changed, and … |
|
|
There's a section header for this: /** * ... * * Deprecated: * 6.0 */ When we finally have generated … |
|

Change Summary:
Missed one
gettext
call.
Commits: |
|
||||||
---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+428 -220) |
Checks run (2 succeeded)
-
-
reviewboard/static/rb/js/reviews/views/fileAttachmentThumbnailView.ts (Diff revision 2) The summary and description need to be separated by a blank line.
-
reviewboard/static/rb/js/reviews/views/fileAttachmentThumbnailView.ts (Diff revision 2) I don't know that we've standardized this yet for TypeScript, but we should probably have required fields before optional fields. This better matches the requirements imposed in Python for dataclasses, and how we often document things.
-
reviewboard/static/rb/js/reviews/views/fileAttachmentThumbnailView.ts (Diff revision 2) While here, can you turn this (and others) into a
dedent
, so we can save on the join? -
reviewboard/static/rb/js/reviews/views/fileAttachmentThumbnailView.ts (Diff revision 2) Worth mentioning, we'll do a
$()
for every one of these when constructing the object (since these are instance attributes, not class attributes -- silly ES6 classes).This is fine if we want that as the default, but since these are set in
render
, it might be a better failure to leave these asundefined
, at least in some cases? -
reviewboard/static/rb/js/reviews/views/fileAttachmentThumbnailView.ts (Diff revision 2) Let's organize
_
before#
, since_
is semi-public and#
is semi-private.We haven't done this elsewhere, but we should probably also mark the
_
ones with theprivate
keyword, unless we need them in tests. -
reviewboard/static/rb/js/reviews/views/fileAttachmentThumbnailView.ts (Diff revision 2) onInitialRender()
shouldn't return anything.If it did, we'd actually want to use
this
instead of the class name as the type. -
reviewboard/static/rb/js/reviews/views/fileAttachmentThumbnailView.ts (Diff revision 2) Missing a trailing comma.
-
reviewboard/static/rb/js/reviews/views/fileAttachmentThumbnailView.ts (Diff revision 2) Missing a trailing comma.
-
reviewboard/static/rb/js/reviews/views/fileAttachmentThumbnailView.ts (Diff revision 2) ESLint will complain about the ordering here. This should be in alphabetical order.

Testing Done: |
|
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Commits: |
|
||||||||||||
Diff: |
Revision 3 (+516 -300) |
Checks run (2 succeeded)
-
-
-
reviewboard/templates/reviews/changedesc_file_attachment.html (Diff revision 3) Since we're touching this, can we change
var
toconst
, add a trailing comma oncanEdit
, and sort the object keys here?

Commits: |
|
||||||
---|---|---|---|---|---|---|---|
Diff: |
Revision 4 (+524 -308) |
Checks run (2 succeeded)

Commits: |
|
||||||
---|---|---|---|---|---|---|---|
Diff: |
Revision 5 (+596 -364) |
Checks run (2 succeeded)
-
-
reviewboard/static/rb/js/reviews/views/fileAttachmentThumbnailView.ts (Diff revision 5) These default values can all be specified in the instance definitions.
-

Change Summary:
- Specifies default values in the instance definitions.
- Imports
suite
from@beanbag/jasmine-suite
. - Tried to fix any ESLint/TS warnings/errors that I'm able to.
Commits: |
|
||||||
---|---|---|---|---|---|---|---|
Diff: |
Revision 6 (+612 -388) |
Checks run (2 succeeded)
-
-
reviewboard/static/rb/js/reviews/views/fileAttachmentThumbnailView.ts (Diff revisions 5 - 6) Parens around
val
aren't necessary here.

Commits: |
|
||||||
---|---|---|---|---|---|---|---|
Diff: |
Revision 7 (+612 -388) |
Checks run (2 succeeded)
-
Change looks ready to go. Just one thing I want to make sure we have an answer for.
-
reviewboard/static/rb/js/reviews/views/fileAttachmentThumbnailView.ts (Diff revision 7) Just realized, since we renamed
FileAttachmentThumbnail
toFileAttachmentThumbnailView
, we should at least document the name in aVersion Changed
, and if there's any reason extensions ever needed to refer to this by name (I don't think so but maybe?) then we'd want an alias from the old name to new name.

Commits: |
|
||||||
---|---|---|---|---|---|---|---|
Diff: |
Revision 8 (+644 -388) |
Checks run (2 succeeded)
-
-
reviewboard/static/rb/js/reviews/views/fileAttachmentThumbnailView.ts (Diff revisions 7 - 8) There's a section header for this:
/** * ... * * Deprecated: * 6.0 */
When we finally have generated docs for this, that'll show up with a deprecation notice.

Commits: |
|
||||||
---|---|---|---|---|---|---|---|
Diff: |
Revision 9 (+646 -388) |