Live app code test code modifications not reflected in front-end

Hi,

Coming from developing on joomla/wordpress I am curious over discourse backend file modification functionning through docker.
I have read the documentation on how to create a plugin(How can I make my own Discourse plugins? - #2 by merefield), but I don’t want to do that yet, I just want to be able to test code live

On a non docker MVC installation, doing a modification on a file via ftp, it was instantly reflected and while with docker I understand the need to rebuild the app to apply permanent modification, what if you want to test things live?

Live test code modifications don’t seem to work :

For example, I want to disable searches for anonymous users so I edited :
/var/www/discourse/app/controllers/search_controller.rb by adding “if current_user.present?” after “def show” with an end at the bottom of the function.

I was surprised that this does not have any effect on front end, and even renaming the conrolller to search_controllerold would not have any effect on the searches.

But somehow, renaming an image in /var/www/discourse/public/images# would hide the image on front-end :slight_smile: !

Can anyone please tell me how things work here, is there another cached version of the system more than just the app that starts from its image?

Thank you

Ok, I found that code gets modified if I modify the files in ./javascripts/discourse/node_modules/.embroider/rewritten-app/
It feels better now :slight_smile:

1 Like

That looks more than an anti-pattern.

That will likely get replaced with every build.

Look at the material in Documentation > Developer Guides and the countless real open source examples to see how to modify the front end via Theme component and both the front and back via Plugin

2 Likes

Thank you for the share ! I will check this and maybe get involved into it more seriously at some point, for the moment I just wanted to test live modifications and don’t get why they don’t show up in front end as easy as it was with an ftp on joomla/wordpress even though I am inside the app.