File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,13 +96,13 @@ def self.complex_sql
9696 (EXISTS (SELECT 1 FROM #{ Pseudonym . quoted_table_name }
9797 WHERE #{ like_condition ( 'pseudonyms.sis_user_id' ) }
9898 AND pseudonyms.user_id = users.id
99- AND ( pseudonyms.workflow_state IS NULL
100- OR pseudonyms.workflow_state != 'deleted') )
101- OR ( #{ like_condition ( 'users.name' ) } )
102- OR EXISTS (SELECT 1 FROM #{ CommunicationChannel . quoted_table_name }
103- WHERE communication_channels.user_id = users.id
104- AND ( communication_channels.path_type = ?
105- AND #{ like_condition ( ' communication_channels.path' ) } ) ))
99+ AND pseudonyms.workflow_state='active')
100+ OR ( #{ like_condition ( 'users.name' ) } )
101+ OR EXISTS (SELECT 1 FROM #{ CommunicationChannel . quoted_table_name }
102+ WHERE communication_channels.user_id = users.id
103+ AND communication_channels.path_type = ?
104+ AND #{ like_condition ( ' communication_channels.path' ) }
105+ AND communication_channels.workflow_state='active' ))
106106 SQL
107107 end
108108
Original file line number Diff line number Diff line change 162162 end
163163
164164 describe 'searching on emails' do
165- before { user . communication_channels . create! ( :path => 'the.giver@example.com' , :path_type => CommunicationChannel ::TYPE_EMAIL ) }
165+ let ( :cc ) { user . communication_channels . create! ( path : 'the.giver@example.com' ) }
166+
167+ before do
168+ cc . confirm!
169+ end
166170
167171 it 'matches against an email' do
168172 expect ( UserSearch . for_user_in_context ( "the.giver" , course , user ) ) . to eq [ user ]
175179 end
176180
177181 it 'will not match channels where the type is not email' do
178- user . communication_channels . last . update_attributes! ( :path_type => CommunicationChannel ::TYPE_TWITTER )
182+ cc . update_attributes! ( :path_type => CommunicationChannel ::TYPE_TWITTER )
183+ expect ( UserSearch . for_user_in_context ( "the.giver" , course , user ) ) . to eq [ ]
184+ end
185+
186+ it "doesn't match retired channels" do
187+ cc . retire!
179188 expect ( UserSearch . for_user_in_context ( "the.giver" , course , user ) ) . to eq [ ]
180189 end
181190 end
You can’t perform that action at this time.
0 commit comments