Comments

denisveg created an issue. See original summary.

vdenis’s picture

Title: Check on configuration block if profile is public or not » Check on configuration block if profile is public or private
vdenis’s picture

Issue summary: View changes
vdenis’s picture

vdenis’s picture

I've created the patch. Basically, I've just added blockValidate where I'm checking if $slice_variable is empty() or not.

I'll be happy with someone can review and if there is something I can do better.

vdenis’s picture

Status: Active » Needs review
vdenis’s picture

Removed debugging code and created new patch file.

deaom’s picture

Status: Needs review » Needs work

I tested the patch and it works as designed, the one thing that I noticed is, that when the error msg appears, the wrong profile name is displayed. It displayes the last saved one.

Change this line of code

$form_state->setErrorByName('name', "We can't display pictures because the profile '{$this->configuration['name']}' is set as private.");

to this:

$name = $obj['entry_data']['ProfilePage'][0]['graphql']['user']['username'];
$form_state->setErrorByName('name', "We can't display pictures because the profile '{$name}' is set as private.");

And you should get the correct name of the profile in the error msg.

vdenis’s picture

Thanks for the review. Issue fixed.

vdenis’s picture

Status: Needs work » Needs review
vdenis’s picture

Providing new patch, because latest had some issue with applying.

deaom’s picture

Status: Needs review » Reviewed & tested by the community

The patch works as designed.

BR,
Dea

boshtian’s picture

Status: Reviewed & tested by the community » Needs work

There are some coding standard issues in blockValidation function.

Also, I would suggest giving the part of code that parses instagram response into json in a separate service, to avoid code duplication.

vdenis’s picture

Attaching a new patch in which I've fixed coding standards and moved the part of the code to the service as suggested by @boshtian.

vdenis’s picture

Status: Needs work » Needs review
deaom’s picture

Status: Needs review » Reviewed & tested by the community

This patch applies and works. The only problem is, when you enter the username of a profile that does not exist/is deleted, you get an error. But that is beeing handled here #3022821: Check if Instagram username is valid.

ipwa’s picture

Version: 8.x-1.0 » 8.x-2.x-dev

Targeting correct branch now that branches have been fixed.

  • ipwa committed 0136ad1d on 3.0.x
    feat: #3021391 Check on configuration block if profile is public or...
ipwa’s picture

Title: Check on configuration block if profile is public or private » Check on configuration block if profile is public or private and if profile exists
Version: 8.x-2.x-dev » 3.0.x-dev
Assigned: vdenis » ipwa
Status: Reviewed & tested by the community » Fixed

Also added check if profile exists. Could not use any patches because the way the data is fetched was refactored. Thanks everyone!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.