DNNCommunity/DNN.Forum

Some PostConnector (public API) improvements

Closed this issue · 8 comments

Some nice things to have in public API:

  • Ability to customize IsPinned then calling SubmitExternalPost() - currently always False, and PostValidation() method is private.
  • Ability to get newly created post id somehow - e.g. to generate link to it. PostToDatabase() returns it, but it also private and heavily wrapped in PostValidation().

Need to see, especially this new post id is buried quite deep.

Added another SubmitExternalPost with IsPinned as a new parameter

Wow, thanks for IsPinned - you are very kind! It will sure help with creating new forum post to discuss from external source!

About new post id: it could be resolved by returning some structure (or class) like that:

public struct SubmitPostResult
{
    public int PostId;
    public PostMessage PostMessage;
}

It can be extended in the future to have more fields to return. But surely it looks like major change in API.

Similar approach could be applied to pass parameters to SubmitExternalPost():

public struct SubmitPostParams
{
    public int TabId;
    public int ModuleId;
    public int ForumId;
    public int UserId;
    ...
    public List<Term> Terms;
}

public SubmitPostResult SubmitExternalPost (SubmitPostParams postParams);

That was my idea as well, but yes, there is lots of places where this is checked. Need to review this carefully.

Thanks, I'll check it.

Seems to work as intended.

Excellent!