Pengin-Open-Source / pengin-pi

PENGIN PI! A CRM with the back bone of a feature light ERP system. Utilitarian in design, easy to extend, customize, and deploy. Made by a community, supported by Tobu Pengin.
GNU General Public License v3.0
9 stars 1 forks source link

[TASK] Global variable chat_bool #412

Open stuart909 opened 6 months ago

stuart909 commented 6 months ago
    @app.context_processor
    def inject_globals():
        company = model.Home.query.first() or DummyHome()
        name = company.company_name
        chat_bool = False
        return dict(company_name=name, chat_bool=chat_bool, is_admin=admin_permission.can())

Details We need to implement something like the above into the global variables.

The idea is we set the chat_bool to False the moment a new session is established to the website and chat, by default, will not load.

Additional Information Another alternative to the chatbool is adding the chat_bool variable at the end of the create_app file like timezone. This will require creation of a chat_bool variable in a template and the ID needs to be sent to the route when someone connects to the server, just like timezone. This methodology is optional.

Another consideration Another consideration is not creating chat_bool, and only create chat_bool when someone logs on. We can check for the existence of chat_bool with the app.before_request method if someone is logged in. If it doesn't exist, create it. Otherwise, process the toggle function as normal. The login scripts are in routes/auth and app init.