mirror of
https://github.com/sbondCo/Watcharr.git
synced 2026-08-07 07:14:44 +00:00
Clean up errors, CSS, fix tv/games activity
This commit is contained in:
@@ -93,6 +93,10 @@ func updateActivity(db *gorm.DB, userId uint, id uint, activityUpdateRequest Act
|
||||
slog.Error("Error updating activity in database", "error", res.Error.Error())
|
||||
return errors.New("failed updating activity in database")
|
||||
}
|
||||
if res.RowsAffected < 1 {
|
||||
slog.Error("No activities were updated. This may be because the activity doesn't exist or is not owned by the calling user.")
|
||||
return errors.New("failed updating activity in database")
|
||||
}
|
||||
slog.Debug("Updating activity", "updated_activity", id)
|
||||
return nil
|
||||
}
|
||||
@@ -106,5 +110,9 @@ func deleteActivity(db *gorm.DB, userId uint, id uint) error {
|
||||
slog.Error("Error deleting activity in database", "error", res.Error.Error())
|
||||
return errors.New("failed deleting activity in database")
|
||||
}
|
||||
if res.RowsAffected < 1 {
|
||||
slog.Error("No activities were deleted. This may be because the activity doesn't exist or is not owned by the calling user.")
|
||||
return errors.New("failed deleting activity from database")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -516,6 +516,7 @@ func (b *BaseRouter) addActivityRoutes() {
|
||||
context.Status(http.StatusOK)
|
||||
return
|
||||
}
|
||||
context.AbortWithStatusJSON(http.StatusBadRequest, ErrorResponse{Error: err.Error()})
|
||||
})
|
||||
|
||||
activity.DELETE(":id", func(context *gin.Context) {
|
||||
@@ -523,6 +524,7 @@ func (b *BaseRouter) addActivityRoutes() {
|
||||
id, err := strconv.ParseUint(context.Param("id"), 10, 32)
|
||||
if err != nil {
|
||||
context.Status(400)
|
||||
slog.Error("Could not process activity id when attempting a deletion", "error", err.Error(), "id", context.Param("id"))
|
||||
return
|
||||
}
|
||||
err = deleteActivity(b.db, userId, uint(id))
|
||||
|
||||
@@ -107,11 +107,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
function toFullTitleCase(text: string) {
|
||||
return text
|
||||
.split(" ")
|
||||
.map((l) => l[0].toUpperCase() + l.substring(1).toLowerCase())
|
||||
.join(" ");
|
||||
function toFullTitleCase(text: string | undefined) {
|
||||
if (text) {
|
||||
return text
|
||||
.split(" ")
|
||||
.map((l) => l[0].toUpperCase() + l.substring(1).toLowerCase())
|
||||
.join(" ");
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
function toDayTime(d: Date) {
|
||||
@@ -221,6 +224,7 @@
|
||||
gap: 8px;
|
||||
width: max-content;
|
||||
max-width: 100%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
span {
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<input id="activity-time" type="time" bind:value={selectedTimeString} />
|
||||
|
||||
<div class="button-row">
|
||||
<button class="delete" on:click={remove}>Delete</button>
|
||||
<button class="danger" on:click={remove}>Delete</button>
|
||||
<button
|
||||
on:click={() => update(selectedDateString, selectedTimeString)}
|
||||
disabled={!isDateTimeChanged}>Update</button
|
||||
@@ -89,10 +89,6 @@
|
||||
margin-top: auto;
|
||||
width: max-content;
|
||||
}
|
||||
|
||||
.delete {
|
||||
background-color: $delete-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
export let data;
|
||||
|
||||
let trailer: string | undefined;
|
||||
let requestModalShown = false;
|
||||
let trailerShown = false;
|
||||
|
||||
$: wList = $watchedList;
|
||||
@@ -203,7 +202,7 @@
|
||||
{/if}
|
||||
|
||||
{#if wListItem}
|
||||
<Activity activity={wListItem?.activity} />
|
||||
<Activity wListId={wListItem.id} activity={wListItem.activity} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -227,7 +227,7 @@
|
||||
<SimilarContent type="tv" similar={show.similar} />
|
||||
|
||||
{#if wListItem}
|
||||
<Activity activity={wListItem?.activity} />
|
||||
<Activity wListId={wListItem.id} activity={wListItem.activity} />
|
||||
{/if}
|
||||
<SeasonsList tvId={data.tvId} seasons={show.seasons} watchedItem={wListItem} />
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
--rating-color: black;
|
||||
--placeholder-color: #8e8e8e;
|
||||
--poster-rating-color: gold;
|
||||
--delete-color: red;
|
||||
}
|
||||
|
||||
:root.theme-dark {
|
||||
@@ -37,7 +36,6 @@ $nav-color: var(--nav-color);
|
||||
$nav-height: 71px; // How tall the nav is naturally, usefull in some places.
|
||||
$poster-rating-color: var(--poster-rating-color);
|
||||
$poster-extra-detail-bg-color: rgba(46, 46, 46, 0.5);
|
||||
$delete-color: var(--delete-color);
|
||||
$error: #f3555a;
|
||||
$success: #28a745;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user