Commit graph

8 commits

Author SHA1 Message Date
Mac Siri
678dda8cf4
Routine Rubopcop lint fixes (#17844)
* Routine Rubopcop lint fixes

* Undo app_secrets_spec changes

* Fix broken spec
2022-06-07 10:17:16 -04:00
Jeremy Friesen
7e62d8098f
Removing conditional for AdminMenu's spaces (#17162)
When we merge this, Forem admins will see the "Admin > Content Manager >
Spaces" section in their Admin area.  This will then allow them to
toggle on and off spaces.

Closes forem/forem#17161
2022-04-28 08:49:59 -04:00
Daniel Uber
8276d1d8c6
Remove profile admin feature flag (#17194)
Remove test cases built around it (modified when the guards were removed).
2022-04-11 09:27:35 -05:00
Jeremy Friesen
168698fe28
Conditionally removing listing from Admin > Consumer Apps menu (#17182)
Related to forem/forem#16437
2022-04-08 21:55:45 -04:00
Daniel Uber
2ddefcbba5
Remove guard clauses and update expectations (#17138) 2022-04-08 15:20:19 -05:00
Jeremy Friesen
b9b52c91a2
Adding Admin > Content Manager > Spaces menu item (#16951)
This menu item will show up once you have added the
`:limit_post_creation_to_admins` feature flag (regardless of whether
it is enabled or not).

If you wish to add the menu item:

```console
rails console runner "FeatureFlag.add(:limit_post_creation_to_admins)"
```

In "adding" the item, it will default to disabled.  However, as an
administrator you should now be able to toggle on and off the
authorization enforcement.

If you wish to remove the menu item:

```console
rails console runner "FeatureFlag.remove(:limit_post_creation_to_admins)"
```

Future plans for this will be to remove the `FeatureFlag.exist?`
conditional so that the menu item shows up.  A major consideration is
that we'll assume that all Forem's have a "default space" in which
folks (by default) can post.

Builds on forem/forem#16897
Closes forem/forem#16842
2022-03-23 08:55:50 -04:00
Jeremy Friesen
71e9f2bfb4
Refactoring AdminMenu and Menu towards classes (#16847)
As I was looking to implement the new Spaces feature (see
forem/forem#16842), I began looking at how to adjust the admin menu.  I
found the Menu and AdminMenu.  I wanted to add the "spaces" item under
the `:content_manager` scope.  Looking at the implementation, I saw I
would need some additional branching logic.

To get an understanding of the implementation, I chose factor towards
classes.

This refactor does a few things:

1) Clarifies a method name (e.g. "children?" becomes
   "has_multiple_children?")
2) Adds some tests of the menu implementation.
3) Removes deeply nested hashs in favor of first class objects.
4) Removes a complex method for determining menu visibility, instead
   favoring a method that either takes a boolean OR a lambda.

There are further refactors to consider, especially in regards to the
helper methods and some of the coercion of strings into different
formats.  But this refactor gets me the part I most am interested in:

Making it easier to specify a menu item as visible or not.
2022-03-21 13:31:20 -04:00
Jeremy Friesen
e1f7a6548c
Adding docs and specs to AdminMenu.nested_menu_items (#16888)
* Adding docs and specs to AdminMenu.nested_menu_items

This relates to PR forem/forem#16847 which addresses issue
forem/forem#16842.

The goal of this PR is to help me develop an understanding of the
AdminMenu so I can further extend it and better understand it.

There's also a bit of knowledge sharing that I'm looking for, and the
comments and tests are there to help "confirm" that knowledge.  There
might be more that I'd consider regarding a refactor, but I want to make
sure I'm on the right path before I go further.

tl;dr - this is the smallest commit I can make to begin to tease out an
understanding of the method I put under test.

* Update app/models/admin_menu.rb

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

* Adding more documentation

* Update app/models/admin_menu.rb

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2022-03-18 08:30:41 -04:00