From 3c5280119357e3742811fd724601d0bef01bcb29 Mon Sep 17 00:00:00 2001 From: David Meza Date: Fri, 1 Sep 2017 08:53:55 -0500 Subject: Config to make town square read only (#7140) * Be able to make Town Square read-only (Disable typing messages for non admins). * Do not emit UserTypingEvent when TownSquareIsReadOnly and is Town Square. * Add unit tests for TownSquareIsReadOnly config value and logic. * Add TownSquareIsReadOnly to System console>Policy. Added Telemetry. * Add control for TownSquareIsReadOnly=true only for License Enterprise Edition E10 & E20. * Update en.json * Update en.json * Update policy_settings.jsx * Change config value from TownSquareIsReadOnly to ExperimentalTownSquareIsReadOnly. * Refactored to simplify. Avoid code repeat and multiple db calls. --- app/webhook.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app/webhook.go') diff --git a/app/webhook.go b/app/webhook.go index ce154ff70..cf4f156a2 100644 --- a/app/webhook.go +++ b/app/webhook.go @@ -520,6 +520,11 @@ func HandleIncomingWebhook(hookId string, req *model.IncomingWebhookRequest) *mo } } + if utils.IsLicensed() && *utils.Cfg.TeamSettings.ExperimentalTownSquareIsReadOnly && + channel.Name == model.DEFAULT_CHANNEL { + return model.NewLocAppError("HandleIncomingWebhook", "api.post.create_post.town_square_read_only", nil, "") + } + if channel.Type != model.CHANNEL_OPEN && !HasPermissionToChannel(hook.UserId, channel.Id, model.PERMISSION_READ_CHANNEL) { return model.NewAppError("HandleIncomingWebhook", "web.incoming_webhook.permissions.app_error", nil, "", http.StatusForbidden) } -- cgit v1.2.3-1-g7c22