1. 01 Sep, 2016 5 commits
    • azul's avatar
      upgrade: drop outdated config settings (rails 4.0) · 6937f342
      azul authored
      6937f342
    • azul's avatar
      move the WikiExtensions into Wiki namespace · 8933b86c
      azul authored
      8933b86c
    • azul's avatar
      move remaining associations into user namespace · 3aa324a7
      azul authored
      3aa324a7
    • azul's avatar
      namespace: asset for all the asset things · 3c9d9525
      azul authored
      Also separate Asset::Storage::Path from Asset::Storage
      3c9d9525
    • azul's avatar
      namespace Activity and remove from autoload_path · 4955ee0a
      azul authored
      We used to have app/models/activity in the autoload path and had classes
      like FriendActivity < Activity
      
      This conflicts with how rails4 handles class lookup. Plus it clutters the
      autoload path and makes it harder to find classes.
      
      Using proper namespaces instead now and I'm about to apply this to all the
      different namespace avoiding things like ...Extension. We can use classes
      as namespaces as long as we:
      * make sure to define things inside the namespace in one line or in a
         class instead of a module block:
         ```ruby
           class Activity::Friend < Activity
           # or
           class Activity
             class Friend < ::Activity
         ```
       * have names inside the namespaces that do not conflict with global names
      
      The second one is important because if PrivatePost is already loaded and
      Activity::PrivatePost is referenced somewhere it will be found as an
      constant inside the Object namespace of Activity (since Activity is a class).
      So instead of loading Activity::PrivatePost we'll see a warning that global
      constant PrivatePost was referenced by Activity::PrivatePost.
      
      So how do we prevent this?
      * do not clutter the global namespace
      * use more specific names in other namespaces
        -> in this case i am renaming PrivatePostActivity to Activity::MessageSent
        and not Activity::PrivatePost
      4955ee0a
  2. 28 Oct, 2015 1 commit
  3. 21 Jul, 2015 1 commit
  4. 25 Jun, 2015 1 commit
    • azul's avatar
      fix castle gates reloading in development · 043c351c
      azul authored
      Here's what was going on...
      
      When loading a page after changing a file in development the server
      would crash indicating that config/permissions.rb was loaded twice.
      Behind the scenes rails was trying to load the constant Group inside
      the ContextPagesController. So it first looked up
        ContextPagesController::Group
      and then Group itself. Both lookups fired the after_reload callbacks.
      This way the callbacks for Group were run twice leading to errors because
      duplicate gates were defined.
      
      What are we doing now?...
      
      Now we load config/permissions.rb inside a config.to_prepare block.
      Here's what the documentation says about that hook:
      ```
        to_prepare: Run after the initializers are run for all Railties
        (including the application itself), but before eager loading and
        the middleware stack is built.
        More importantly, will run upon every request in development, but
        only once (during boot-up) in production and test.
      ```
      
      We also use require_dependency instead of plain require. This way the file
      will actually be reloaded when models are reloaded.
      043c351c
  5. 23 Jun, 2015 3 commits
    • azul's avatar
      namespace all the tracking things · 4668ea6b
      azul authored
      Tracking now is Tracking::Page.
      4668ea6b
    • azul's avatar
      acae4e8c
    • azul's avatar
      track_actions for all participation tracking · 4436e29d
      azul authored
      Allows us to remove UserParticipationObserver and GroupParticipationObserver.
      
      All changes to participations are now tracked by PageHistory::UpdateParticipation.
      This will test it's subclasses if they take care of the participation in question.
      The first subclass for which Class.tracks(changes, participation) returns true
      will be used.
      
      This allows us to handle different changes in different classes without a central
      registry. It requires however for all classes to be defined in the same file or
      the use of require_dependency directives. For now we still have all PageHistory
      subclasses in one file.
      4436e29d
  6. 16 Jun, 2015 1 commit
  7. 15 Jun, 2015 1 commit
  8. 12 Jun, 2015 1 commit
  9. 11 Jun, 2015 7 commits
  10. 28 May, 2015 1 commit
    • azul's avatar
      bring back ErrorNotFound, drop per site i18n · 6f0b4b56
      azul authored
      ErrorNotFound is similar to ActiveRecord::RecordNotFound - but it allows
      specifying the type of thing that was not found for more detailed error
      messages.
      
      For the translations we use cascading translations. So say a group was not
      found... we will lookup the following:
      exception.title.group.not_found
      exception.title.not_found
      exception.not_found
      not_found
      
      For all of these %{thing} will be interpolated with a translation of :group.
      If there is no translation for the given class of things it will be an empty
      string.
      
      In order for the cascading translation to work we have do drop the support
      for site specific translations. Otherwise the lookup will start with a
      cascade from:
      site.exception.title.group.not_found
      and succeed when looking up 'not_found'.
      So it won't process the more detailed cascade correctly.
      
      Alternatively we could add the site scope last. But I think site specific
      translations are not something we will need any time soon and it adds a lot of
      complexity. Instance specific translations can easily be put in
        /extensions/locales
      and overwrite the defaults.
      6f0b4b56
  11. 21 May, 2015 2 commits
    • azul's avatar
      use custom subclass of AD::PublicExceptions · f657b301
      azul authored and azul's avatar azul committed
      For a 404 it will use our own controller and fall back to the standard pages in public.
      Everything else still uses the ActionDispatch::PublicExceptions. We still try to rescue
      everything else within the app anyway.
      In case there is a 500 (or 422) we do not rely on the ExceptionsController but use a plain
      file for now.
      f657b301
    • azul's avatar
      first take on using an exception app for 404s · 09523369
      azul authored and azul's avatar azul committed
      09523369
  12. 19 May, 2015 1 commit
  13. 08 May, 2015 3 commits
  14. 06 May, 2015 3 commits
    • azul's avatar
      cleanup: remove all traces of MODS · 63f3ba3d
      azul authored
      We can bring them back in case we need them again at some point.
      
      Rails seems to have it's own mechanisms for allowing such things now such
      as the engine load order and overwriting model behaviour by including
      Concerns in config.to_prepare.
      
      I think this also does what we want in terms of reloading files in development
      and caching them in production.
      63f3ba3d
    • azul's avatar
      use initializer method for page registration · 340d84ad
      azul authored
      Not sure which one i prefer. initializer method allows specifying the
      order more explicitly and could probably be combined into a
      register_page method to be included in all Page Engines
      340d84ad
    • azul's avatar
      3cfa0652
  15. 22 Apr, 2015 2 commits
  16. 20 Jan, 2015 1 commit
  17. 09 Oct, 2014 1 commit
  18. 17 Sep, 2014 1 commit
  19. 09 Sep, 2014 1 commit
    • azul's avatar
      set config.secret_token · 01ad6721
      azul authored
      I had moved it into config.session_store[:secret] which was obviously wrong.
      
      Rails is demanding this or won't render meaningful pages.
      
      However the config setting in the session_store initializer used to be Cookie_secret.
      I have not found any documentation on cookie_secret. config/initializers/cookie_verfification_secret.rb states we do not want a cookie_verification_secret.
      
      The CHANGELOG for rails 3 states:
      Renamed config.cookie_secret to config.secret_token and pass it as env key.
      
      So I assume 'secret_token' is what we want.
      01ad6721
  20. 04 Sep, 2014 1 commit
  21. 03 Sep, 2014 2 commits