Skip to content

Fix File attachments in proposals#10290

Merged
ahukkanen merged 2 commits intodecidim:developfrom
i-need-another-coffee:fix/10285
Feb 1, 2023
Merged

Fix File attachments in proposals#10290
ahukkanen merged 2 commits intodecidim:developfrom
i-need-another-coffee:fix/10285

Conversation

@alecslupu
Copy link
Copy Markdown
Contributor

🎩 What? Why?

There is an error occurring when an Admin is trying to add an optional Attachment into a Proposal even though the Proposal component is configure to allow attachment.

📌 Related Issues

Link your PR to an issue

Testing

  1. Go to proposal configuration admin panel
  2. Enable "Allow attachments"
  3. Create a Admin proposal, and attach a file
  4. Observe error
  5. Apply patch
  6. Create a Admin proposal, and attach a file
  7. See there is no error , and file is attached.

📷 Screenshots

Please add screenshots of the changes you're proposing
Description

♥️ Thank you!

@alecslupu alecslupu requested a review from a team January 29, 2023 17:42
@alecslupu alecslupu added module: proposals module: core type: fix PRs that implement a fix for a bug labels Jan 29, 2023
@alecslupu
Copy link
Copy Markdown
Contributor Author

The failing specs are caused by Picmo, which is fixed by #10291

@alecslupu alecslupu marked this pull request as ready for review January 30, 2023 10:21
@andreslucena andreslucena added the release: v0.27 Issues or PRs that need to be tackled for v0.27 label Feb 1, 2023
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

Tested locally on develop and bug is confirmed. Tested again with this patch applied and bug is gone.

As a sidenote (not in the scope of this fix), we should consider adding the multiple attachment support also for the admin panel that we have at the participant side right now.

Currently in admin:
Admin proposal attachments

Currently at the participant side:
Participant proposal attachments

Participant proposal attachment modal

@ahukkanen ahukkanen merged commit 9cc8463 into decidim:develop Feb 1, 2023
@ahukkanen
Copy link
Copy Markdown
Contributor

Ping @andreslucena @decidim/product

Please see the review I left above. The proposal attachments functionality is currently inconsistent between the admin side and the participant side.

@carolromero
Copy link
Copy Markdown
Member

@ahukkanen I agree. In fact in the front end the image and document input is split. Maybe we could simplify it so that it works the same on both sides.
image

I would leave the "Add attachment" option for everything, implement multiple attachment upload in the admin, and correct the inconsistency in the guidance texts for uploading documents and images. We should modify them by explaining that the first attached image is displayed on the card.

Do you want me to create the issue Antti, or you create it? Also, do you think this is something doable under the Maintainers scope of work or it's too much effort?

@ahukkanen
Copy link
Copy Markdown
Contributor

@carolromero

In fact in the front end the image and document input is split. Maybe we could simplify it so that it works the same on both sides.

It is also split in the admin panel right now. At admin, you can upload both image(s) and document:
Admin image gallery and document

I was actually only referring to the attachments control but after this comment I went ahead and looked at it again. Even funnier thing about this is that actually admin allows uploading multiple images but only one attachment. And in the participant side it is flipped. 😄

I would leave the "Add attachment" option for everything

I would not. For users it is conceptually important to separate the "main" image (i.e. the card image) of the proposal and any additional attachments they'd like to add.

And also, it becomes really hard to change the card image in case we put them to the same input. You would have to delete all the existing attachments, add the updated image as the first one, and finally re-add all the other attachments.

We do not currently have the support in the UI to reorder the attachments and the first image attachment is always used as the card/main image for the proposal. If the user has to know or guess this behavior, it will be confusing for most.

implement multiple attachment upload in the admin

Yes, this is what I would also do and what I was referring to above as well.

In the admin the upload functionality should match the participant side regarding both of these uploads (one image and multiple attachments).

correct the inconsistency in the guidance texts for uploading documents and images

I think the guidance is already good at the participant side, so if we apply the same guidance in the admin panel, it would be OK.

We should modify them by explaining that the first attached image is displayed on the card.

I'm not sure how easy this is to implement, it might get complex as we've tried to generalize the upload guidance texts so that we wouldn't have to define them for each and every upload button separately.

I would possibly separate this to its own issue, just in case it turns out to be complex to implement (I don't remember off the back of my head).

Do you want me to create the issue Antti, or you create it?

I'd kindly ask you to review what I wrote above and see if it makes sense to you. If it does, go ahead and create the issue (or feel free to adjust).

Also, do you think this is something doable under the Maintainers scope of work or it's too much effort?

I would think this is doable in the maintainers scope but not necessarily with the highest possible priority. I'd give it low or medium priority.

arusa pushed a commit to DecidimAustria/decidim that referenced this pull request Feb 25, 2023
* Fix File attachments in proposals

* Fixing Failing specs
Conflicts:

	decidim-core/app/commands/decidim/attachment_methods.rb
@alecslupu alecslupu deleted the fix/10285 branch May 8, 2023 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: core module: proposals release: v0.27 Issues or PRs that need to be tackled for v0.27 type: fix PRs that implement a fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Proposal with an attached file - Admin side only

4 participants