Skip to content

Commit

Permalink
feat(ci): add epic/* release workflow and rename master to trunk (#…
Browse files Browse the repository at this point in the history
…2895)

* feat(ci): add epic/* release workflow and rename `master` to `trunk`

* chore: point to dev version of newspack-scripts (REVERT BEFORE MERGING)

* docs: update branch names in README

* fix: revert unintentional branch name update for third-party repo

* fix: update newsletter scroll appearance in Sign Up modal (#2897)

* fix(ras): only sync spend total and last payment amounts for completed orders (#2886)

* fix(ras): only sync spend total and last payment amounts for completed orders

* fix: no need to manually add last order amount to total

* fix: logic for updating upon subscription status change

* fix: apply ex- status only for cancelled or expired subs

* refactor: syntax fixes

* fix: update newspack-scripts to release version

---------

Co-authored-by: Laurel <[email protected]>
  • Loading branch information
dkoo and laurelfulford authored Feb 1, 2024
1 parent 68b1836 commit ea02075
Show file tree
Hide file tree
Showing 15 changed files with 255 additions and 1,136 deletions.
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ workflows:
filters:
branches:
only:
- master
- trunk
- newspack/release:
requires:
- newspack/build
Expand All @@ -31,6 +31,7 @@ workflows:
- release
- alpha
- /^hotfix\/.*/
- /^epic\/.*/
- newspack/post-release:
requires:
- newspack/release
Expand Down
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Feature requests can be [submitted to our issue tracker](https://github.com/Auto

## Pull requests

To submit a patch to Newspack, simply create a pull request to the master branch of the Newspack repository. Please test and provide an explanation for your changes. When opening a pull request, please follow these guidelines:
To submit a patch to Newspack, simply create a pull request to the `trunk` branch of the Newspack repository. Please test and provide an explanation for your changes. When opening a pull request, please follow these guidelines:

- **Ensure you stick to the [WordPress Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/) and the [VIP Go Coding Standards](https://vip.wordpress.com/documentation/vip-go/code-review-blockers-warnings-notices/)**
- Install our pre-commit hook using composer. It'll help with the coding standards by automatically checking code when you commit. To install them run `composer install` from the command line within the Newspack plugin or theme directory.
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### All Submissions:

* [ ] Have you followed the [Newspack Contributing guideline](https://github.com/Automattic/newspack-plugin/blob/master/.github/CONTRIBUTING.md)?
* [ ] Have you followed the [Newspack Contributing guideline](https://github.com/Automattic/newspack-plugin/blob/trunk/.github/CONTRIBUTING.md)?
* [ ] Does your code follow the [WordPress' coding standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/) and [VIP Go coding standards](https://vip.wordpress.com/documentation/vip-go/code-review-blockers-warnings-notices/)?
* [ ] Have you checked to ensure there aren't other open [Pull Requests](../../pulls) for the same update/change?

Expand Down
4 changes: 2 additions & 2 deletions .hooks/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')

if [[ "$branch" = "master" ]]; then
echo "Error: pushing directly to the master branch is prohibited"
if [[ "$branch" = "trunk" ]]; then
echo "Error: pushing directly to the trunk branch is prohibited"
exit 1
fi
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Newspack

[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![newspack-plugin](https://circleci.com/gh/Automattic/newspack-plugin/tree/master.svg?style=shield)](https://circleci.com/gh/Automattic/newspack-plugin)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) [![newspack-plugin](https://circleci.com/gh/Automattic/newspack-plugin/tree/trunk.svg?style=shield)](https://circleci.com/gh/Automattic/newspack-plugin)

Welcome to the Newspack plugin repository on GitHub. Here you can browse the source, look at open issues and keep track of development. We also recommend everyone [follow the Newspack blog](https://newspack.com/) to stay up to date about everything happening in the project.

Expand All @@ -18,7 +18,7 @@ To disclose a security issue to our team, [please submit a report via HackerOne

## Contributing to Newspack

If you have a patch or have stumbled upon an issue with the Newspack plugin/theme, you can contribute this back to the code. [Please read our contributor guidelines for more information on how you can do this.](https://github.com/Automattic/newspack-plugin/blob/master/.github/CONTRIBUTING.md)
If you have a patch or have stumbled upon an issue with the Newspack plugin/theme, you can contribute this back to the code. [Please read our contributor guidelines for more information on how you can do this.](https://github.com/Automattic/newspack-plugin/blob/trunk/.github/CONTRIBUTING.md)

### Development

Expand All @@ -42,10 +42,10 @@ This plugin reports NCI events to a Google Analytics account, if one is connecte

## Support or Questions

This repository is not suitable for support or general questions about Newspack. Please only use our issue trackers for bug reports and feature requests, following [the contribution guidelines](https://github.com/Automattic/newspack-plugin/blob/master/.github/CONTRIBUTING.md).
This repository is not suitable for support or general questions about Newspack. Please only use our issue trackers for bug reports and feature requests, following [the contribution guidelines](https://github.com/Automattic/newspack-plugin/blob/trunk/.github/CONTRIBUTING.md).

Support requests in issues on this repository will be closed on sight.

## License

Newspack is licensed under [GNU General Public License v2 (or later)](https://github.com/Automattic/newspack-plugin/blob/master/LICENSE.md).
Newspack is licensed under [GNU General Public License v2 (or later)](https://github.com/Automattic/newspack-plugin/blob/trunk/LICENSE.md).
2 changes: 1 addition & 1 deletion assets/reader-activation/auth.scss
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@
padding: 0.5em;
box-sizing: border-box;
max-height: 21vh;
overflow-y: scroll;
overflow-y: auto;
h3 {
display: none;
}
Expand Down
2 changes: 1 addition & 1 deletion assets/wizards/engagement/components/prompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
hooks,
} from '../../../components/src';

// Note: Schema and types for the `prompt` prop is defined in Newspack Campaigns: https://github.com/Automattic/newspack-popups/blob/master/includes/schemas/class-prompts.php
// Note: Schema and types for the `prompt` prop is defined in Newspack Campaigns: https://github.com/Automattic/newspack-popups/blob/trunk/includes/schemas/class-prompts.php
export default function Prompt( { inFlight, prompt, setInFlight, setPrompts }: PromptProps ) {
const [ values, setValues ] = useState< InputValues | Record< string, never > >( {} );
const [ error, setError ] = useState< false | { message: string } >( false );
Expand Down
2 changes: 1 addition & 1 deletion assets/wizards/engagement/components/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export type InputField = {
};
};

// Schema is defined in Newspack Campaigns: https://github.com/Automattic/newspack-popups/blob/master/includes/schemas/class-prompts.php
// Schema is defined in Newspack Campaigns: https://github.com/Automattic/newspack-popups/blob/trunk/includes/schemas/class-prompts.php
export type PromptType = {
status: string;
slug: string;
Expand Down
12 changes: 5 additions & 7 deletions includes/data-events/connectors/class-activecampaign.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ public static function reader_logged_in( $timestamp, $data, $client_id ) {
return;
}

$last_order = $customer->get_last_order();
$contact = WooCommerce_Connection::get_contact_from_order( $last_order );
$contact = WooCommerce_Connection::get_contact_from_customer( $customer );

self::put( $contact );
}
Expand All @@ -126,7 +125,7 @@ public static function order_completed( $timestamp, $data, $client_id ) {
}

$order_id = $data['platform_data']['order_id'];
$contact = WooCommerce_Connection::get_contact_from_order( $order_id, false, true );
$contact = WooCommerce_Connection::get_contact_from_order( $order_id, $data['referer'], true );

if ( ! $contact ) {
return;
Expand All @@ -143,7 +142,7 @@ public static function order_completed( $timestamp, $data, $client_id ) {
* @param int $client_id ID of the client that triggered the event.
*/
public static function subscription_updated( $timestamp, $data, $client_id ) {
if ( empty( $data['subscription_id'] ) || empty( $data['status_before'] ) || empty( $data['status_after'] ) ) {
if ( empty( $data['status_before'] ) || empty( $data['status_after'] ) || empty( $data['user_id'] ) ) {
return;
}

Expand All @@ -157,9 +156,8 @@ public static function subscription_updated( $timestamp, $data, $client_id ) {
return;
}

$subscription = \wcs_get_subscription( $data['subscription_id'] );
$order = $subscription->get_last_order( 'all' );
$contact = WooCommerce_Connection::get_contact_from_order( $order );
$customer = new \WC_Customer( $data['user_id'] );
$contact = WooCommerce_Connection::get_contact_from_customer( $customer );

if ( ! $contact ) {
return;
Expand Down
12 changes: 5 additions & 7 deletions includes/data-events/connectors/class-mailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,7 @@ public static function reader_logged_in( $timestamp, $data, $client_id ) {
return;
}

$last_order = $customer->get_last_order();
$contact = WooCommerce_Connection::get_contact_from_order( $last_order );
$contact = WooCommerce_Connection::get_contact_from_customer( $customer );

self::put( $contact );
}
Expand All @@ -275,7 +274,7 @@ public static function order_completed( $timestamp, $data, $client_id ) {
}

$order_id = $data['platform_data']['order_id'];
$contact = WooCommerce_Connection::get_contact_from_order( $order_id, false, true );
$contact = WooCommerce_Connection::get_contact_from_order( $order_id, $data['referer'], true );

if ( ! $contact ) {
return;
Expand All @@ -292,7 +291,7 @@ public static function order_completed( $timestamp, $data, $client_id ) {
* @param int $client_id ID of the client that triggered the event.
*/
public static function subscription_updated( $timestamp, $data, $client_id ) {
if ( empty( $data['subscription_id'] ) || empty( $data['status_before'] ) || empty( $data['status_after'] ) ) {
if ( empty( $data['status_before'] ) || empty( $data['status_after'] ) || empty( $data['user_id'] ) ) {
return;
}

Expand All @@ -306,9 +305,8 @@ public static function subscription_updated( $timestamp, $data, $client_id ) {
return;
}

$subscription = \wcs_get_subscription( $data['subscription_id'] );
$order = $subscription->get_last_order( 'all' );
$contact = WooCommerce_Connection::get_contact_from_order( $order );
$customer = new \WC_Customer( $data['user_id'] );
$contact = WooCommerce_Connection::get_contact_from_customer( $customer );

if ( ! $contact ) {
return;
Expand Down
Loading

0 comments on commit ea02075

Please sign in to comment.