Fix sending hashtags and mentions

Signed-off-by: Louis Chemineau <louis@chmn.me>
pull/1588/head
Louis Chemineau 2023-01-19 15:11:05 +01:00
rodzic ba96d644e0
commit d6f086a22a
2 zmienionych plików z 175 dodań i 181 usunięć

Wyświetl plik

@ -124,14 +124,10 @@ class LocalController extends Controller {
*
* @NoAdminRequired
*/
public function postCreate(string $content = '', $to = null, string $type = null, ?string $replyTo = null, $attachments = null, ?string $hashtags = null): DataResponse {
public function postCreate(string $content = '', array $to = [], string $type = null, ?string $replyTo = null, $attachments = null, array $hashtags = []): DataResponse {
$content = $content ?: '';
$to = is_string($to) ? [$to] : $to;
$to = $to ?? [];
$replyTo = $replyTo ?? '';
$type = $type ?? Stream::TYPE_PUBLIC;
$hashtags = $hashtags === '' ? [] : $hashtags;
$hashtags = $hashtags ?? [];
$attachments = $attachments ?? [];
try {

Wyświetl plik

@ -477,14 +477,12 @@ export default {
const formData = new FormData()
formData.append('content', content)
formData.append('to', to)
formData.append('hashtags', hashtags)
to.forEach(to => formData.append('to[]', to))
hashtags.forEach(hashtag => formData.append('hashtags[]', hashtag))
formData.append('type', this.type)
for (const preview of this.previewUrls) {
// TODO send the summary and other props too
formData.append('attachments[]', preview.result)
formData.append('attachmentDescriptions[]', preview.description)
}
this.previewUrls.forEach(preview => formData.append('attachments[]', preview.result))
this.previewUrls.forEach(preview => formData.append('attachmentDescriptions[]', preview.description))
if (this.replyTo) {
formData.append('replyTo', this.replyTo.id)
}
@ -626,6 +624,25 @@ export default {
min-height: 70px;
min-width: 2px;
display: block;
:deep(.mention) {
color: var(--color-primary-element);
background-color: var(--color-background-dark);
border-radius: 5px;
padding-top: 1px;
padding-left: 2px;
padding-bottom: 1px;
padding-right: 5px;
img {
width: 16px;
border-radius: 50%;
overflow: hidden;
margin-right: 3px;
vertical-align: middle;
margin-top: -1px;
}
}
}
[contenteditable=true]:empty:before {
@ -671,6 +688,11 @@ export default {
top: 2;
}
.hashtag {
text-decoration: underline;
}
</style>
<style lang="scss">
/* Tribute-specific styles TODO: properly scope component css */
.tribute-container {
position: absolute;
@ -695,7 +717,6 @@ export default {
border-radius: 4px;
background-clip: padding-box;
overflow: hidden;
}
li {
color: var(--color-text);
@ -731,7 +752,7 @@ export default {
&.no-match {
cursor: default;
}
}
}
.menu-highlighted {
@ -752,27 +773,4 @@ export default {
opacity: .6;
}
}
.message .mention {
color: var(--color-primary-element);
background-color: var(--color-background-dark);
border-radius: 5px;
padding-top: 1px;
padding-left: 2px;
padding-bottom: 1px;
padding-right: 5px;
img {
width: 16px;
border-radius: 50%;
overflow: hidden;
margin-right: 3px;
vertical-align: middle;
margin-top: -1px;
}
}
.hashtag {
text-decoration: underline;
}
</style>