Skip to content

Commit

Permalink
Merge pull request #33 from Hiba-Almade/master
Browse files Browse the repository at this point in the history
enhance deep link
  • Loading branch information
charkhaw authored Jan 4, 2023
2 parents 3d85d5d + e49333f commit 42e2eee
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions widget/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -942,16 +942,17 @@ function setStrings() {
}

function shareWithOthers(data) {
let toShare = {};
toShare.data = {
id: data.id,
title: data.title,
privacy: data.privacy,
createdById: data.createdBy._id,
parentTopicId: data.parentTopicId,
type: data.type,
};
buildfire.deeplink.generateUrl(toShare, function (err, result) {
buildfire.deeplink.generateUrl(
{
data:{
id: data.id,
title: data.title,
privacy: data.privacy,
createdById: data.createdBy._id,
parentTopicId: data.parentTopicId,
type: data.type,
}
}, function (err, result) {
if (err) {
console.error(err)
} else {
Expand All @@ -972,13 +973,12 @@ function shareWithOthers(data) {

function subscribeToGroup(data) {
let group = data;
getData();
if (group?.privacy === 'public') {
getData();
navigateTo(data);
return;
}
if (group?.createdById === loggedUser._id) {
getData();
navigateTo(data);
return;
}
Expand All @@ -994,7 +994,6 @@ function subscribeToGroup(data) {
console.log(err)
}
if (result && result.length > 0) {
getData();
navigateTo(result)
}
else {
Expand All @@ -1009,7 +1008,6 @@ function subscribeToGroup(data) {
topic.save(group.privacy)
.then((result => {
showMessage(`You have been added to ${topic.title} topic`)
getData();
navigateTo(result);
}))
.catch(err => {
Expand Down

0 comments on commit 42e2eee

Please sign in to comment.