aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Comments
diff options
context:
space:
mode:
authorVitor Mattos <vitor@php.rio>2022-01-13 11:08:52 -0300
committerVitor Mattos <vitor@php.rio>2022-01-21 08:39:37 -0300
commit1ce894a50c2720a5881b22533d730062b7b4b426 (patch)
tree75d674542d06cc47be71dc89a316d9e326964e1d /lib/private/Comments
parent52affa9ddd422fec22c4275b307fc87e5f91059f (diff)
downloadnextcloud-server-1ce894a50c2720a5881b22533d730062b7b4b426.tar.gz
nextcloud-server-1ce894a50c2720a5881b22533d730062b7b4b426.zip
Disable reactions if database don't support utf8mb4
Fix column size Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'lib/private/Comments')
-rw-r--r--lib/private/Comments/Manager.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php
index 5c7e532f177..534de6a937b 100644
--- a/lib/private/Comments/Manager.php
+++ b/lib/private/Comments/Manager.php
@@ -102,7 +102,9 @@ class Manager implements ICommentsManager {
}
$data['children_count'] = (int)$data['children_count'];
$data['reference_id'] = $data['reference_id'] ?? null;
- $data['reactions'] = json_decode($data['reactions'], true);
+ if ($this->supportReactions()) {
+ $data['reactions'] = json_decode($data['reactions'], true);
+ }
return $data;
}
@@ -910,6 +912,9 @@ class Manager implements ICommentsManager {
}
private function deleteReaction(IComment $reaction): void {
+ if (!$this->supportReactions()) {
+ return;
+ }
$qb = $this->dbConn->getQueryBuilder();
$qb->delete('reactions')
->where($qb->expr()->eq('parent_id', $qb->createNamedParameter($reaction->getParentId())))
@@ -930,6 +935,9 @@ class Manager implements ICommentsManager {
* @since 24.0.0
*/
public function getReactionComment(int $parentId, string $actorType, string $actorId, string $reaction): IComment {
+ if (!$this->supportReactions()) {
+ throw new NotFoundException('The database does not support reactions');
+ }
$qb = $this->dbConn->getQueryBuilder();
$messageId = $qb
->select('message_id')
@@ -955,6 +963,7 @@ class Manager implements ICommentsManager {
* @since 24.0.0
*/
public function retrieveAllReactionsWithSpecificReaction(int $parentId, string $reaction): ?array {
+ $this->throwIfNotSupportReactions();
$qb = $this->dbConn->getQueryBuilder();
$result = $qb
->select('message_id')
@@ -975,6 +984,10 @@ class Manager implements ICommentsManager {
return $comments;
}
+ public function supportReactions(): bool {
+ return $this->dbConn->supports4ByteText();
+ }
+
/**
* Retrieve all reactions of a message
*
@@ -984,6 +997,9 @@ class Manager implements ICommentsManager {
* @since 24.0.0
*/
public function retrieveAllReactions(int $parentId): array {
+ if (!$this->supportReactions()) {
+ return [];
+ }
$qb = $this->dbConn->getQueryBuilder();
$result = $qb
->select('message_id')
@@ -1124,6 +1140,9 @@ class Manager implements ICommentsManager {
}
private function addReaction(IComment $reaction): void {
+ if (!$this->supportReactions()) {
+ return;
+ }
// Prevent violate constraint
$qb = $this->dbConn->getQueryBuilder();
$qb->select($qb->func()->count('*'))
background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
{ "translations": {
    "Shared with you" : "Delt med deg",
    "Shared with others" : "Delt med andre",
    "Shared by link" : "Delt med lenke",
    "Nothing shared with you yet" : "Ingenting er delt med deg ennå",
    "Files and folders others share with you will show up here" : "Filer og mapper som andre deler med deg vil bli vist her",
    "Nothing shared yet" : "Ingenting er delt ennå",
    "Files and folders you share will show up here" : "Filer og mapper som du deler vil bli vist her",
    "No shared links" : "Ingen delte lenker",
    "Files and folders you share by link will show up here" : "Filer og mapper som du deler med lenke vil bli vist her",
    "You can upload into this folder" : "Du kan laste opp til denne mappen",
    "No compatible server found at {remote}" : "Ingen kompatibel tjener ble funnet på {remote}",
    "Invalid server URL" : "Ugyldig tjener adresse",
    "Failed to add the public link to your Nextcloud" : "Feil oppstod under oppretting av offentlig lenke til din Nextcloud",
    "Share" : "Del",
    "No expiration date set" : "Ingen utløpsdato er satt",
    "Shared by" : "Delt av",
    "Sharing" : "Deling",
    "File shares" : "Fildelinger",
    "Downloaded via public link" : "Nedlastet via offentlig lenke",
    "Downloaded by {email}" : "Lastet ned av {email}",
    "{file} downloaded via public link" : "{file} lastet ned via offentlig lenke",
    "{email} downloaded {file}" : "{email} lastet ned {file}",
    "Shared with group {group}" : "Delt med gruppen {group}",
    "Removed share for group {group}" : "Fjernet deling for gruppen {group}",
    "{actor} shared with group {group}" : "{actor} delt med gruppen {group}",
    "{actor} removed share for group {group}" : "{actor} fjernet deling for gruppen {group}",
    "You shared {file} with group {group}" : "Du delte {file} med gruppen {group}",
    "You removed group {group} from {file}" : "Du fjernet gruppen {group} fra {file}",
    "{actor} shared {file} with group {group}" : "{actor} delte {file} med gruppen {group}",
    "{actor} removed group {group} from {file}" : "{actor} fjernet gruppen {group} fra {file}",
    "Shared as public link" : "Delt som offentlig lenke",
    "Removed public link" : "Fjernet offentlig lenke",
    "Public link expired" : "Offentlig lenke er utløpt",
    "{actor} shared as public link" : "{actor} delte som offentlig lenke",
    "{actor} removed public link" : "{actor} fjernet offentlig lenke",
    "You shared {file} as public link" : "Du delte {file} som offentlig lenke",
    "You removed public link for {file}" : "Du fjernet offentlig lenke for {file}",
    "{actor} shared {file} as public link" : "{actor} delte {file} som offentlig lenke",
    "{actor} removed public link for {file}" : "{actor} fjernet offentlig lenke for {file}",
    "{user} accepted the remote share" : "{user} godtok fjerndelingen",
    "{user} declined the remote share" : "{user} avslo fjerndelingen",
    "You received a new remote share {file} from {user}" : "Du har mottatt en ny fjerndeling {file} fra {user}",
    "{user} accepted the remote share of {file}" : "{user} godtok fjerndelingen av {file}",
    "{user} declined the remote share of {file}" : "{user} avslo fjerndelingen av {file}",
    "{user} unshared {file} from you" : "{user} fjernet deling av {file} med deg",
    "Shared with {user}" : "Delt med {user}",
    "Removed share for {user}" : "Fjernet deling med {user}",
    "{actor} shared with {user}" : "{actor} delte med {user}",
    "{actor} removed share for {user}" : "{actor} fjernet deling med {user}",
    "Shared by {actor}" : "Delt av {actor}",
    "{actor} removed share" : "{actor} fjernet deling",
    "You shared {file} with {user}" : "Du delte {file} med {user}",
    "You removed {user} from {file}" : "Du fjernet {user} fra {file}",
    "{actor} removed {user} from {file}" : "{actor} fjernet {user} fra {file}",
    "{actor} shared {file} with you" : "{actor} delte {file} med deg",
    "{actor} removed you from {file}" : "{actor} fjernet deg fra {file}",
    "A file or folder shared by mail or by public link was <strong>downloaded</strong>" : "En fil eller mappe delt via e-post eller offentlig lenke ble <strong>lastet ned</strong>",
    "A file or folder was shared from <strong>another server</strong>" : "En fil eller mappe ble delt fra <strong>en annen tjener</strong>",
    "A file or folder has been <strong>shared</strong>" : "En fil eller mappe ble <strong>delt</strong>",
    "Wrong share ID, share doesn't exist" : "Feil ressurs ID, ressursen finnes ikke",
    "could not delete share" : "kunne ikke slette ressursen",
    "Could not delete share" : "Kunne ikke slette ressursen",
    "Please specify a file or folder path" : "Vennligst oppgi en fil eller mappesti",
    "Wrong path, file/folder doesn't exist" : "Feil filbane, filen/mappen finnes ikke",
    "Could not create share" : "Kunne ikke opprette ressurs",
    "invalid permissions" : "Ugyldige rettigheter",
    "Please specify a valid user" : "Vennligst oppgi en gyldig bruker",
    "Group sharing is disabled by the administrator" : "Gruppedeling er deaktivert av administratoren",
    "Please specify a valid group" : "Vennligst oppgi en gyldig gruppe",
    "Public link sharing is disabled by the administrator" : "Offentlig deling er deaktivert av administratoren",
    "Public upload disabled by the administrator" : "Offentlig opplasting er deaktivert av administratoren",
    "Public upload is only possible for publicly shared folders" : "Offentlig opplasting er kun mulig i offentlig delte mapper",
    "Invalid date, date format must be YYYY-MM-DD" : "Feil dato, dato må være i formatet YYYY-MM-DD",
    "Sharing %s failed because the back end does not allow shares from type %s" : "Deling av %s feilet på grunn av at tjeneren ikke tillater deling av filtypen %s",
    "Unknown share type" : "Ukjent ressurstype",
    "Not a directory" : "Ikke en mappe",
    "Could not lock path" : "Kunne ikke låse sti",
    "Wrong or no update parameter given" : "Feil eller ingen parametre for oppdatering er angitt",
    "Can't change permissions for public share links" : "Kan ikke endre rettigheter for offentlige lenker",
    "Cannot increase permissions" : "Kan ikke øke tillatelser",
    "%s is publicly shared" : "%s er delt offentlig",
    "Share API is disabled" : "Deling API er deaktivert",
    "This share is password-protected" : "Denne delingen er passordbeskyttet",
    "The password is wrong. Try again." : "Passordet er feil. Prøv på nytt.",
    "Password" : "Passord",
    "No entries found in this folder" : "Ingen oppføringer funnet i denne mappen",
    "Name" : "Navn",
    "Share time" : "Delingstidspunkt",
    "Expiration date" : "Utløpsdato",
    "Sorry, this link doesn’t seem to work anymore." : "Beklager, denne lenken ser ikke ut til å virke lenger.",
    "Reasons might be:" : "Mulige årsaker:",
    "the item was removed" : "elementet er fjernet",
    "the link expired" : "lenken er utløpt",
    "sharing is disabled" : "deling er deaktivert",
    "For more info, please ask the person who sent this link." : "For mer informasjon, spør personen som sendte lenken.",
    "Add to your Nextcloud" : "Legg til i din Nextcloud",
    "Download" : "Last ned",
    "Download %s" : "Last ned %s",
    "Direct link" : "Direkte lenke",
    "Upload files to %s" : "Last opp filer til %s",
    "Select or drop files" : "Velg eller slipp filer",
    "Uploading files…" : "Laster opp filer...",
    "Uploaded files:" : "Opplastede filer:",
    "A public shared file or folder was <strong>downloaded</strong>" : "En offentlig delt fil eller mappe ble <strong>lastet ned</strong>",
    "You received a new remote share %2$s from %1$s" : "Du mottok en ny ekstern deling %2$s fra %1$s",
    "You received a new remote share from %s" : "Du mottok en ny ekstern deling fra %s",
    "%1$s accepted remote share %2$s" : "%1$s aksepterte ekstern deling %2$s",
    "%1$s declined remote share %2$s" : "%1$s avviste ekstern deling %2$s",
    "%1$s unshared %2$s from you" : "%1$s fjernet deling %2$s fra deg",
    "Public shared folder %1$s was downloaded" : "Offentlig delt mappe %1$s ble lastet ned",
    "Public shared file %1$s was downloaded" : "Offentlig delt fil %1$s ble lastet ned",
    "You shared %1$s with %2$s" : "Du delte %1$s med %2$s",
    "%2$s shared %1$s with %3$s" : "%2$s delte %1$s med %3$s",
    "You removed the share of %2$s for %1$s" : "Du fjernet deling av %2$s for %1$s",
    "%2$s removed the share of %3$s for %1$s" : "%2$s fjernet deling av %3$s for %1$s",
    "You shared %1$s with group %2$s" : "Du delte %1$s med gruppe %2$s",
    "%2$s shared %1$s with group %3$s" : "%2$s delte %1$s med gruppe %3$s",
    "You removed the share of group %2$s for %1$s" : "Du fjernet deling av gruppe %2$s for %1$s",
    "%2$s removed the share of group %3$s for %1$s" : "%2$s fjernet deling av gruppe %3$s for %1$s",
    "%2$s shared %1$s via link" : "%2$s delte %1$s via lenke",
    "You shared %1$s via link" : "Du delte %1$s via lenke",
    "You removed the public link for %1$s" : "Du fjernet den offentlige lenken for %1$s",
    "%2$s removed the public link for %1$s" : "%2$s fjernet den offentlige lenken for %1$s",
    "Your public link for %1$s expired" : "Din offentlige lenke for %1$s er utløpt",
    "The public link of %2$s for %1$s expired" : "Den offentlige lenken til %2$s for %1$s er utløpt",
    "%2$s shared %1$s with you" : "%2$s delte %1$s med deg",
    "%2$s removed the share for %1$s" : "%2$s fjernet delingen for %1$s",
    "Shared with %2$s" : "Delt med %2$s",
    "Shared with %3$s by %2$s" : "Delt med %3$s av %2$s",
    "Removed share for %2$s" : "Fjernet deling for %2$s",
    "%2$s removed share for %3$s" : "%2$s fjernet deling for %3$s",
    "Shared with group %2$s" : "Delt med gruppe %2$s",
    "Shared with group %3$s by %2$s" : "Delt med gruppe %3$s av %2$s",
    "Removed share of group %2$s" : "Fjernet deling av gruppe %2$s",
    "%2$s removed share of group %3$s" : "%2$s fjernet deling av gruppe %3$s",
    "Shared via link by %2$s" : "Delt via lenke av %2$s",
    "Shared via public link" : "Delt via offentlig lenke",
    "%2$s removed public link" : "%2$s fjernet offentlig lenke",
    "Public link of %2$s expired" : "Offentlig lenke til %2$s er utløpt",
    "Shared by %2$s" : "Delt av %2$s",
    "Shares" : "Delinger"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}