Skip to content

Commit

Permalink
Merge pull request #1475 from pantheon-systems/fix/sites_mass-update
Browse files Browse the repository at this point in the history
Fixed sites mass-update's tags filter
  • Loading branch information
TeslaDethray authored Dec 20, 2016
2 parents 44360d7 + 0b0a8c7 commit ac7c33b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#Change Log
All notable changes to this project starting with the 0.6.0 release will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org)

## MASTER
### Fixed
- Fixed `sites mass-update`'s `--tag` filter. (#1475)

## 0.13.6 - 2016-12-13
### Changed
- Users are notified of impending Terminus release via update notification with the following message:
Expand Down
3 changes: 2 additions & 1 deletion php/Terminus/Collections/OrganizationSiteMemberships.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Terminus\Collections;

use Terminus\Exceptions\TerminusException;
use Terminus\Exceptions\TerminusNotFoundException;

class OrganizationSiteMemberships extends TerminusCollection
{
Expand Down Expand Up @@ -65,7 +66,7 @@ public function get($id)
}
}
}
return null;
throw new TerminusNotFoundException('No such site membership was found in this organization.');
}

/**
Expand Down
17 changes: 9 additions & 8 deletions php/Terminus/Models/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Terminus\Collections\SiteOrganizationMemberships;
use Terminus\Collections\SiteUserMemberships;
use Terminus\Collections\Workflows;
use Terminus\Exceptions\TerminusNotFoundException;

class Site extends TerminusModel
{
Expand Down Expand Up @@ -357,21 +358,21 @@ function ($membership) {
* Returns tags from the site/org join
* TODO: Move these into tags model/collection
*
* @param Organization $org UUID of organization site belongs to
* @param Organization $org An object representing the organization with tags on this site
* @return string[]
*/
public function getTags($org)
{
if (isset($this->tags)) {
return $this->tags;
}
$org_site_member = new OrganizationSiteMemberships(
['organization' => $org,]
);
$org_site_member->fetch();
$org = $org_site_member->get($this->id);
$tags = $org->get('tags');
return $tags;
$org_site_memberships = new OrganizationSiteMemberships(['organization' => $org,]);
try {
$org_site_membership = $org_site_memberships->get($this->id);
} catch (TerminusNotFoundException $e) {
return [];
}
return $org_site_membership->get('tags');
}

/**
Expand Down

0 comments on commit ac7c33b

Please sign in to comment.