Skip to content

Commit 8968695

Browse files
authored
Merge pull request #1117 from kubamahnert/TMA-775-smart-attribute-polling-valid-elements
TMA-775: smart attribute polling
2 parents 5509187 + dc1c625 commit 8968695

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

lib/gooddata/models/user_filters/user_filter_builder.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,10 @@ def self.verify_existing_users(filters, options = {})
140140

141141
def self.create_label_cache(result, options = {})
142142
project = options[:project]
143-
project_labels = project.labels
144143

145144
result.reduce({}) do |a, e|
146145
e[:filters].map do |filter|
147-
a[filter[:label]] = project_labels.find { |l| (l.identifier == filter[:label]) || (l.uri == filter[:label]) } unless a.key?(filter[:label])
146+
a[filter[:label]] = project.labels(filter[:label]) unless a.key?(filter[:label])
148147
end
149148
a
150149
end

spec/unit/models/user_filters/user_filter_builder_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
let(:profile_url) { '/gdc/account/profile/foo' }
3737

3838
before do
39-
allow(project).to receive(:labels)
40-
.and_return([label])
41-
allow(project).to receive(:labels)
42-
.and_return([label])
39+
allow(project).to receive(:labels).with(label_uri)
40+
.and_return(label)
41+
allow(project).to receive(:labels).with("label.csv_policies.state")
42+
.and_return(label)
4343
allow(project).to receive(:attributes)
4444
allow(project).to receive(:users).and_return(project_users)
4545
allow(project).to receive(:data_permissions).and_return([existing_filter])

0 commit comments

Comments
 (0)