!vVcsnwMNPHhwWsmXST:matrix.org

📣 Support Devs

244 Members
technical staff here!9 Servers

Load older messages


SenderMessageTime
18 Sep 2024
@telegram_392356408:t2bot.ioPau Parals yes hadrien. we did this pr yesterday that gives a temporally solution: https://github.com/decidim/decidim/pull/13402 08:50:36
20 Sep 2024
@radekderesz:matrix.orgRadosław Deresz joined the room.13:42:58
@radekderesz:matrix.orgRadosław DereszHi, we thought about using smsapi.pl It does support OAuth2. However, if I understand correctly, OICD is a distinct thing? Their doc doesn't mention it at all, so I assume it is not supported. It is accessible here, if you could confirm that: https://www.smsapi.com/docs/ If that's the case, using it would be more complicated, as it would have to be combined with another OIDC provider, I guess?13:53:12
22 Sep 2024
@azharul-lincoln:matrix.orgAzharul Lincoln joined the room.05:57:46
23 Sep 2024
@ralfi:hasihome.ddnss.de@ralfi:hasihome.ddnss.de left the room.06:43:27
@telegram_343214:t2bot.ioIvan Vergés Hi, I've been able to identify the cause of the bug relating to the cached images, here is the report https://github.com/decidim/decidim/issues/13422 09:14:00
@basicavisual:matrix.orgAli G

Hello all! Have a support question about monkeypatching Decidim Decidim::AccountForm. Seems any method I try to use brings up a validation error: /activemodel-6.0.4.1/lib/active_model/validations/validates.rb:121:in `rescue in block in validates': Unknown validator: 'ValidEmail2::EmailValidator' (ArgumentError) . Apparently as soon as I reopen or call Decidim::AccountForm to place the patch, wither using class_eval, prepend or include it fails to load the validator on line 23: validates :email, presence: true, 'valid_email_2/email': { disposable: true }. Has happened with other patches too, for example, if I try to patch Decidim::User it'll fail to validate has_one_attached :avatar even thought I am not touching that validator with my patch.I guess it is not loading the files properly. Does anybody have a clue as to what is the better procedure to monkeypatch in this way? I put together a simple example:

https://gist.github.com/basicavisual/fe0030c68c44f9a4e1898b0f613d11cf

20:12:40
@basicavisual:matrix.orgAli G *

Hello all! Have a support question about monkeypatching Decidim, for example, Decidim::AccountForm. Seems any method I try to use brings up a validation error: /activemodel-6.0.4.1/lib/active_model/validations/validates.rb:121:in `rescue in block in validates': Unknown validator: 'ValidEmail2::EmailValidator' (ArgumentError) . Apparently as soon as I reopen or call Decidim::AccountForm to place the patch, wither using class_eval, prepend or include it fails to load the validator on line 23: validates :email, presence: true, 'valid_email_2/email': { disposable: true }. Has happened with other patches too, for example, if I try to patch Decidim::User it'll fail to validate has_one_attached :avatar even thought I am not touching that validator with my patch.I guess it is not loading the files properly. Does anybody have a clue as to what is the better procedure to monkeypatch in this way? I put together a simple example:

https://gist.github.com/basicavisual/fe0030c68c44f9a4e1898b0f613d11cf

20:12:51
@basicavisual:matrix.orgAli G *

Hello all! Have a support question about monkeypatching Decidim, for example, Decidim::AccountForm. Seems any method I try to use brings up a validation error: /activemodel-6.0.4.1/lib/active_model/validations/validates.rb:121:in `rescue in block in validates': Unknown validator: 'ValidEmail2::EmailValidator' (ArgumentError) . Apparently as soon as I reopen or call Decidim::AccountForm to place the patch, either using class_eval, prepend or include it fails to load the validator on line 23: validates :email, presence: true, 'valid_email_2/email': { disposable: true }. Has happened with other patches too, for example, if I try to patch Decidim::User it'll fail to validate has_one_attached :avatar even thought I am not touching that validator with my patch.I guess it is not loading the files properly. Does anybody have a clue as to what is the better procedure to monkeypatch in this way? I put together a simple example:

https://gist.github.com/basicavisual/fe0030c68c44f9a4e1898b0f613d11cf

20:13:12
@basicavisual:matrix.orgAli G *

Hello all! Have a support question about monkeypatching Decidim, for example, Decidim::AccountForm. Seems any method I try to use brings up a validation error: /activemodel-6.0.4.1/lib/active_model/validations/validates.rb:121:in `rescue in block in validates': Unknown validator: 'ValidEmail2::EmailValidator' (ArgumentError) . Apparently as soon as I reopen or call Decidim::AccountForm to place the patch, either using class_eval, prepend or include it fails to load the validator on line Decidim::AccountForm:23 validates :email, presence: true, 'valid_email_2/email': { disposable: true }. Has happened with other patches too, for example, if I try to patch Decidim::User it'll fail to validate has_one_attached :avatar even thought I am not touching that validator with my patch.I guess it is not loading the files properly. Does anybody have a clue as to what is the better procedure to monkeypatch in this way? I put together a simple example:

https://gist.github.com/basicavisual/fe0030c68c44f9a4e1898b0f613d11cf

20:13:42
@hfroger:matrix.orgHadrien Froger

hi ali, all good?
Let say you are overriding AccountForm with the module you sent.
The override contains map_model that will replace the Decidim::AccountForm#map_model. When you call super, it will call map_model of the Decidim::AccountForm parent (Decidim::Form).

So at the end, your form does not have the right mapping and raise a validation error

20:19:40
@hfroger:matrix.orgHadrien Froger

To do this, I create an alias in the override:
'''
alias :decidim_original_map_model, :map_model

def map_model(model)
decidim_original_map_model(model)

your logics

end
'''

Warning: I am in my phone doing by head, might have some errors there

20:24:57
@hfroger:matrix.orgHadrien Froger there is also an alternative with the prepend/extends. To know what you are doing, and calling the super method, Use your console and do a Decidim::AccountForm.ancestors to check the inheritage.
This is maybe nicer than the alias.
20:29:37
@hfroger:matrix.orgHadrien Froger * hi ali, all good?
Let say you are overriding AccountForm with the module you sent.
The override contains map_model that will replace the Decidim::AccountForm#map_model (when using include). When you call super, it will call map_model of the Decidim::AccountForm parent (Decidim::Form).
So at the end, your form does not have the right mapping and raise a validation error
20:30:10
@hfroger:matrix.orgHadrien Froger* there is also an alternative with the prepend/extends. To know what you are doing, and calling the super method, Use your console and do a Decidim::AccountForm.ancestors to check the inheritage.
This is maybe nicer than the alias, and there you can use super20:30:58
@basicavisual:matrix.orgAli G

Hey Hadrien! long time no see! thanks for the response. I'll check exactly if map_model is even inherited because it is not present in AccountForm, however if I remove the super keyword I get get the same error.

Just double checked if I go the prepend or include route i'll get undefined method attribute' for Decidim::AccountFormOverride:Module (NoMethodError) Did you mean? attr_writer mind you this code worked in :classic mode, it is only after switching to :zeitwerk (yes... i know) that it is breaking so I suspect I'm missing something obvious

20:37:39
@basicavisual:matrix.orgAli GIf I call Decidim::AccountForm from application.rb I get that validation error so I don't think it has to do with the code in the patch itself, just with when am I choosing to call it20:39:40
@basicavisual:matrix.orgAli G * If I call Decidim::AccountForm from within the config.to_prepare block in application.rb I get that validation error so I don't think it has to do with the code in the patch itself, just with when am I choosing to call it 20:40:42
@basicavisual:matrix.orgAli G * If I call Decidim::AccountForm from within the config.to_prepare block in application.rb I get that validation error so I don't think it has to do with the code in the patch itself, just with when am I choosing to call it 20:40:59
@basicavisual:matrix.orgAli G * If I call Decidim::AccountForm from within the config.to_prepare block in config/application.rb I get that validation error so I don't think it has to do with the code in the patch itself, just with when am I choosing to call it 20:41:33
@basicavisual:matrix.orgAli G *

Hey Hadrien! long time no see! thanks for the response. I'll check exactly if map_model is even inherited because it is not present in AccountForm, however if I remove the super keyword I get get the same error.

Just double checked if I go the .prepend or .include route i'll get undefined method attribute' for Decidim::AccountFormOverride:Module (NoMethodError) Did you mean? attr_writer mind you this code worked in :classic mode, it is only after switching to :zeitwerk (yes... i know) that it is breaking so I suspect I'm missing something obvious

20:44:01
@hfroger:matrix.orgHadrien Froger

sorry, didn't check the code of the AccountForm. Indeed your code looks correct and the error you get is strange.
So from what I understand you make a patch directly in the app that run the decidim. That's something I never did :)

I read things here https://rewind.com/blog/zeitwerk-autoloader-rails-app/ that tells me it is nothing trivial to inject code in a rails engine, as each engine have its own inflector.

soooo I am afraid I can't help in this one ;)

22:10:00
@basicavisual:matrix.orgAli Gwhat would your normal approach be? abstract this to a gem?22:11:13
@hfroger:matrix.orgHadrien Frogeryes, I do this. A gem that's will add dependencies to decidim-whatever I need to patch, and patch it from the engine.rb22:12:56
@hfroger:matrix.orgHadrien Froger

but hey, never had this issue, and I did not started to move to 0.28 our modules yet. Sooo maybe it does not resolve your issue.

When I have these edge case, I look at decidim-awesome engines and overwrites, most of the time it gives me the insights to move forward my patches. Maybe having.a read on the last develop version there gives you some hints

22:21:43
24 Sep 2024
@hamelinmultimedia:matrix.orghamelinmultimedia joined the room.22:37:55
26 Sep 2024
@hfroger:matrix.orgHadrien Froger

hi! how are you with this?
Just having an idea. What if you reference account with its absolute form?

::Decidim::AccountForm.prepend Decidim::AccountFormOverride

Reading more about zeitwerk, it looks like this kind of reference does make a difference.

16:26:09
27 Sep 2024
@telegram_194618226:t2bot.ioAlex Garcia joined the room.06:58:16
@telegram_194618226:t2bot.ioAlex Garcia https://www.linkedin.com/posts/alfredopons_linux-opensource-realtime-activity-7245117830096969728-C5dO?utm_source=share&utm_medium=member_android 06:56:09
10 Oct 2024
@telegram_500738289:t2bot.ioAlexandru LupuHello All! Starting from today you may notice the decidim pipelines in github actions failing. This may be caused by Github Actions rolling out Ubuntu 24.0.x as ubuntu-latest. The errors you may see are: - "You must have ImageMagick or GraphicsMagick installed" - "Invalid platform, must be running on Ubuntu 16.04/18.04/20.04/22.04, ..." To fix pipeline errors in modules or forks, you may need to patch the actions, replacing: - runs-on: ubuntu-latest +runs-on: ubuntu-22.04 We already opened the PR on Decidim main repo. ( #13513 )07:39:31

Show newer messages


Back to Room ListRoom Version: 6