Skip to content

Commit

Permalink
A number of small fixes for Link Previews
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Feb 5, 2019
1 parent b26f623 commit 0d7480b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
11 changes: 0 additions & 11 deletions _locales/en/messages.json
Expand Up @@ -1076,17 +1076,6 @@
"message": "General",
"description": "Header for general options on the settings screen"
},
"sendLinkPreviews": {
"message": "Send Link Previews",
"description":
"Option to control creation and send of link previews in setting screen"
},
"linkPreviewsDescription": {
"message":
"Previews are supported for Imgur, Instagram, Reddit, and YouTube links.",
"description":
"Additional detail provided for Link Previews option in settings screen"
},
"spellCheckDescription": {
"message": "Enable spell check of text entered in message composition box",
"description": "Description of the media permission description"
Expand Down
4 changes: 3 additions & 1 deletion js/models/conversations.js
Expand Up @@ -779,8 +779,10 @@
media
.filter(
attachment =>
(attachment && attachment.thumbnail) || attachment.message
attachment &&
(attachment.image || (!attachment.pending && !attachment.error))
)
.slice(0, 1)
.map(async attachment => {
const { fileName } = attachment;

Expand Down
2 changes: 1 addition & 1 deletion js/models/messages.js
Expand Up @@ -1182,7 +1182,7 @@
urls.includes(item.url) &&
window.Signal.LinkPreviews.isLinkInWhitelist(item.url)
);
if (preview.length > incomingPreview.length) {
if (preview.length < incomingPreview.length) {
window.log.info(
`${message.idForLogging()}: Eliminated ${preview.length -
incomingPreview.length} previews with invalid urls'`
Expand Down
2 changes: 1 addition & 1 deletion js/modules/link_previews.js
Expand Up @@ -55,7 +55,7 @@ function isLinkInWhitelist(link) {
}
}

const SUPPORTED_MEDIA_DOMAINS = /^([^.]+\.)*(ytimg.com|cdninstagram.com|redd.it|imgur.com)$/i;
const SUPPORTED_MEDIA_DOMAINS = /^([^.]+\.)*(ytimg.com|cdninstagram.com|redd.it|imgur.com|fbcdn.net)$/i;
function isMediaLinkInWhitelist(link) {
try {
const url = new URL(link);
Expand Down

0 comments on commit 0d7480b

Please sign in to comment.