diff --git a/src/api/api_v1_types.ts b/src/api/api_v1_types.ts
index 2d707ce5050853cc36d9564d8e6a4a90b14421c6..384de8d6778b60f2a3ea73f81010c97cd53961e2 100644
--- a/src/api/api_v1_types.ts
+++ b/src/api/api_v1_types.ts
@@ -96,6 +96,7 @@ export interface lecture {
time: datetime;
title: string;
visible?: boolean;
+ is_authenticated?: boolean;
}
export interface chapter {
@@ -208,7 +209,7 @@ export interface changelog_entry {
parent_type?: string;
/// type: unknown
- data: string; // JSON
+ unknown_data: string; // JSON
}
export interface sorter_log_entry {
@@ -318,12 +319,10 @@ export interface AuthenticationPasswordRequest {
export interface AuthenticationFsmpiRequest {
username: string;
password: string;
- lecture_id?: int;
}
// Response Interface
export interface AuthenticationFsmpiResponse {
- is_lecture_authenticated?: boolean;
user?: user;
}
diff --git a/src/misc/Util.tsx b/src/misc/Util.tsx
index 28d9de4e01d58f9b37c6ed1bcc8935c1c4c961d4..70dddf7ccfb1993ebac28cb43adebbbd8d3854b3 100644
--- a/src/misc/Util.tsx
+++ b/src/misc/Util.tsx
@@ -139,6 +139,9 @@ export function urlForLecture(course_id: string, lecture_id: string | number) {
}
export function getLectureThumbnailUrl(lecture: lecture): string | undefined {
+ if (!lecture.is_authenticated)
+ return undefined;
+
for (let medium of lecture.publish_media ?? []) {
if (medium.medium_metadata.type === "thumbnail") {
return medium.url;
diff --git a/src/pages/internal/changelog.tsx b/src/pages/internal/changelog.tsx
index fdbf593561a5d9aa0d4a0f6430eaeda1c86cfbba..b25becd3e6db846b377c82ddfe90259e2cb22a2d 100644
--- a/src/pages/internal/changelog.tsx
+++ b/src/pages/internal/changelog.tsx
@@ -258,6 +258,54 @@ function Creation({
);
}
+function Unknown({
+ i,
+ filterLevel,
+ formattedDate,
+ resolveUser,
+}: {
+ i: changelog_entry;
+ filterLevel: (lvl: number) => () => void;
+ formattedDate: string;
+ resolveUser: (id: number) => string;
+}) {
+ return (
+ <tr key={i.id}>
+ <td>{formattedDate}</td>
+ <td>{resolveUser(i.modifying_user_id)}</td>
+ <td>{i.type}</td>
+ <td>
+ <button
+ type="button"
+ className="btn btn-link p-0 align-baseline"
+ onClick={filterLevel(1)}
+ >
+ {`${i.object_type}`}
+ </button>
+ .
+ <button
+ type="button"
+ className="btn btn-link p-0 align-baseline"
+ onClick={filterLevel(2)}
+ >
+ {`${i.object_id}`}
+ </button>
+ .
+ <button
+ type="button"
+ className="btn btn-link p-0 align-baseline"
+ onClick={filterLevel(3)}
+ >
+ {i.field_id}
+ </button>
+ </td>
+ <td>{JSON.stringify(i.unknown_data)}</td>
+ <td></td>
+ <td></td>
+ </tr>
+ );
+}
+
function ChangelogList({
changelog,
setFilter,
@@ -375,31 +423,17 @@ function ChangelogList({
/>
);
case "unknown":
- // TODO rework this. there should be no other type. And unknown has no old_value/new_value
- pfad = <>{`${i.object_type}, id=${i.object_id}`}</>;
- break;
+ return (
+ <Unknown
+ i={i}
+ filterLevel={filterLevel}
+ formattedDate={formattedDate}
+ resolveUser={resolveUser}
+ />
+ );
default:
- pfad = <>{i.type}</>;
+ throw new Error("Unknown entry type: " + i.type);
}
-
- return (
- <tr key={i.id}>
- <td>{formattedDate}</td>
- <td>{resolveUser(i.modifying_user_id)}</td>
- <td>{i.type}</td>
- <td>{pfad}</td>
- <td>
- <ValToStr val={i.old_value} />
- </td>
- <td>
- <ValToStr val={i.new_value} />
- </td>
- <td>
- <ValToStr val={i.data} />
- </td>
- <td></td>
- </tr>
- );
})}
</tbody>
</table>