Skip to content

Commit

Permalink
Fix lib shopid (#2502)
Browse files Browse the repository at this point in the history
* Allow customer to move past validation after one pass

* Silencing needless warning

* Add missing imports

* When we get a "GetTax" error, revert to addressbook

* Capture and parse errors

* Creating a "review and fix" address review screen

* Show highlited diff. Copy over values on click.

* Removing "debug" HTML

* Add "review address" translation

* Basic "review address" flow working

* Remove console.log

* Fix missing import

* Fix import error

* Return to edit and refresh address when you cancel out of review

* Make edit behave the same as add

* Tweak styling

* More and more style changes

* Use proper color variables

* Create proper behaviors

* Fix bad evaluation

* Fix import order

* Add i18n

* Don't throwback a step if tax fails

* Make this more of an "exception" flag

* Adding the license description with link on README (#2365)

* added Nigerian Naira to currency list in (#2366)

private/data/Shops.json

* CollectionFS  cfs:tempstore and cfs:worker to fix concurrency issues with GridFS uploads (#2096)

* added cfs tempstore and worker to fix concurrency issues

* linting

* Correct the way we record tax overrides

* [WIP] Meteor 1.5 (#2371)

* Meteor 1.5

- include Buffer polyfill
- replaces abernix:standard-minifier-js with standard-minifier-js
- properly pins job-collections to 1.4.0

* Updated to 1.5.0 base image

* Pin react-meteor-data to 0.2.9

* Remove unused vars

Cherry pick
b36709c19
e47b25049f90643739df4bcf5210d64

* update to reactioncommerce/base:v2.0.0

* transliteration 1.6.2 (#2389)

- Related to #2090 and #2091
- Reduces minified footprint by315k
- updates client import

* Meteor1.5 and docker updates (#2390)

* fix error handling in CI deploy script

* fix CI build script

* add docker-compose.yml for CircleCI

* install Docker Compose in CI

* set docker/docker-compose versions in CI env

* fix missing curl issue in CI test

* Updated 1.5 packages

* Declare variable (#2401)

* Implement missing router functions (#2393)

* Implement missing router functions

- Implement `Router.setQueryParam()`
- Fix `Router.getRouteName()`

* Fix function name for `setQueryParams`

* Fixes and tests

- Added jest config to package.json
- Added some jest unit tests for Router
- Added mocks for some dependencies
- Fixed route matching in Router.isActiveClassName method

* fix package.json to run tests (#2396)

* Removed comment

* Remove duplicated setQueryParams function

Fixed variable

* 2332 Fix Improper Cart Merge (#2387)

* add test suite to replicate #2332

* fix improper cart merge when user cart has items in anonymous cart already

* update anonymous cart `variants._id` to equal user cart `variants_id`

* fix console error when merging into newly logged in user cart

* implement review

* Change line width to match GH PR review width (#2407)

* Orders updates (#2400)

* add expandable header to summary

* i18n - move keys into local package

* new npm package

* new Badge component

* i18n updates

* badge style updates

* add Badge and clicktocopy to components

* clickToCopy component

* badge component

* i18n updates

* badge and ClicktoCopy components

* add card to summary section of orders

* Merge branch 'ek-orders' into ek-orders-summaryPanel

# Conflicts:
#	package.json

* update orderSummary fields

* fix imports

* ordersList react-ivize

* fix prop validation

* validation fixes for Badge component

* remove no longer used files

* comment out old blaze templates

leaving them here for a bit just to make sure no errors occur

* remove blaze templates

* orders panel LESS

* update workflow loop to remove extra headers

* removed errant test text

* fix translations

* update shrinkwrap

* tests

* simpleschema

* comment killing

* New test for <ClickToCopy />

* lint fixes

* fix

* add more props to Badge test

* refund button coming in phase2

* fix import / console error

* Update random.js

* lint fixes

* use route permissions in register.js files (#2388)

* Milestone 54 / Convert Navbar to React (#2306)

* Navbar dropdowns conversion to React (#2230)

* Implement currencies using Dropdown Menu Component

* Add active prop on list item in Dropdown menu

* Resolve reactivity for currency drop down

* Add language dropdown implementation

* Add select on current selected language

* Remove extra code

* Have language icon div be larger

* Fix pop over arrangement

* Fix spacing, add caret on language dropdown

* Deal with display when switches are pff

* Fix overflow issues on dropdown-menu

* Fix linting

* Close dropdown on menu item click

* Add import for Match

* Convert login views to React (#2250)

* Initial component/container setup for sign in page

* Replicate look of sign in form

* Replicate look of sign up form

* Use composeWithTracker in signInContainer

* Replicate look of forgot password form

* Create parent login container to hold general login for views

* Add switching between views logic

* Set up sign in form submission

* Set up sign up form submission

* Set up forgot password form submission

* Handle sign in action and error message display

* Remove template methods

* Remove template methods and alert message template

* Rewrite renderPasswordErrors method

* Render social buttons on login

* Add social login functionality

* Remove unnecessary blaze templates

* Move functions to React

* Implement sign up functionality

* Merge signin and signup containers

* Put back helper methods needed by other templates

* Abstract loginFormMessaged into react container

* Add forgot password functionality (part1)

* Remove unnecessary component in helper

* Remove forgot password template

* Clean up folder structure

* Solve invariant violation browser error

* updatepasswordOverlay react component/container

* completed updayePasswordOverlay functionality

* Remove stopPropagation function

* Capitalize social login name

* Show loading spinner while processing button clicks

* Solve onClick not working by removing 'event.stopPropagation()' on parent template

* Remove JQuery and use lodash

* Using 'event' instead of 'e' to reference event handlers

* Add validation for no email input on forgot password

* Add error message on social login

* Move capitalize function to helper file

* Move capitalize function to helper file

* [WIP]Main navbar container conversion to React (#2277)

Main navbar container conversion to React

* Convert to react: Tag navigation (#2251)

* Test tagnav component

* Use existing tag component

* Update component setup

* Use existing tagsList container

* Remove debugging

* Edit button

* Use tagItem loop to match styles instead of existing

* Base tagTree init

* Fix structure

* Fix dropdown mouseover event

* Edit conditional

* Base tag editatble

* Button switch fix

* On edit fix

* Selectable button icon

* Enable drop of tagtree by icon

* Init edit mode for tagTree

* Tagtree second level new tag

* Typo fix

* Fix top level width and classes

* Show Base tagList

* Lint clean up

* Remove commented code

* Style fix and show new tag on edit

* i18n

* Init saving top level tags

* Saving tags - cont

* New tag save fix

* Switching to Taglist custom

* Saving top level

* Enable new tag option

* Move class names to base comp

* Style on create new tag item

* Fix Hover back

* Move file

* Tag select prop

* Rename files

* Fix save and delete

* Reorder element wrapper

* Init passing the functions down

* Init editing new tag item on tree

* Separate the two new tagItems

* Adding new tags on tree + refactor 🎉

* Fix delete on subtags

* Reset form after save and prevent saving empty tags

* Prevent close of tree after save

* Restructure tree state to fix input

* Init refactor on tagTree

* Props setup after refactor

* Reposition button

* Autocompletion fixing

* Add componentWillReceiveProps to fix re-render and reset

* Refactor into container comp

* Remove debugs

* Use composewithTracker

* Remove props with spread

* Update props list

* Fix logic breaking new tag style

* Tag sort order after drag

* Clean un-used vars

* Add react tagNav to main navbar container

* Fix lint issue

* Init toggle visibility

* Close tags with overlay

* Remove JQuery references(part 1)

* Add router.go for tag click

* Mobile fixes and remove blaze files

* Fix click on mobile

* Remove jquery

* Remove jquery .closest

* UI tagnav classes update

* Fixes

* Fix undefined refs after merge with development

* Remove unused vars

* Editing should turn off on toggle

* Use Translation component over data-i18n

* Fix Brand name glitch

* Prefer standalone PropTypes import over React.PropTypes

* Inport i18next and Reaction in same line

* Space at end of self-closing tag

* One-lining imports

* Place '&nbsp' inside span for less random-looking code

* Add comment about style

* Use Divider component as separator

* import order

* remove duplicate babel preset packages

* Updated yarn.lock and removed npm-shrinkwrap.json

I’ll try to add back in the release branch, but something funky is
going on with shrink-wrap

* Admin should be able to invite a user with the same name (#2386)

* turn the user name to lowercase

* turn the user name to a lowercase string with a random number e.g michael-alade49

* add custom name field to users and accounts schema

* create new env var for setting default admin’s name

* publish new name field for users

* remove unnecessary typeof check for Reaction var

* switch priority for user’s displayName source

* remove redundant email update and only add user’s name if exists

* Update version

* switch to Reaction’s new fork of Nodemailer (#2427)

* Added module aliases (#2436)

* Added module aliases

- Added module alias for `core/ui`
- Added module alias for `core/router`

* Revert jest module name mapper

* fix tests

- Fixed duplicated mocks warning
- added some new mocks
- fix translaton component test

* LingoHub Update 🚀 (#2420)

Manual push by LingoHub User: Aaron Judd.
Project: reaction

Made with ❤️ by https://lingohub.com

* Add css style to differentiate read from unread notifications (#2442)

* Remove acceptance tests (#2430)

* Remove non-working tests

* Remove unneeded dependencies

* Fixed console error when dragging product images (#2443)

* Add closeOnClick option to DropDownMenu component (#2418)

* Add closeOnClick option to DropDownMenu component

* Fix lint issue - move handleDropdownToggle after componentWillReceiveProps

* add missing "orders not found" text (#2424)

* Updated chai package

- tested with reaction test, tests seemed to work normal

* Bunyan and Loggly updates (#2425)

* switch to official Loggly lib for Node and write new Bunyan connector for it

* update bunyan to 2.0.0

* add REACTION_LOG_FORMAT config option

* add extra comments about log formatting options

* refactor default admin user creation (#2453)

* update memory usage in CircleCI build (#2462)

* Navbar hover issue (#2451)

* added default hover style for languages and currencies class #2444

* added accounts css class to div in mainDropdownContainer #2444

* added hover styles for account class #2444

* added hover style for notification class #2444

* set css property overflow on horizontal to hidden (#2458)

* [WIP] 2452 fix on UI icon toolbar (#2460)

2452 fix on UI icon toolbar

* [WIP] 2356 fix on tag menu-sidebar glitch (#2472)

Fix on tag menu-sidebar glitch

* update media gallery new / deleted image indicators (#2469)

* add new status for mediaGalleryIndicator

* i18n translations for tooltips

* status-badge styles for media gallery

* update media gallery image new / deleted indicator

* style updates

* lint fix

* Remove random regex checks on names. Fixes #2461 (#2471)

* remove older Blaze based launchdock plugin (#2467)

* 2459 router range error fix (#2476)

* simple fix

* fix typo & linting

* fix linting issues

* 2422 Fix on email invite link leading to blank screen (#2437)

* imported LoginFormValidation to forgotContainer

* imported LoginFormValidation to passwordOverlayContainer

* added setTimeout function to delay rendering

* wrap component in translations (#2434)

* removed setTimeouts from updatePassword.js

* added spinner before mounting the component

* replaced setTimeout with life-cycle hook(componentWillRecieveProps) #2422

* imported LoginFormValidation to prevent console error

* Update current user's name on Navbar and profile page when address is added. (#2455)

* Update current user's name and profile when address is added

* Update user's name when address is updated

* Get correct admin user's name from env variables

* Updated dependencies (#2463)

* Move babelrc into package.json

* Updated dependencies

* Define missing options variable

* Revert minifier to abernix fork (#2486)

* Use abernix:standard-minifier-js

Replace standard-minifier-js with
abernix:standard-minifier-js@2.1.0-beta.0

This should be compatible with current 1.5 tools, and is what we were
using before 1.5, because of the faster compilation and reduced memory
footprint.  Restoring in an attempt to diagnose build issues related to
memory.

* updated meteor package versions

* Release 1.3.0 (#2417)

## Features

-   **Meteor 1.5 (#2371)**
-   **Order fulfillment UI updates (#2400)**
-   **React Router updated (#2123)**
-   **React Navbar (and deprecated Blaze navbar) (#2306)**
-   **Re-introduce icon toolbar as shortcutBar (#2261)**
-   **React unit testing example (#2170)**
-   **[WIP] [Style guide](https://styleguide.reactioncommerce.com)**

## Changes / Fixes
- __Update current user&#39;s name on Navbar and profile page when address is added. (#2455)__
- __Fix #2422 on email invite link leading to blank screen (#2437)__
- __Fix #2459 router range error fix (#2476)__
- __Remove older Blaze based launchdock plugin (#2467)__
- __Remove random regex checks on names. Fixes #2461 (#2471)__
- __Update media gallery new / deleted image indicators (#2469)__
- __Fix #2356 on tag menu-sidebar glitch (#2472)__
- __Fix #2452 on UI icon toolbar (#2460)__
- __set css property overflow on horizontal to hidden (#2458)__
- __Navbar hover issue (#2451)__
- __update memory usage in CircleCI build (#2462)__
- __refactor default admin user creation (#2453)__
- __Bunyan and Loggly updates (#2425)__
- __Updated chai package__
- __add missing &#34;orders not found&#34; text (#2424)__
- __Add closeOnClick option to DropDownMenu component (#2418)__
-   **Fixed console error when dragging product images (#2443)**
-   **Remove unmaintained Browserstack acceptance tests (#2430)**
-   **Add css style to differentiate read from unread notifications (#2442)**
-   **Added module aliases @reactioncommerce/reaction-ui (#2436)**
-   **Switch to Reaction’s new fork of Nodemailer (#2427)**
-   **Admin should be able to invite a user with the same name (#2386)**
-   **Updated yarn.lock and removed npm-shrinkwrap.json**
-   **use route permissions in register.js files (#2388)**
-   **Updated, refreshed order/fulfillment UI (#2400)**
-   **Change line width to match GH PR review width (#2407)**
-   **Fix Improper Cart Merge (#2387)**
-   **Implement missing router functions (#2393)**
-   **Correct the way we record tax overrides**
-   **CollectionFS  cfs:tempstore and cfs:worker to Fix concurrency issues with GridFS uploads (#2096)**
-   **Fix typo in inventory test description (#2364)**
-   **Added Nigerian Naira to currency list in (#2366)**
-   **Fix git tagging on CircleCI 2.0 (#2362)**
-   **Adding the license description with link on README (#2365)**
-   **Better handling for unique routes for React Router (#2327)**
-   **Don't throwback a step if tax fails**
-   **Updated UI colors for styleguide (#2339)**
-   **Add loading component to Fix error (#2340)**
-   **Allow a MAIL_URL string without auth (#2330)**
-   **Defer Fixture load until the default shop is loaded (#2329)**
-   **Fix conditional in Circle deploy script (#2338)**
-   **Fix refunds not showing (#2317)**
-   **Add Verification Url to Welcome Email (#2216)**
-   **CircleCI 2.0 and docker base update (#2334)**
-   **i18n translation updates (#2302 #2420)**
-   **Change customer notification message when order is processed. (#2290)**
-   **Allow loader to show when one is passed in and defined BUGFIX (#2303)**
-   **Add the Vietnamese Dong as a supported currency (#2248)**
-   **Updated shipping / payment error messages in checkout (#2271)**
-   **Fix #2203 Long Strings Handling in Product Option Title (#2266)**
-   **Simplify core layout component (#2257)**
-   **Fix multiple refunds for stripe (#2260)**

* Fix error when inviting already invited user (#2433)

* Refactor invite function to send invites only to non invited members

* Refactor error message to show status code

* Change the error message to use inline Alert

* Clear input fields when there is error

* Use Reaction's blaze inlineAlerts for error message

* Eliminate console error on inviteShopMember call

* Updated timeout time. (#2492)

* Updated timeout time.

* don't autohide

This should not autohide, the error should display until a user resubmits with a new email address. If the error is hidden, they might not see it right away and miss it. This is a blocking error for this field so it should stay until resolved.

* Fixed product images not displaying on order completed page (#2490)

* Fix hard refresh on clicking tag link on product detail page (#2489)

* Provide tag component with missing click function

* Remove hard refresh on PDP link in Grid settings

* Remove redundant risul:moment-timezone (#2491)

* Use existing server or client version of getShopId. Fixes issue where creating products would always create for default shop

* Update getShopName in client/server/lib to use active shop where available

* Return empty string instead of undefined from server Reaction.getShopName()
  • Loading branch information
spencern authored Jul 11, 2017
1 parent 1d35b29 commit e03425f
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 20 deletions.
6 changes: 5 additions & 1 deletion client/modules/core/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,11 @@ export default {
},

getShopName() {
return this.shopName;
const shopId = this.getShopId();
const shop = Shops.findOne({
_id: shopId
});
return shop && shop.name;
},

getShopPrefix() {
Expand Down
27 changes: 19 additions & 8 deletions lib/api/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ import { Meteor } from "meteor/meteor";
import { Router } from "/imports/plugins/core/router/lib";
import { Shops } from "/lib/collections";


let Core;
if (Meteor.isClient) {
Core = require("/client/api");
} else {
Core = require("/server/api");
}

/**
* getShopId
* @return {String} returns current shopId
*/
export function getShopId() {
const domain = url.parse(Meteor.absoluteUrl()).hostname;

const shop = Shops.find({ domains: { $in: [domain] } }, {
limit: 1
}).fetch()[0];

return !!shop ? shop._id : null;
return Core.Reaction.getShopId();
}


Expand All @@ -24,9 +26,18 @@ export function getShopId() {
* @return {String} returns current shop name
*/
export function getShopName() {
const shopId = getShopId();
let shop;
if (shopId) {
shop = Shops.findOne({
_id: shopId
});
return shop && shop.name;
}

const domain = url.parse(Meteor.absoluteUrl()).hostname;

const shop = Shops.find({ domains: { $in: [domain] } }, {
shop = Shops.find({ domains: { $in: [domain] } }, {
limit: 1
}).fetch()[0];

Expand Down
41 changes: 30 additions & 11 deletions server/api/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,20 +229,39 @@ export default {
},

getShopName() {
const domain = this.getDomain();
const shop = Shops.find({
domains: domain
}, {
limit: 1,
fields: {
name: 1
}
}).fetch()[0];
return shop && shop.name;
const shopId = this.getShopId();
let shop;
if (shopId) {
shop = Shops.findOne({
_id: shopId
}, {
fields: {
name: 1
}
});
} else {
const domain = this.getDomain();
shop = Shops.findOne({
domains: domain
}, {
fields: {
name: 1
}
});
}
if (shop && shop.name) {
return shop.name;
}
// If we can't find the shop or shop name return an empty string
// so that string methods that rely on getShopName don't error
return "";
},

getShopPrefix() {
return "/" + this.getSlug(this.getShopName().toLowerCase());
const shopName = this.getShopName();
const lowerCaseShopName = shopName.toLowerCase();
const slug = this.getSlug(lowerCaseShopName);
return `/${slug}`;
},

getShopEmail() {
Expand Down

0 comments on commit e03425f

Please sign in to comment.