mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
fix(notif): truncate media overviews (#1800)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { isEqual } from 'lodash';
|
import { isEqual, truncate } from 'lodash';
|
||||||
import {
|
import {
|
||||||
AfterInsert,
|
AfterInsert,
|
||||||
AfterRemove,
|
AfterRemove,
|
||||||
@@ -145,7 +145,11 @@ export class MediaRequest {
|
|||||||
subject: `${movie.title}${
|
subject: `${movie.title}${
|
||||||
movie.release_date ? ` (${movie.release_date.slice(0, 4)})` : ''
|
movie.release_date ? ` (${movie.release_date.slice(0, 4)})` : ''
|
||||||
}`,
|
}`,
|
||||||
message: movie.overview,
|
message: truncate(movie.overview, {
|
||||||
|
length: 500,
|
||||||
|
separator: /\s/,
|
||||||
|
omission: '…',
|
||||||
|
}),
|
||||||
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${movie.poster_path}`,
|
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${movie.poster_path}`,
|
||||||
media,
|
media,
|
||||||
request: this,
|
request: this,
|
||||||
@@ -158,7 +162,11 @@ export class MediaRequest {
|
|||||||
subject: `${tv.name}${
|
subject: `${tv.name}${
|
||||||
tv.first_air_date ? ` (${tv.first_air_date.slice(0, 4)})` : ''
|
tv.first_air_date ? ` (${tv.first_air_date.slice(0, 4)})` : ''
|
||||||
}`,
|
}`,
|
||||||
message: tv.overview,
|
message: truncate(tv.overview, {
|
||||||
|
length: 500,
|
||||||
|
separator: /\s/,
|
||||||
|
omission: '…',
|
||||||
|
}),
|
||||||
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${tv.poster_path}`,
|
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${tv.poster_path}`,
|
||||||
media,
|
media,
|
||||||
extra: [
|
extra: [
|
||||||
@@ -217,7 +225,11 @@ export class MediaRequest {
|
|||||||
subject: `${movie.title}${
|
subject: `${movie.title}${
|
||||||
movie.release_date ? ` (${movie.release_date.slice(0, 4)})` : ''
|
movie.release_date ? ` (${movie.release_date.slice(0, 4)})` : ''
|
||||||
}`,
|
}`,
|
||||||
message: movie.overview,
|
message: truncate(movie.overview, {
|
||||||
|
length: 500,
|
||||||
|
separator: /\s/,
|
||||||
|
omission: '…',
|
||||||
|
}),
|
||||||
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${movie.poster_path}`,
|
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${movie.poster_path}`,
|
||||||
notifyUser: autoApproved ? undefined : this.requestedBy,
|
notifyUser: autoApproved ? undefined : this.requestedBy,
|
||||||
media,
|
media,
|
||||||
@@ -236,7 +248,11 @@ export class MediaRequest {
|
|||||||
subject: `${tv.name}${
|
subject: `${tv.name}${
|
||||||
tv.first_air_date ? ` (${tv.first_air_date.slice(0, 4)})` : ''
|
tv.first_air_date ? ` (${tv.first_air_date.slice(0, 4)})` : ''
|
||||||
}`,
|
}`,
|
||||||
message: tv.overview,
|
message: truncate(tv.overview, {
|
||||||
|
length: 500,
|
||||||
|
separator: /\s/,
|
||||||
|
omission: '…',
|
||||||
|
}),
|
||||||
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${tv.poster_path}`,
|
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${tv.poster_path}`,
|
||||||
notifyUser: autoApproved ? undefined : this.requestedBy,
|
notifyUser: autoApproved ? undefined : this.requestedBy,
|
||||||
media,
|
media,
|
||||||
@@ -495,7 +511,11 @@ export class MediaRequest {
|
|||||||
subject: `${movie.title}${
|
subject: `${movie.title}${
|
||||||
movie.release_date ? ` (${movie.release_date.slice(0, 4)})` : ''
|
movie.release_date ? ` (${movie.release_date.slice(0, 4)})` : ''
|
||||||
}`,
|
}`,
|
||||||
message: movie.overview,
|
message: truncate(movie.overview, {
|
||||||
|
length: 500,
|
||||||
|
separator: /\s/,
|
||||||
|
omission: '…',
|
||||||
|
}),
|
||||||
media,
|
media,
|
||||||
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${movie.poster_path}`,
|
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${movie.poster_path}`,
|
||||||
request: this,
|
request: this,
|
||||||
@@ -707,7 +727,11 @@ export class MediaRequest {
|
|||||||
? ` (${series.first_air_date.slice(0, 4)})`
|
? ` (${series.first_air_date.slice(0, 4)})`
|
||||||
: ''
|
: ''
|
||||||
}`,
|
}`,
|
||||||
message: series.overview,
|
message: truncate(series.overview, {
|
||||||
|
length: 500,
|
||||||
|
separator: /\s/,
|
||||||
|
omission: '…',
|
||||||
|
}),
|
||||||
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${series.poster_path}`,
|
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${series.poster_path}`,
|
||||||
media,
|
media,
|
||||||
extra: [
|
extra: [
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import { truncate } from 'lodash';
|
||||||
import {
|
import {
|
||||||
EntitySubscriberInterface,
|
EntitySubscriberInterface,
|
||||||
EventSubscriber,
|
EventSubscriber,
|
||||||
@@ -34,7 +35,11 @@ export class MediaSubscriber implements EntitySubscriberInterface {
|
|||||||
subject: `${movie.title}${
|
subject: `${movie.title}${
|
||||||
movie.release_date ? ` (${movie.release_date.slice(0, 4)})` : ''
|
movie.release_date ? ` (${movie.release_date.slice(0, 4)})` : ''
|
||||||
}`,
|
}`,
|
||||||
message: movie.overview,
|
message: truncate(movie.overview, {
|
||||||
|
length: 500,
|
||||||
|
separator: /\s/,
|
||||||
|
omission: '…',
|
||||||
|
}),
|
||||||
media: entity,
|
media: entity,
|
||||||
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${movie.poster_path}`,
|
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${movie.poster_path}`,
|
||||||
request: request,
|
request: request,
|
||||||
@@ -89,7 +94,11 @@ export class MediaSubscriber implements EntitySubscriberInterface {
|
|||||||
subject: `${tv.name}${
|
subject: `${tv.name}${
|
||||||
tv.first_air_date ? ` (${tv.first_air_date.slice(0, 4)})` : ''
|
tv.first_air_date ? ` (${tv.first_air_date.slice(0, 4)})` : ''
|
||||||
}`,
|
}`,
|
||||||
message: tv.overview,
|
message: truncate(tv.overview, {
|
||||||
|
length: 500,
|
||||||
|
separator: /\s/,
|
||||||
|
omission: '…',
|
||||||
|
}),
|
||||||
notifyUser: request.requestedBy,
|
notifyUser: request.requestedBy,
|
||||||
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${tv.poster_path}`,
|
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${tv.poster_path}`,
|
||||||
media: entity,
|
media: entity,
|
||||||
|
Reference in New Issue
Block a user