Loading Changelog.md +1 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ ## Bug fixes * Prefill conversation form on contacts page only with mutual contacts [#7744](https://github.com/diaspora/diaspora/pull/7744) * Fix profiles sometimes not loading properly in background tabs [#7740](https://github.com/diaspora/diaspora/pull/7740) * Show error message when creating posts with invalid aspects [#7742](https://github.com/diaspora/diaspora/pull/7742) ## Features Loading app/controllers/status_messages_controller.rb +2 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ class StatusMessagesController < ApplicationController format.mobile { redirect_to stream_path } format.json { render json: PostPresenter.new(status_message, current_user), status: 201 } end rescue StatusMessageCreationService::BadAspectsIDs render status: 422, plain: I18n.t("status_messages.bad_aspects") rescue StandardError => error handle_create_error(error) end Loading app/services/status_message_creation_service.rb +11 −6 Original line number Diff line number Diff line Loading @@ -9,15 +9,16 @@ class StatusMessageCreationService def create(params) build_status_message(params).tap do |status_message| load_aspects(params[:aspect_ids]) unless status_message.public? add_attachments(status_message, params) status_message.save process(status_message, params[:aspect_ids], params[:services]) process(status_message, params[:services]) end end private attr_reader :user attr_reader :user, :aspects def build_status_message(params) public = params[:public] || false Loading Loading @@ -54,13 +55,17 @@ class StatusMessageCreationService end end def process(status_message, aspect_ids, services) add_to_streams(status_message, aspect_ids) unless status_message.public def load_aspects(aspect_ids) @aspects = user.aspects_from_ids(aspect_ids) raise BadAspectsIDs if aspects.empty? end def process(status_message, services) add_to_streams(status_message) unless status_message.public? dispatch(status_message, services) end def add_to_streams(status_message, aspect_ids) aspects = user.aspects_from_ids(aspect_ids) def add_to_streams(status_message) user.add_to_streams(status_message, aspects) status_message.photos.each {|photo| user.add_to_streams(photo, aspects) } end Loading config/locales/diaspora/en.yml +1 −0 Original line number Diff line number Diff line Loading @@ -1122,6 +1122,7 @@ en: new: mentioning: "Mentioning: %{person}" too_long: "Please make your status message fewer than %{count} characters. Right now it is %{current_length} characters" bad_aspects: "Provided aspects IDs aren't applicable (non-existent or not owned)" stream_helper: no_more_posts: "You have reached the end of the stream." Loading Loading
Changelog.md +1 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ ## Bug fixes * Prefill conversation form on contacts page only with mutual contacts [#7744](https://github.com/diaspora/diaspora/pull/7744) * Fix profiles sometimes not loading properly in background tabs [#7740](https://github.com/diaspora/diaspora/pull/7740) * Show error message when creating posts with invalid aspects [#7742](https://github.com/diaspora/diaspora/pull/7742) ## Features Loading
app/controllers/status_messages_controller.rb +2 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ class StatusMessagesController < ApplicationController format.mobile { redirect_to stream_path } format.json { render json: PostPresenter.new(status_message, current_user), status: 201 } end rescue StatusMessageCreationService::BadAspectsIDs render status: 422, plain: I18n.t("status_messages.bad_aspects") rescue StandardError => error handle_create_error(error) end Loading
app/services/status_message_creation_service.rb +11 −6 Original line number Diff line number Diff line Loading @@ -9,15 +9,16 @@ class StatusMessageCreationService def create(params) build_status_message(params).tap do |status_message| load_aspects(params[:aspect_ids]) unless status_message.public? add_attachments(status_message, params) status_message.save process(status_message, params[:aspect_ids], params[:services]) process(status_message, params[:services]) end end private attr_reader :user attr_reader :user, :aspects def build_status_message(params) public = params[:public] || false Loading Loading @@ -54,13 +55,17 @@ class StatusMessageCreationService end end def process(status_message, aspect_ids, services) add_to_streams(status_message, aspect_ids) unless status_message.public def load_aspects(aspect_ids) @aspects = user.aspects_from_ids(aspect_ids) raise BadAspectsIDs if aspects.empty? end def process(status_message, services) add_to_streams(status_message) unless status_message.public? dispatch(status_message, services) end def add_to_streams(status_message, aspect_ids) aspects = user.aspects_from_ids(aspect_ids) def add_to_streams(status_message) user.add_to_streams(status_message, aspects) status_message.photos.each {|photo| user.add_to_streams(photo, aspects) } end Loading
config/locales/diaspora/en.yml +1 −0 Original line number Diff line number Diff line Loading @@ -1122,6 +1122,7 @@ en: new: mentioning: "Mentioning: %{person}" too_long: "Please make your status message fewer than %{count} characters. Right now it is %{current_length} characters" bad_aspects: "Provided aspects IDs aren't applicable (non-existent or not owned)" stream_helper: no_more_posts: "You have reached the end of the stream." Loading