Skip to content

Commit

Permalink
Fixed User Sharing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
mwilkinson22 committed Oct 20, 2023
1 parent 039e3fb commit 49375d3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
15 changes: 11 additions & 4 deletions src/client/components/social/ShareDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,15 @@ class ShareDialog extends Component {
}

renderDialog() {
const { authorisedAccounts, fetchingPreview, images, isSubmitting, service, services, submittedPost } =
this.state;
const {
authorisedAccounts,
fetchingPreview,
images,
isSubmitting,
service,
services,
submittedPost
} = this.state;

if (service) {
let content;
Expand Down Expand Up @@ -172,9 +179,9 @@ class ShareDialog extends Component {
case "twitter": {
url = [
"https://twitter.com",
submittedPost.user.screen_name,
authorisedAccounts[service].screen_name,
"status",
submittedPost.id_str
submittedPost.id
].join("/");
}
}
Expand Down
10 changes: 6 additions & 4 deletions src/controllers/oAuthController.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export async function getAuthorisedAccounts(req, res) {
try {
client = await twitter(null, keys);
const user = await client.v1.verifyCredentials();
if (user && user.data) {
data = _.pick(user.data, ["name", "screen_name", "id_str", "profile_image_url_https"]);
if (user) {
data = _.pick(user, ["name", "screen_name", "id_str", "profile_image_url_https"]);
break;
}
} catch (e) {
Expand Down Expand Up @@ -197,8 +197,10 @@ export async function postToSocial(service, text, options = {}) {
}

case "facebook": {
// IFTTT seems to be broken. Temporarily disbling Facebook posting.
return;
// IFTTT seems to be broken. Temporarily disabling Facebook posting.
// Using a bool to stop "unreachable code" error in IDE
const iftttBroken = true;
if (iftttBroken) return;

//Get Profile
const profile = await SocialProfile.findById(options._profile).lean();
Expand Down

0 comments on commit 49375d3

Please sign in to comment.