MM-29726 Allow disabling link previews from certain domains (#16869)
* Add field to config model Config option for disabling link previews for given domains. * Refactor functions and corresponding tests * Expand logic for link preview Newly added isLinkAllowedForPreview function determines whether a link should display a preview. It gets corresponding config values consisting of comma separated domain values, normalizes them and checks for matches. * Create tests for link preview restriction * Fix formatting issue * Add test cases where images are expected * Apply suggestions from code review Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com> * Apply remaining code suggestions * Add RestrictLinkPreviews value to telemetries Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Harrison Healey <harrisonmhealey@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
8612f3a4d1
Коммит
f5590d4e5f
@@ -440,6 +440,7 @@ func (ts *TelemetryService) trackConfig() {
|
||||
"thread_auto_follow": *cfg.ServiceSettings.ThreadAutoFollow,
|
||||
"enable_link_previews": *cfg.ServiceSettings.EnableLinkPreviews,
|
||||
"enable_file_search": *cfg.ServiceSettings.EnableFileSearch,
|
||||
"restrict_link_previews": isDefault(*cfg.ServiceSettings.RestrictLinkPreviews, ""),
|
||||
})
|
||||
|
||||
ts.sendTelemetry(TrackConfigTeam, map[string]interface{}{
|
||||
|
||||
Ссылка в новой задаче
Block a user