This project is read-only.

Why use custom controllers do display threads and forums?

Jul 1, 2013 at 5:34 PM
It seems to me that they do nothing (speaking of the Item() acions) that wouldn't be possible by using the built-in ItemController or Projections. But there is not content item authorization, on contrary to the built-in ItemController (i.e. you can't set permissions for a specific Forum or Thread as this is not checked).

Removing those would also render the custom DisplayRouteValues unnecessary.

BTW I also feel some redundancy in ForumService.Get() and ThreadService.Get(). Having some listing out of the box is nice, but IMO every effort to make the listing of content items better should go into Projector: if you have something there (e.g. eager-loading of records not, and this is where there's room for improvement) you have it for everything.
Jul 4, 2013 at 12:32 PM
The issue to do with authorization is around this line right?
        if (!Services.Authorizer.Authorize(Permissions.ViewContent, contentItem, T("Cannot view content"))) {
            return new HttpUnauthorizedResult();
        }
I could introduce this in to the controller and ditch the ViewPost permission. what do you think?

If you think I can remove the Item calls, how do you this this happening with the ThreadController for example?

I agree with the redundancy in the services, I tried to trim some of them down and want to trim them down a little bit more if I get a chance.
Jul 5, 2013 at 10:57 PM
Yes, the issue is that there's no check on the content item's permission. If you include that then indeed there's no need for a custom permission since you'll be able to set the permission for threads and forums for the content types and items.

ForumPart and ThreadPart both can return their lists from their driver (from a separate shape than their header, so it can be handled separately and hidden if one wants that). This way you can implement everything that's now unique in ForumController or ThreadController's Item() action by letting ItemController fetch the item itself in the background.

I'm a great fan of Projector so probably my opinion here is biased but alternatively I'd extend Projector to have thread and forum lists. The Forum and Thread content types could have ProjectionPart attached to display a list of items. Having this be connected to some pre-created but changeable query would be very sweet (like you could define the query item used in the type or part settings but probably override it with ProjectionPart from the item). Maybe this is just overcomplicating things...

Another idea: for threads the datetime of the last post could be stored in CommonPart.LastModifiedUtc to enable sorting of threads.
Jul 6, 2013 at 1:42 PM
Piedone wrote:
Another idea: for threads the datetime of the last post could be stored in CommonPart.LastModifiedUtc to enable sorting of threads.
I have been thinking this for quite sometime... The question I keep asking myself is that When you make a Post, do you modify the Thread.... I am not sure, I think yes/no/hmmm
Jul 6, 2013 at 1:43 PM
Doing that would make ordering alot easier too... It would remove all the HQL code I have.
Jul 6, 2013 at 8:44 PM
See? De-normalization is fun an instantly rewarding.

What about the controllers?
Jul 8, 2013 at 12:38 PM
DateTime code = done and pushed.

Not sure about the controllers yet, I need to do some work on the handlers as there is some inefficient code in there which will not be good for sites with high load.
Jul 8, 2013 at 1:06 PM
Great, many nice changes, thank you! Looking forward to the other news too.
Jul 8, 2013 at 4:07 PM
Okay I have just pushed the changes for permissions, can you please checkout the latest changeset and let me know what your thoughts are.

N
Jul 8, 2013 at 4:42 PM
Edited Jul 8, 2013 at 4:42 PM
Great enhancements, it works! I also very much like that if the user is not allowed to view the forum than won't be allowed to view its threads either.