Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgabrielrumiranda <gabrielrumiranda@gmail.com>2019-09-23 06:00:20 +0300
committerJonne Haß <me@jhass.eu>2021-04-11 18:22:40 +0300
commit394eafccc528aaa9d2aed9925f0e24525a12b71f (patch)
treef0f8f064d7cf7a8eaf970f5179956e5c614ac5c2 /app/models/photo.rb
parentef9e764f7a39948941599e54a46995ffb7bf1f70 (diff)
Actually implement validation error case in Photo#ownserhip_of_status_message
closes #8214 closes #8048 Co-authored-by: Thorsten Claus <thorstenclaus@web.de>
Diffstat (limited to 'app/models/photo.rb')
-rw-r--r--app/models/photo.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/app/models/photo.rb b/app/models/photo.rb
index 75d7f83a8..adc604221 100644
--- a/app/models/photo.rb
+++ b/app/models/photo.rb
@@ -68,11 +68,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={})