backdrop-contrib / paragraphs

Paragraphs module to control your content flow
https://backdropcms.org/project/paragraphs
GNU General Public License v2.0
5 stars 11 forks source link

Images uploaded into Paragraph WYSIWYG text field disappear #65

Closed laryn closed 4 years ago

laryn commented 4 years ago

Reported to me from two different sites now, and sounds very similar to https://github.com/backdrop-contrib/paragraphs/issues/14 but that fix is still included and it was working fine until recently, so it must be something different. Images uploaded into a WYSIWYG text field within a Paragraph are not marked as permanent / no usage is added so they disappear after a short time when "garbage collection" happens.

Could it be related to Entity Plus dependency that was added in the latest 1.x-1.x? (Pinging @hosef in case he has any insight)

robertgarrigos commented 4 years ago

Sorry, I usually use markdown filter with paragraphs text fields. Never got it. I'll have a look.

laryn commented 4 years ago

This is a comment from @herbdool in a separate thread related to when this was happening in comments:

I narrowed it down to this: comment class needs to set a bundle like: "comment_node_post". Currently it's defaulting to the entity type which is "comment".

Perhaps the entity plus class needs to set a bundle? (shot in the dark but worth exploring)

oadaeh commented 4 years ago

@laryn what other modules do you have installed on those sites? How do you have the content type configured that is exhibiting the behavior? Also, I see that Paragraphs does not require Entity Plus, so I suspect that is not it, but I might be wrong.

oadaeh commented 4 years ago

BTW, I just installed the latest stable version via Drush: 1.x-1.0.1

oadaeh commented 4 years ago

I went through a series of tests on a plain site: 1) with Paragraphs only, 2) adding Entity Plus after Paragraphs was in use, and 3) with Paragraphs and Entity Plus installed together, and all three tests seem to work correctly, so there must be something specific about those sites: the modules that are installed on them, or how they are configured, or something else. It would help to know more about that. I also installed the latest stable version of Entity Plus via Drush: 1.x-1.0.7

laryn commented 4 years ago

@oadaeh Sorry I wasn't more clear on this -- it is a regression from 1.x-1.0.1 that shows up in the latest 1.x-1.x codebase (which has an Entity Plus dependency).

oadaeh commented 4 years ago

@laryn are you also using the 1.x version of Entity Plus, or some tagged version?

In my testing, it looks to me that this behavior started with this commit:

commit d2647ec1f3524a2b39f0701513e98aeebd234e4a (HEAD)
Author: Laryn - CEDC.org <laryn@cedc.org>
Date:   Fri Mar 6 11:45:41 2020 -0600

    #48: Entity Plus dependency

    Fixes a bunch of entity/theming/revisions issues.

When I checkout the commit before that one (which uses Entity, and not Entity Plus), the behavior is correct.

laryn commented 4 years ago

@oadaeh I'm using the latest Entity Plus (1.x-1.0.7). That makes sense with my experience in that it seems like the Entity Plus dependency was introduced at the same time that this issue began. So that seems to have solved a bunch of issues but caused another. It may be an issue in Entity Plus...

oadaeh commented 4 years ago

I just tested it with the Registration module. That module also has a dependency on Entity Plus and also exhibits the same behavior, so the culprit is in fact Entity Plus.

I looked at ParagraphsItemController::save() (which was removed in that commit) and compared it with EntityPlusController::save() & EntityStorageControllerInterface::save(). The ParagraphsItemController::save() method is very nearly identical to EntityStorageControllerInterface::save() (there is one addition in ParagraphsItemController::save()) and EntityPlusController::save() has many differences from the other two. Plus, the code in methods that are called from EntityPlusController::save() are also rather different from that which is called from the other to methods.

So, this is an Entity Plus bug and that code needs to be investigated to locate the change that must be made.

laryn commented 4 years ago

@oadaeh Thanks for helping me work through this... I didn't do the original port/creation of Entity Plus so don't have a specific answer as to why it is different. Any chance your fix from way back when might work here in the Entity Plus controller? I'll test it out and report back.

laryn commented 4 years ago

Moving this over to the Entity Plus queue.

laryn commented 4 years ago

FWIW I tried adding this in the EntityPlusController to no avail:

  public function bundle() {
    return $this->$bundleKey;
  }
oadaeh commented 4 years ago

Any chance your fix from way back when might work here in the Entity Plus controller?

My guess is that it will not fix the problem. I think the two issues are fundamentally different from each other.