Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Hide private spaces to guest #897

Open
hipoloco opened this issue Oct 13, 2016 · 1 comment
Open

[Feature] Hide private spaces to guest #897

hipoloco opened this issue Oct 13, 2016 · 1 comment

Comments

@hipoloco
Copy link

hipoloco commented Oct 13, 2016

In addition to this feature, I think the guests should not see private spaces. Although guests can not see information from private spaces, they neither should know that exist them.

@hipoloco
Copy link
Author

Some days ago I implemented a workaround for this feature (on v2.3.0 code). I don't know if this is the best solution. but it works. I edited _list_view.html.haml and _thumbnail_view.html.haml files as shown below:

_list_view.html.haml

-# locals:
-#   spaces (array of Space)
-#   user_spaces (array of Space): the spaces to which the user belongs
-#   extended (boolean): show extended information
-#   show_join_request (boolean): show link to a join request (if it exists)

- show_join_request ||= false
- extended ||= false

#spaces
  .content-block-middle.clearfix
    %ul.list-texts
      - if !user_signed_in?
        - filtered_spaces = spaces.select { |space| space.public == true }
      - else
        - filtered_spaces = spaces
      - if filtered_spaces.count > 0
        - filtered_spaces.each do |space|
          - is_member = user_spaces && user_spaces.include?(space)
          %li.list-text{:name => space.permalink}
            = render "spaces/unified_space", :space => space, :is_member => is_member, :extended => extended, :show_join_request => show_join_request
      - else
        - if !user_signed_in?
          = t(".no_public_spaces")
        - else
          = t(".no_spaces")

_thumbnail_view.html.haml

-# locals:
-#  spaces (array of Space)
-#  show_join_request (boolean): show link to a join request (if it exists)

- show_join_request ||= false

%ul.list-thumbnails
  - if !user_signed_in?
    - filtered_spaces = spaces.select { |space| space.public == true }
  - else
    - filtered_spaces = spaces
  - if filtered_spaces.count > 0
    - filtered_spaces.each do |space|
      %li.list-thumbnail-wrapper{ :name => space.permalink }
        = render "spaces/space_thumbnail", :space => space, :show_join_request => show_join_request
  - else
    - if !user_signed_in?
      = t(".no_public_spaces")
    - else
      = t(".no_spaces")

Also I created "no_public_spaces" string on each mconf.yml language file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants