MMM-Facial-Recognition icon indicating copy to clipboard operation
MMM-Facial-Recognition copied to clipboard

Everyone class not working - FIXED

Open FeRaaC opened this issue 8 years ago • 6 comments

Hi, our everyoneClass was not working. Being more precise, it didn't load the modules which were tagged for everyone. To fix it you need to add just two little things in the MMM-Facial-Recognition.js:

Line 90 to 94 old code:

if (payload.user == -1){
	this.current_user = this.translate("stranger")
        this.current_user_id = payload.user;
}

Our "fixes":

if (payload.user == -1){
	this.current_user = this.translate(this.config.everyoneClass)
	this.current_user_id = payload.user;
	this.login_user()
}

If you want to still have the login message being "Hello Stranger" you need to name your everyoneClass "Stranger"

Greetings Matze

FeRaaC avatar Jan 17 '17 15:01 FeRaaC

Why isn't this integrated via a PR?

stanchanpsu avatar Jan 31 '17 21:01 stanchanpsu

I don't think this is the correct fix. The correct fix should be line 76 change from:

MM.getModules().withClass(this.config.defaultClass).exceptWithClass(this.config.everyoneClass).enumerate(function(module) {

to

MM.getModules().withClass(this.config.defaultClass).enumerate(function(module) {

Because when you logout_user, the default classes should show regardless if it also has the everyone class.

Then lines 90-94 can remain the same.

stanchanpsu avatar Jan 31 '17 21:01 stanchanpsu

True, was just a small try form myself. But you are right.

FeRaaC avatar Feb 14 '17 15:02 FeRaaC

Please define not working :) It does work together with the default class doesn't it? Not sure why I did this but I had a reason back then. If you have a better approach send a PR :)

paviro avatar Apr 02 '17 10:04 paviro

To me the issue is easily visible for a module which only has the 'everyone' class... It does not show when a user is logged in

I created PR #46 to solve this.

@paviro Really great module, thank you so much ! I'm thinking of also creating two more classes: human (for module you want to display when somebody has been seen, stranger or not), and stranger (when somebody is seen but not a known user).

da4throux avatar May 27 '17 16:05 da4throux

I am sorry for my late response... I will look into your PR.

paviro avatar Apr 25 '18 11:04 paviro