summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Nassabain <marco.nassabain@hotmail.com>2021-03-14 22:20:35 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-04-08 23:17:31 +0200
commit792082e2e0fcca32fffc7693a210ae2fa64d4c06 (patch)
tree5998b76ed44fa53397ba8ce1540cf0db62709fa2
parentc14fa3eaf62a554e2626da8e93f31ea3ea23b83f (diff)
✨ Social share: show if socialsharing app active
Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
-rw-r--r--js/controller/ShareController.js11
-rw-r--r--templates/part.content.php6
2 files changed, 14 insertions, 3 deletions
diff --git a/js/controller/ShareController.js b/js/controller/ShareController.js
index a60ea7ed3..8d7235d89 100644
--- a/js/controller/ShareController.js
+++ b/js/controller/ShareController.js
@@ -146,6 +146,17 @@ app.controller('ShareController', function (ShareResource, Loading) {
return user.status === status;
};
+ /**
+ * Checks if the social sharing app for the given media is active
+ *
+ * @param media
+ * @returns boolean
+ */
+ this.isSocialAppEnabled = function(media) {
+ let app = 'socialsharing_' + media;
+ return app in OC.appswebroots;
+ };
+
this.getFacebookUrl = function(url){
return 'https://www.facebook.com/sharer/sharer.php?u='+url;
};
diff --git a/templates/part.content.php b/templates/part.content.php
index 8bcd33d14..e02713bee 100644
--- a/templates/part.content.php
+++ b/templates/part.content.php
@@ -139,17 +139,17 @@
<p class="label-group"> <?php p($l->t('Share on social media')) ?> </p>
<div class="row">
- <div class="col-4">
+ <div ng-if="Share.isSocialAppEnabled('facebook')" class="col-4">
<a target="_blank"
class="icon-dropdown icon-facebook pr-5"
ng-href="{{Share.getFacebookUrl(item.url)}}"></a>
</div>
- <div class="col-4">
+ <div ng-if="Share.isSocialAppEnabled('twitter')" class="col-4">
<a target="_blank"
class="icon-dropdown icon-twitter pr-5"
ng-href="{{Share.getTwitterUrl(item.url)}}"></a>
</div>
- <div class="col-4">
+ <div ng-if="Share.isSocialAppEnabled('email')" class="col-4">
<a class="icon-dropdown icon-mail pr-5"
ng-href="mailto:?subject=<?php p($l->t('I wanted you to see this article')) ?>&amp;body=<?php p($l->t('Check out this article')) ?>{{ ::item.url }}"></a>
</div>