Hi there,
I've found that this specific snippet is producing a false negative on older rocket.chat instances.
|
findCustomRoles(options?: FindOptions<IRole>): FindCursor<IRole> { |
|
const query: Filter<IRole> = { |
|
protected: false, |
|
}; |
|
|
|
return this.find(query, options || {}); |
|
} |
In my Rocket.Chat instance, I have custom roles set up which are already a few years old.
When looking in the db, they're all missing the protected tag within the db.
I stumbled over this issue, when I wanted to get a specific custom role, but my code failed, saying that it couldn't find the role in question.
Could this code be changed, so that it negates everything? e.g. instead of hard-match protected: false, match for the opposite with the protected: { $ne: true }, I think this should also cover non-existend protected tags like in my case.
Thanks.
Hi there,
I've found that this specific snippet is producing a false negative on older rocket.chat instances.
Rocket.Chat/packages/models/src/models/Roles.ts
Lines 139 to 145 in 85fc0dd
In my Rocket.Chat instance, I have custom roles set up which are already a few years old.
When looking in the db, they're all missing the
protectedtag within the db.I stumbled over this issue, when I wanted to get a specific custom role, but my code failed, saying that it couldn't find the role in question.
Could this code be changed, so that it negates everything? e.g. instead of hard-match
protected: false, match for the opposite with theprotected: { $ne: true }, I think this should also cover non-existendprotectedtags like in my case.Thanks.