aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorMikael Nordfeldth <mmn@hethane.se>2016-01-07 18:14:45 +0100
committerMikael Nordfeldth <mmn@hethane.se>2016-01-07 18:14:45 +0100
commit1f02dc639ec3dfa44df87c4fa031b3f298ffee7e (patch)
tree7b001fe3de971d612b359defc37f5a814cffd27a /actions
parentbe58fd64f577d274a50ab622ce65cb446177b51d (diff)
downloadgnu-social-1f02dc639ec3dfa44df87c4fa031b3f298ffee7e.tar
gnu-social-1f02dc639ec3dfa44df87c4fa031b3f298ffee7e.zip
shortenLinks _after_ media upload to be consistent with api
Diffstat (limited to 'actions')
-rw-r--r--actions/newnotice.php26
1 files changed, 13 insertions, 13 deletions
diff --git a/actions/newnotice.php b/actions/newnotice.php
index c4b6bfa554..4a864b25c3 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -129,19 +129,6 @@ class NewnoticeAction extends FormAction
$act->time = time();
$act->actor = $this->scoped->asActivityObject();
- $content = $this->scoped->shortenLinks($content);
-
- // Reject notice if it is too long (without the HTML)
- // Should we do this before or after the upload attachment link? I think before...
- if (Notice::contentTooLong($content)) {
- // TRANS: Client error displayed when the parameter "status" is missing.
- // TRANS: %d is the maximum number of character for a notice.
- throw new ClientException(sprintf(_m('That\'s too long. Maximum notice size is %d character.',
- 'That\'s too long. Maximum notice size is %d characters.',
- Notice::maxContent()),
- Notice::maxContent()));
- }
-
$upload = null;
try {
// throws exception on failure
@@ -158,6 +145,19 @@ class NewnoticeAction extends FormAction
// simply no attached media to the new notice
}
+ $content = $this->scoped->shortenLinks($content);
+
+ // Reject notice if it is too long (without the HTML)
+ // This is done after MediaFile::fromUpload etc. just to act the same as the ApiStatusesUpdateAction
+ if (Notice::contentTooLong($content)) {
+ // TRANS: Client error displayed when the parameter "status" is missing.
+ // TRANS: %d is the maximum number of character for a notice.
+ throw new ClientException(sprintf(_m('That\'s too long. Maximum notice size is %d character.',
+ 'That\'s too long. Maximum notice size is %d characters.',
+ Notice::maxContent()),
+ Notice::maxContent()));
+ }
+
$actobj = new ActivityObject();
$actobj->type = ActivityObject::NOTE;
$actobj->content = common_render_content($content, $this->scoped, $parent);