Skip to content

Commit 1349fec

Browse files
Merge pull request #1061 from Codeinwp/fix/issue-614
fix: revert instant share default control
2 parents 8e069e4 + 09a3b86 commit 1349fec

File tree

11 files changed

+63
-11
lines changed

11 files changed

+63
-11
lines changed

assets/js/build/dashboard.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-editor', 'wp-element', 'wp-notices', 'wp-plugins', 'wp-primitives', 'wp-url'), 'version' => 'eb694ccc60bb285f9067');
1+
<?php return array('dependencies' => array('lodash', 'react', 'wp-api-fetch', 'wp-block-editor', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-editor', 'wp-element', 'wp-notices', 'wp-plugins', 'wp-primitives', 'wp-url'), 'version' => '3000d00121986d2a4045');

assets/js/react/build/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/rop.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ General Settings data structure:
247247
"custom_messages": false,
248248
"custom_messages_share_order": false,
249249
"instant_share": true,
250+
"instant_share_default": true,
250251
"start_time": 1706886799,
251252
"minute_interval": 5,
252253
"available_shorteners": {

includes/admin/class-rop-admin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ public function enqueue_scripts() {
371371
$rop_api_settings['exclude_apply_limit'] = $this->limit_exclude_list();
372372
$rop_api_settings['publish_now'] = array(
373373
'instant_share_enabled' => $settings->get_instant_sharing(),
374-
'instant_share_by_default' => $settings->get_instant_sharing_default(),
374+
'instant_share_by_default' => $settings->get_instant_sharing_by_default(),
375375
'accounts' => $active_accounts,
376376
);
377377
$rop_api_settings['custom_messages'] = $settings->get_custom_messages();

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ class Rop_Global_Settings {
188188
'custom_messages' => false,
189189
'custom_messages_share_order' => false,
190190
'instant_share' => true,
191+
'instant_share_default' => true,
191192
'start_time' => false,
192193
'minute_interval' => 5,
193194
);

includes/admin/models/class-rop-settings-model.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -584,10 +584,16 @@ public function get_instant_sharing() {
584584
* @access public
585585
* @return bool
586586
*/
587-
public function get_instant_sharing_default() {
588-
// This option is only kept for backward compatibility.
589-
$value = isset( $this->settings['instant_share_default'] ) ? $this->settings['instant_share_default'] : true;
590-
return apply_filters( 'rop_instant_sharing_default', $value );
587+
public function get_instant_sharing_by_default() {
588+
$post_id = get_the_ID();
589+
if ( $post_id ) {
590+
$post = get_post( $post_id );
591+
if ( $post && $post->post_status === 'publish' ) {
592+
return false;
593+
}
594+
}
595+
596+
return isset( $this->settings['instant_share_default'] ) ? $this->settings['instant_share_default'] : false;
591597
}
592598

593599
/**

includes/class-rop-i18n.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ public static function get_labels( $key = '' ) {
191191
'custom_share_order_desc' => __( 'By default message variations are shared randomly. Checking this box will cause them to share in the order they were added.', 'tweet-old-post' ),
192192
'instant_share_title' => __( 'Enable Instant Sharing Feature (Post on Publish)', 'tweet-old-post' ),
193193
'instant_share_desc' => __( 'Allows you to share posts immediately on publish/update. <a href="https://docs.revive.social/article/933-how-to-share-posts-immediately-with-revive-old-posts" target="_blank">Learn more</a>.', 'tweet-old-post' ),
194+
'instant_share_default_title' => __( 'Enable Instant Sharing By Default', 'tweet-old-post' ),
195+
'instant_share_default_desc' => __( 'Instant sharing option will be checked by default when creating new posts.', 'tweet-old-post' ),
194196
'cron_type_label' => __( 'Cron Job Type', 'tweet-old-post' ),
195197
'cron_type_label_desc' => sprintf( __( 'Select the between your local built-in WordPress task scheduler, or Revive Social\'s, %1$sLearn More%2$s.', 'tweet-old-post' ), '<a href="https://docs.revive.social/article/1303-rop-local-cron-vs-remote-cron" target="_blank">', '</a>' ),
196198
'cron_type_label_desc_terms' => __( 'I understand that some site data is stored on the Revive Social\'s Remote Cron System to provide this service <a href="https://docs.revive.social/article/1317-info-we-collect-for-remote-cron-service" target="_blank">Read More Here</a>.', 'tweet-old-post' ),

package-lock.json

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

src/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ const render = () => {
5959
};
6060

6161
useEffect(() => {
62-
if ('initial' === meta.rop_publish_now && postStatus !== 'publish') {
62+
if (
63+
'initial' === meta.rop_publish_now &&
64+
postStatus !== 'publish' &&
65+
ropApiSettings.publish_now.instant_share_by_default
66+
) {
6367
updateMetaValue('rop_publish_now', 'yes');
6468
}
6569
}, []);

0 commit comments

Comments
 (0)