~jpgleeson/caint

78b029cb09efba2560de84d5cdea8c3b93688e6f — jpgleeson 1 year, 5 months ago 33ef43d
ADD: Per thread automatic approval of comments

Threads have a property that allows comments posted in them to be automatically approved. This is toggleable in the dashboard for each thread.
2 files changed, 5 insertions(+), 0 deletions(-)

M Controllers/CommentsController.cs
M Models/Thread.cs
M Controllers/CommentsController.cs => Controllers/CommentsController.cs +3 -0
@@ 149,6 149,7 @@ namespace caint.Controllers
            var thread = await _context.threads.FindAsync(comment.threadId);

            string tenantName = thread.hostname;
            bool noApproval = thread.noApproval;

            var tenant = _context.tenants.Where(x => x.tenantName == tenantName).FirstOrDefault();
            if (tenant == null)


@@ 158,6 159,8 @@ namespace caint.Controllers
            else
            {
                comment.ownerId = tenant.ownerId;

                comment.approved = noApproval;
                
                if (tenant.active)
                {

M Models/Thread.cs => Models/Thread.cs +2 -0
@@ 9,6 9,8 @@ namespace caint.Models
        public string path { get; set; }

        public string ownerId { get; set; }

        public bool noApproval { get; set; }
    }

    public class ThreadDTO