File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ def validate_media!
9393
9494 raise Mastodon ::ValidationError , I18n . t ( 'media_attachments.validations.too_many' ) if @options [ :media_ids ] . size > 4
9595
96- @media = MediaAttachment . where ( status_id : nil ) . where ( id : @options [ :media_ids ] . take ( 4 ) . map ( &:to_i ) )
96+ @media = @account . media_attachments . where ( status_id : nil ) . where ( id : @options [ :media_ids ] . take ( 4 ) . map ( &:to_i ) )
9797
9898 raise Mastodon ::ValidationError , I18n . t ( 'media_attachments.validations.images_and_video' ) if @media . size > 1 && @media . find ( &:video? )
9999 end
Original file line number Diff line number Diff line change 167167
168168 it 'attaches the given media to the created status' do
169169 account = Fabricate ( :account )
170- media = Fabricate ( :media_attachment )
170+ media = Fabricate ( :media_attachment , account : account )
171171
172172 status = subject . call (
173173 account ,
178178 expect ( media . reload . status ) . to eq status
179179 end
180180
181+ it 'does not attach media from another account to the created status' do
182+ account = Fabricate ( :account )
183+ media = Fabricate ( :media_attachment , account : Fabricate ( :account ) )
184+
185+ status = subject . call (
186+ account ,
187+ text : "test status update" ,
188+ media_ids : [ media . id ] ,
189+ )
190+
191+ expect ( media . reload . status ) . to eq nil
192+ end
193+
181194 it 'does not allow attaching more than 4 files' do
182195 account = Fabricate ( :account )
183196
You can’t perform that action at this time.
0 commit comments