Skip to content

Commit cd04830

Browse files
release: fixes
- Fixed Instagram sharing with additional content issue [PRO] - Updated dependencies
2 parents 6f377f1 + 9b8bf13 commit cd04830

6 files changed

Lines changed: 68 additions & 71 deletions

File tree

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/admin/class-rop-admin.php

Lines changed: 44 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ public function enqueue_scripts() {
330330

331331
$added_services = $services->get_authenticated_services();
332332
$added_networks = 0;
333+
$accounts_count = count( $added_services );
333334
if ( $added_services ) {
334335

335336
$uniq_auth_accounts = array();
@@ -421,7 +422,29 @@ public function enqueue_scripts() {
421422
wp_deregister_script( 'vue-libs' );
422423
}
423424

424-
$this->register_survey();
425+
$is_post_sharing_active = ( new Rop_Cron_Helper() )->get_status() ? 'yes' : 'no';
426+
427+
if ( ! defined( 'TI_E2E_TESTING' ) || ! TI_E2E_TESTING ) {
428+
add_filter(
429+
'themeisle-sdk/survey/' . ROP_PRODUCT_SLUG,
430+
function( $data, $page_slug ) use ( $accounts_count, $is_post_sharing_active ) {
431+
$data = $this->get_survey_metadata();
432+
433+
$extra_attributes = array(
434+
'accounts_number' => min( 20, $accounts_count ),
435+
'post_sharing_enabled' => $is_post_sharing_active,
436+
);
437+
438+
$data['attributes'] = array_merge( $data['attributes'], $extra_attributes );
439+
440+
return $data;
441+
},
442+
10,
443+
2
444+
);
445+
}
446+
do_action( 'themeisle_internal_page', ROP_PRODUCT_SLUG, 'dashboard' );
447+
425448
if ( ! defined( 'ROP_PRO_VERSION' ) ) {
426449
do_action( 'themeisle_sdk_load_banner', 'rop' );
427450
}
@@ -1738,62 +1761,34 @@ public static function rop_check_reached_sharing_limit( $sharing_type = 'tw' ) {
17381761
* @return array The survey metadata.
17391762
*/
17401763
public function get_survey_metadata() {
1741-
$license_data = get_option( 'tweet_old_post_pro_license_data', array() );
1742-
$attributes = array();
1743-
$user_id = 'rop_' . ( ! empty( $license_data->key ) ? $license_data->key : preg_replace( '/[^\w\d]*/', '', get_site_url() ) ); // Use a normalized version of the site URL as a user ID for free users.
1764+
$license_status = apply_filters( 'product_rop_license_status', 'invalid' );
1765+
$license_plan = apply_filters( 'product_rop_license_plan', false );
1766+
$license_key = apply_filters( 'product_rop_license_key', false );
1767+
1768+
$install_days_number = intval( ( time() - get_option( 'rop_first_install_date', time() ) ) / DAY_IN_SECONDS );
1769+
1770+
$data = array(
1771+
'environmentId' => 'clwgcs7ia03df11mgz7gh15od',
1772+
'attributes' => array(
1773+
'license_status' => $license_status,
1774+
'free_version' => $this->version,
1775+
'install_days_number' => $install_days_number,
1776+
),
1777+
);
17441778

1745-
$days_since_install = round( ( time() - get_option( 'rop_first_install_date', 0 ) ) / DAY_IN_SECONDS );
1746-
$install_category = 0; // Normalized value.
1747-
if ( 0 === $days_since_install || 1 === $days_since_install ) {
1748-
$install_category = 0;
1749-
} elseif ( 1 < $days_since_install && 8 > $days_since_install ) {
1750-
$install_category = 7;
1751-
} elseif ( 8 <= $days_since_install && 31 > $days_since_install ) {
1752-
$install_category = 30;
1753-
} elseif ( 30 < $days_since_install && 90 > $days_since_install ) {
1754-
$install_category = 90;
1755-
} elseif ( 90 <= $days_since_install ) {
1756-
$install_category = 91;
1779+
if ( ! empty( $license_plan ) ) {
1780+
$data['attributes']['plan'] = strval( $license_plan );
17571781
}
17581782

1759-
$attributes['days_since_install'] = strval( $install_category );
1760-
$attributes['license_status'] = ! empty( $license_data->license ) ? $license_data->license : 'invalid';
1761-
$attributes['free_version'] = $this->version;
1762-
1763-
if ( ! empty( $license_data->plan ) ) {
1764-
$attributes['plan'] = strval( $license_data->plan );
1783+
if ( ! empty( $license_key ) ) {
1784+
$data['attributes']['license_key'] = apply_filters( 'themeisle_sdk_secret_masking', $license_key );
17651785
}
17661786

17671787
if ( defined( 'ROP_PRO_VERSION' ) ) {
1768-
$attributes['pro_version'] = ROP_PRO_VERSION;
1769-
}
1770-
1771-
return array(
1772-
'userId' => $user_id,
1773-
'attributes' => $attributes,
1774-
);
1775-
}
1776-
1777-
/**
1778-
* Register the survey script.
1779-
*
1780-
* It does not register if we are in a testing environment.
1781-
*
1782-
* @return void
1783-
*/
1784-
public function register_survey() {
1785-
1786-
if ( defined( 'TI_E2E_TESTING' ) && TI_E2E_TESTING ) {
1787-
return;
1788-
}
1789-
1790-
$survey_handler = apply_filters( 'themeisle_sdk_dependency_script_handler', 'survey' );
1791-
if ( empty( $survey_handler ) ) {
1792-
return;
1788+
$data['attributes']['pro_version'] = ROP_PRO_VERSION;
17931789
}
17941790

1795-
do_action( 'themeisle_sdk_dependency_enqueue_script', 'survey' );
1796-
wp_localize_script( $survey_handler, 'ropSurveyData', $this->get_survey_metadata() );
1791+
return $data;
17971792
}
17981793

17991794
/**

includes/admin/class-rop-global-settings.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class Rop_Global_Settings {
8989
),
9090
'allowed_accounts' => 1,
9191
'description' => '',
92+
'allowed_comment' => false,
9293
),
9394
'twitter' => array(
9495
'active' => true,
@@ -105,41 +106,50 @@ class Rop_Global_Settings {
105106
),
106107
'two_step_sign_in' => true,
107108
'allowed_accounts' => 1,
109+
'allowed_comment' => false,
108110
),
109111
'linkedin' => array(
110112
'active' => false,
111113
'name' => 'LinkedIn',
114+
'allowed_comment' => false,
112115
),
113116
'tumblr' => array(
114117
'active' => false,
115118
'name' => 'Tumblr',
119+
'allowed_comment' => false,
116120
),
117121
'pinterest' => array(
118122
'active' => false,
119123
'name' => 'Pinterest',
124+
'allowed_comment' => false,
120125
),
121126
'gmb' => array(
122127
'active' => false,
123128
'name' => 'Gmb',
124129
'fullname' => 'Google My Business',
130+
'allowed_comment' => false,
125131
),
126132
'vk' => array(
127133
'active' => false,
128134
'name' => 'Vk',
135+
'allowed_comment' => false,
129136
),
130137
'webhook' => array(
131138
'active' => false,
132139
'name' => 'Webhook',
133140
'two_step_sign_in' => true,
141+
'allowed_comment' => false,
134142
),
135143
'telegram' => array(
136144
'active' => false,
137145
'name' => 'Telegram',
146+
'allowed_comment' => false,
138147
),
139148
'mastodon' => array(
140149
'active' => false,
141150
'name' => 'Mastodon',
142151
'two_step_sign_in' => true,
152+
'allowed_comment' => false,
143153
),
144154
);
145155

@@ -718,6 +728,7 @@ function ( $value ) {
718728
$available_services['instagram'] = $available_services['facebook'];
719729
$available_services['instagram']['name'] = 'Instagram';
720730
$available_services['instagram']['active'] = $is_middle_plan ? true : false;
731+
$available_services['instagram']['allowed_comment'] = false;
721732
return $available_services;
722733
}
723734

tweet-old-post.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ function run_rop() {
172172
define( 'ROP_LITE_URL', plugin_dir_url( __FILE__ ) );
173173
define( 'ROP_STATUS_ALERT', 6 ); // How many consecutive errors count towards status alert "Status: Error (check logs)"
174174
define( 'ROP_TEMP_IMAGES', plugin_dir_path( __FILE__ ) . 'temp-images/' ); // Path for external images downloaded for sharing
175+
define( 'ROP_PRODUCT_SLUG', basename( ROP_PATH ) );
175176

176177
// Authorization APP Data
177178
define( 'ROP_AUTH_APP_URL', 'https://app.revive.social' );

vue/src/rop_main.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,4 @@ window.addEventListener( 'load', function () {
2121
store.dispatch( 'fetchAJAXPromise', {req: 'get_active_accounts'} )
2222
},
2323
} );
24-
} );
25-
26-
/**
27-
* Initialize the formbricks survey.
28-
*
29-
* @see https://github.com/formbricks/setup-examples/tree/main/html
30-
*/
31-
window.addEventListener('themeisle:survey:loaded', function () {
32-
window?.tsdk_formbricks?.init?.({
33-
environmentId: "clwgcs7ia03df11mgz7gh15od",
34-
apiHost: "https://app.formbricks.com",
35-
...(window?.ropSurveyData ?? {}),
36-
});
37-
});
24+
} );

vue/src/vue-elements/post-format.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,6 @@
872872
selected_tax_filter: [],
873873
// selected_language: this.$store.state.activePostFormat[this.account_id] ? this.$store.state.activePostFormat[this.account_id].wpml_language : [],
874874
// post_types: this.$store.state.generalSettings.available_post_types,
875-
postCommentSupportedServices: [ 'twitter', 'facebook', 'linkedin', 'vk', 'mastodon' ],
876875
}
877876
},
878877
computed: {
@@ -954,8 +953,12 @@
954953
return Boolean( ! this.isPro && this.$store.state.is_new_user );
955954
},
956955
postCommentAllowed: function () {
956+
var serviceName = this.allAccounts[this.account_id].service;
957+
if ( this.is_instagram_account ) {
958+
serviceName = 'instagram';
959+
}
957960
// Check if the service of the current account exists in allowedServices
958-
return this.postCommentSupportedServices.includes(this.allAccounts[this.account_id].service);
961+
return this.$store.state.availableServices[serviceName]?.allowed_comment;
959962
},
960963
},
961964
watch: {

0 commit comments

Comments
 (0)