FriendsOfFlarum / user-directory

The permission based public user directory extension for your Flarum forum.
https://discuss.flarum.org/d/5682
MIT License
22 stars 17 forks source link

Unchecking "Add link on homepage for users able to see the directory" causes the "canSeeUserDirectoryLink" attribute to be false #63

Closed rafaucau closed 3 years ago

rafaucau commented 3 years ago

I unchecked the Add link on homepage for users able to see the directory option to add a link to the User Directory elsewhere.

{app.forum.attribute('canSeeUserDirectoryLink') && (
  <LinkButton icon="far fa-address-book" href={app.route('fof_user_directory')}>
    {app.translator.trans('fof-user-directory.forum.page.nav')}
  </LinkButton>
)}

And it wouldn't work. It turned out that after unchecking this option, the canSeeUserDirectoryLink attribute is false.

image image This option should be independent of permissions.

clarkwinkelmann commented 3 years ago

canSeeUserDirectoryLink is true if you have fof.user-directory.view permission AND the fof-user-directory-link setting is turned on. It's defined here https://github.com/FriendsOfFlarum/user-directory/blob/master/src/PermissionBasedForumSettings.php#L25

What you're describing seems to be the correct behavior. You disable the link setting, the link boolean goes to false (?)

The whole purpose of this attribute is to control whether the link will be inserted.

If you need to know whether the user has access to the user directly, you could expose a new attribute that is only based on whether you have fof.user-directory.view permission. It could be called just canSeeUserDirectory.

Ralkage commented 3 years ago

Based on @clarkwinkelmann's recent comment, it's safe to say that this is part of the intended functionality of this extension. Clark also added a tidbit of how you can get around this; in hindsight, we will proceed with closing this issue.