Merge branch 'next-minor' into develop

This commit is contained in:
Jonne Haß 2021-04-11 17:23:46 +02:00
commit f4dc6d0dc7
5 changed files with 8 additions and 9 deletions

View file

@ -48,6 +48,7 @@ Although the chat was never enabled per default and was marked as experimental,
* Removed support for defunct Uni Heidelberg OSM tile server, Mapbox is now required if you want to show maps [#8215](https://github.com/diaspora/diaspora/pull/8215)
* Render only two fractional digits in the posts per user/day admin statistics [#8227](https://github.com/diaspora/diaspora/pull/8227)
* Make aspect dropdowns scrollable [#8213](https://github.com/diaspora/diaspora/pull/8213)
* Fix `Photo#ownserhip_of_status_message` validation [#8214](https://github.com/diaspora/diaspora/pull/8214)
## Features
* Support and recommend TOML as configuration format [#8132](https://github.com/diaspora/diaspora/pull/8132)

View file

@ -67,11 +67,9 @@ class Photo < ApplicationRecord
def ownership_of_status_message
message = StatusMessage.find_by_guid(self.status_message_guid)
if self.status_message_guid && message
self.diaspora_handle == message.diaspora_handle
else
true
end
return unless status_message_guid && message && diaspora_handle != message.diaspora_handle
errors.add(:base, "Photo must have the same owner as status message")
end
def self.diaspora_initialize(params={})

View file

@ -32,7 +32,7 @@ end
Given /^"([^"]*)" has a public post with text "([^"]*)" and a picture/ do |email, text|
user = User.find_by(email: email)
post = user.post(:status_message, text: text, public: true, to: user.aspect_ids)
FactoryBot.create(:photo, status_message: post)
FactoryBot.create(:photo, status_message: post, author: user.person)
end
Given /^there are (\d+) public posts from "([^"]*)"$/ do |n_posts, email|

View file

@ -216,7 +216,7 @@ describe Notifier, type: :mailer do
end
it "can handle status_messages without text" do
photo = FactoryBot.create(:photo, public: true)
photo = FactoryBot.create(:photo, public: true, author: alice.person)
status = FactoryBot.create(:status_message, author: alice.person, text: nil, photos: [photo], public: true)
like = status.likes.create!(author: bob.person)
mail = Notifier.send_notification("liked", alice.id, like.author.id, like.id)

View file

@ -306,7 +306,7 @@ describe StatusMessage, type: :model do
let(:post) { FactoryBot.create(:status_message, author: alice.person) }
it "receives attached photos" do
photo = FactoryBot.create(:photo, status_message: post)
photo = FactoryBot.create(:photo, status_message: post, author: alice.person)
post.receive([bob.id])
@ -321,7 +321,7 @@ describe StatusMessage, type: :model do
end
it "works with already received attached photos" do
photo = FactoryBot.create(:photo, status_message: post)
photo = FactoryBot.create(:photo, status_message: post, author: alice.person)
photo.receive([bob.id])
post.receive([bob.id])