Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG Display a notification after publishing a campaign #177

Merged
merged 2 commits into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions client/lang/src/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
"CampaignAdmin.NO_CHANGES": "No changes",
"CampaignAdmin.PUBLISHCAMPAIGN": "Publish campaign",
"CampaignAdmin.REMOVED": "Removed",
"CampaignAdmin.REVERTCAMPAIGN": "Revert"
}
"CampaignAdmin.REVERTCAMPAIGN": "Revert",
sachajudd marked this conversation as resolved.
Show resolved Hide resolved
"CampaignAdmin.PUBLISH_FAIL": "Campaign could not be published.",
sachajudd marked this conversation as resolved.
Show resolved Hide resolved
"CampaignAdmin.PUBLISH_SUCCESS": "Published \"%s\" successfully."
}
12 changes: 12 additions & 0 deletions client/src/state/campaign/CampaignActions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* global window */
import ACTION_TYPES from './CampaignActionTypes';
import RECORD_ACTION_TYPES from 'state/records/RecordsActionTypes';
import * as toastsActions from 'state/toasts/ToastsActions';
import i18n from 'i18n';

export function setShowMessage(show, storage = window.localStorage) {
storage.setItem('campaign.showMessage', show);
Expand Down Expand Up @@ -64,12 +66,22 @@ export function publishCampaign(publishApi, recordType, campaignId) {
type: RECORD_ACTION_TYPES.FETCH_RECORD_SUCCESS,
payload: { recordType, data },
});
const message = i18n._t(
'CampaignAdmin.PUBLISH_SUCCESS',
'Published "%s" successfully.'
);
dispatch(toastsActions.success(i18n.sprintf(message, data.Name)));
})
.catch((error) => {
dispatch({
type: ACTION_TYPES.PUBLISH_CAMPAIGN_FAILURE,
payload: { error },
});

const message = typeof error === 'string'
? error
: i18n._t('CampaignAdmin.PUBLISH_FAIL', 'Campaign could not be published.');
dispatch(toastsActions.error(message));
});
};
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"scripts": {
"build": "yarn && yarn lint && yarn test && NODE_ENV=production webpack -p --bail --progress",
"dev": "NODE_ENV=development webpack --progress",
"watch": "yarn && NODE_ENV=development webpack --watch --progress",
"css": "yarn && WEBPACK_CHILD=css webpack -p --bail --progress",
"test": "jest",
Expand Down Expand Up @@ -50,7 +51,7 @@
},
"devDependencies": {
"@silverstripe/eslint-config": "^0.0.5",
"@silverstripe/webpack-config": "^1.3.0",
"@silverstripe/webpack-config": "^1.7.0",
"babel-core": "^6.26.3",
"babel-jest": "^23.6.0",
"babel-loader": "^6.0.0",
Expand Down
10 changes: 2 additions & 8 deletions tests/behat/features/populate-campaigns.feature
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ Feature: Populate campaigns
And I press the "Remove" button, confirming the dialog
Then I should not see the "About Us" campaign item
When I press the "Publish campaign" button, confirming the dialog
And I press the "Campaigns" button
Then I should see a "Published "Full Campaign" successfully." success toast
When I press the "Campaigns" button
Then I should see "Published" in column 3 of the "Full Campaign" campaign







43 changes: 9 additions & 34 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
eslint-plugin-jsx-a11y "^5.1.1"
eslint-plugin-react "^7.3.0"

"@silverstripe/webpack-config@^1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@silverstripe/webpack-config/-/webpack-config-1.3.0.tgz#66b122202b659bd59f1d13e0df0e54a150d216b4"
integrity sha512-YJcS4BSICzHGUSwA+uK4V4vPx4UJw6wDJ18xwMJ8mWkKED5YJeUeIWjFi2xAGvmohDD2mtenphHJDMO9wXRBCA==
"@silverstripe/webpack-config@^1.7.0":
version "1.7.0"
resolved "https://registry.yarnpkg.com/@silverstripe/webpack-config/-/webpack-config-1.7.0.tgz#1fed0775d95c9120e4fc2031a611c50dc6c4b3f0"
integrity sha512-lwtiEW+4oRQzNL24fKRnTffIPE5FCKJCCL2IuOIDdrIDoxxm381fzkcwWuWfhK7Oxbjz9A49UIDfzkUQ1/oW5g==
dependencies:
autoprefixer "^6.4.0"
babel-core "^6.24.1"
Expand Down Expand Up @@ -2434,7 +2434,7 @@ debug@^3.1.0, debug@^3.2.6:
dependencies:
ms "^2.1.1"

debuglog@*, debuglog@^1.0.1:
debuglog@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492"
integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=
Expand Down Expand Up @@ -4461,7 +4461,7 @@ imports-loader@^0.6.5:
loader-utils "0.2.x"
source-map "0.1.x"

imurmurhash@*, imurmurhash@^0.1.4:
imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
integrity sha1-khi5srkoojixPcT7a21XbyMUU+o=
Expand Down Expand Up @@ -5898,11 +5898,6 @@ lodash._basecopy@^3.0.0:
resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36"
integrity sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=

lodash._baseindexof@*:
version "3.1.0"
resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c"
integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw=

lodash._baseuniq@~4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8"
Expand All @@ -5911,16 +5906,11 @@ lodash._baseuniq@~4.6.0:
lodash._createset "~4.0.0"
lodash._root "~3.0.0"

lodash._bindcallback@*, lodash._bindcallback@^3.0.0:
lodash._bindcallback@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e"
integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4=

lodash._cacheindexof@*:
version "3.0.2"
resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92"
integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI=

lodash._createassigner@^3.0.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz#838a5bae2fdaca63ac22dee8e19fa4e6d6970b11"
Expand All @@ -5930,19 +5920,12 @@ lodash._createassigner@^3.0.0:
lodash._isiterateecall "^3.0.0"
lodash.restparam "^3.0.0"

lodash._createcache@*:
version "3.1.2"
resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093"
integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM=
dependencies:
lodash._getnative "^3.0.0"

lodash._createset@~4.0.0:
version "4.0.3"
resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26"
integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY=

lodash._getnative@*, lodash._getnative@^3.0.0:
lodash._getnative@^3.0.0:
version "3.9.1"
resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=
Expand Down Expand Up @@ -6058,7 +6041,7 @@ lodash.memoize@^4.1.2:
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=

lodash.restparam@*, lodash.restparam@^3.0.0:
lodash.restparam@^3.0.0:
version "3.6.1"
resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805"
integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=
Expand Down Expand Up @@ -6944,7 +6927,6 @@ npm@^6.0.0:
cmd-shim "^3.0.3"
columnify "~1.5.4"
config-chain "^1.1.12"
debuglog "*"
detect-indent "~5.0.0"
detect-newline "^2.1.0"
dezalgo "~1.0.3"
Expand All @@ -6959,7 +6941,6 @@ npm@^6.0.0:
has-unicode "~2.0.1"
hosted-git-info "^2.8.8"
iferr "^1.0.2"
imurmurhash "*"
infer-owner "^1.0.4"
inflight "~1.0.6"
inherits "^2.0.4"
Expand All @@ -6978,14 +6959,8 @@ npm@^6.0.0:
libnpx "^10.2.4"
lock-verify "^2.1.0"
lockfile "^1.0.4"
lodash._baseindexof "*"
lodash._baseuniq "~4.6.0"
lodash._bindcallback "*"
lodash._cacheindexof "*"
lodash._createcache "*"
lodash._getnative "*"
lodash.clonedeep "~4.5.0"
lodash.restparam "*"
lodash.union "~4.6.0"
lodash.uniq "~4.5.0"
lodash.without "~4.4.0"
Expand Down