Skip to content

Commit

Permalink
Settings: API_Embed; closes #225
Browse files Browse the repository at this point in the history
  • Loading branch information
marceloschmidt committed Aug 18, 2015
1 parent 69d2758 commit abf9acc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client/views/app/message.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Template.message.onViewRendered = (context) ->
ul = lastNode.parentElement
wrapper = ul.parentElement

if context.urls?.length > 0 and Template.oembedBaseWidget?
if context.urls?.length > 0 and Template.oembedBaseWidget? and RocketChat.settings.get 'API_Embed'
for item in context.urls
do (item) ->
urlNode = lastNode.querySelector('.body a[href="'+item.url+'"]')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Template.message.onViewRendered = (context) ->
ul = lastNode.parentElement
wrapper = ul.parentElement

if context.urls?.length > 0 and Template.oembedBaseWidget?
if context.urls?.length > 0 and Template.oembedBaseWidget? and RocketChat.settings.get 'API_Embed'
for item in context.urls
do (item) ->
urlNode = lastNode.querySelector('.body a[href="'+item.url+'"]')
Expand Down
3 changes: 2 additions & 1 deletion packages/rocketchat-oembed/server/server.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,5 @@ OEmbed.RocketUrlParser = (message) ->

return message

RocketChat.callbacks.add 'afterSaveMessage', OEmbed.RocketUrlParser, RocketChat.callbacks.priority.LOW
if RocketChat.settings.get 'API_Embed'
RocketChat.callbacks.add 'afterSaveMessage', OEmbed.RocketUrlParser, RocketChat.callbacks.priority.LOW

0 comments on commit abf9acc

Please sign in to comment.