From 7cefd772a7e60f436737d63a95eca43d7cb6dd23 Mon Sep 17 00:00:00 2001
From: Jarrod Servilla <45128231+jcserv@users.noreply.github.com>
Date: Wed, 1 Sep 2021 17:26:23 -0400
Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Refactor:=20Add=20creat?=
=?UTF-8?q?ed=5Fby=20to=20pending=20requests=20(#102)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* implement yousef's feedback
* add created by
* fix bug where createdBy not displaying after rejecting
---
client/components/Card.jsx | 5 ++++-
client/components/RequestsList.jsx | 10 +++++++++-
client/gql/Admin.js | 2 ++
client/gql/GroupChat.js | 1 +
client/pages/admin/index.jsx | 7 +++++--
client/requests/groupChats.js | 4 ++--
server/dist/models/Groupchat.d.ts | 1 +
server/dist/models/Groupchat.js | 4 ++++
server/dist/models/Groupchat.js.map | 2 +-
server/models/Groupchat.ts | 2 ++
10 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/client/components/Card.jsx b/client/components/Card.jsx
index aec1200..d82e36f 100644
--- a/client/components/Card.jsx
+++ b/client/components/Card.jsx
@@ -3,6 +3,7 @@ import Image from "next/image";
import { useRouter } from "next/router";
import React from "react";
import {
+ FaCalendar,
FaDiscord,
FaRegSnowflake,
FaSun,
@@ -16,6 +17,7 @@ const termToIcon = {
Fall: GiChestnutLeaf,
Winter: FaRegSnowflake,
Summer: FaSun,
+ Year: FaCalendar,
};
const LinkIcon = ({ link, titleColor }) => (
@@ -41,7 +43,8 @@ const CourseInfo = ({ descriptionColor, campus, term, year }) => (
as="h2"
isTruncated
>
- {campus} {year}
+ {campus} {year !== "N/A" ? year : ""}{" "}
+ {term !== "N/A" && }
>
);
diff --git a/client/components/RequestsList.jsx b/client/components/RequestsList.jsx
index 579c85a..b4a6504 100644
--- a/client/components/RequestsList.jsx
+++ b/client/components/RequestsList.jsx
@@ -14,7 +14,13 @@ import React from "react";
import { statuses } from "../constants";
-const ChatRequestCard = ({ showRequestBtns, modifyRequest, name, id }) => {
+const ChatRequestCard = ({
+ showRequestBtns,
+ modifyRequest,
+ name,
+ id,
+ createdBy,
+}) => {
const { locale, defaultLocale, push } = useRouter();
return (
{
+ {createdBy}
+
{showRequestBtns ? (
<>
{
- const { name, groupChatId } = await modifyGroupchatStatus(id, status);
+ const { name, groupChatId, createdBy } = await modifyGroupchatStatus(
+ id,
+ status
+ );
if (status === "rejected") {
setRejected((rejectedGroups) => [
...rejectedGroups,
- { id: groupChatId, name },
+ { id: groupChatId, name, createdBy },
]);
}
setPending((pendingGroups) =>
diff --git a/client/requests/groupChats.js b/client/requests/groupChats.js
index 6ada2e2..b85786d 100644
--- a/client/requests/groupChats.js
+++ b/client/requests/groupChats.js
@@ -74,7 +74,7 @@ export async function getGroupchatReq(id) {
export async function modifyGroupchatStatus(id, status) {
const {
data: {
- updateStatus: { name, id: groupChatId },
+ updateStatus: { name, id: groupChatId, createdBy },
},
} = await client.mutate({
mutation: UPDATE_GROUPCHAT_STATUS,
@@ -83,7 +83,7 @@ export async function modifyGroupchatStatus(id, status) {
status,
},
});
- return { name, groupChatId };
+ return { name, groupChatId, createdBy };
}
export async function searchChats(
diff --git a/server/dist/models/Groupchat.d.ts b/server/dist/models/Groupchat.d.ts
index 7232f3e..a8a6efe 100644
--- a/server/dist/models/Groupchat.d.ts
+++ b/server/dist/models/Groupchat.d.ts
@@ -9,6 +9,7 @@ export declare class GroupChat {
id: string;
name: string;
description: string;
+ createdBy: string;
links: string[];
isCommunity: boolean;
courseInformation?: CourseInformation;
diff --git a/server/dist/models/Groupchat.js b/server/dist/models/Groupchat.js
index f2a3588..49b7ccd 100644
--- a/server/dist/models/Groupchat.js
+++ b/server/dist/models/Groupchat.js
@@ -51,6 +51,10 @@ __decorate([
type_graphql_1.Field(),
__metadata("design:type", String)
], GroupChat.prototype, "description", void 0);
+__decorate([
+ type_graphql_1.Field(),
+ __metadata("design:type", String)
+], GroupChat.prototype, "createdBy", void 0);
__decorate([
type_graphql_1.Field(() => [String]),
__metadata("design:type", Array)
diff --git a/server/dist/models/Groupchat.js.map b/server/dist/models/Groupchat.js.map
index 4a4cbc4..dc9a70b 100644
--- a/server/dist/models/Groupchat.js.map
+++ b/server/dist/models/Groupchat.js.map
@@ -1 +1 @@
-{"version":3,"file":"Groupchat.js","sourceRoot":"","sources":["../../models/Groupchat.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAiD;AAGjD,IAAa,iBAAiB,GAA9B,MAAa,iBAAiB;CAU7B,CAAA;AATU;IAAR,oBAAK,EAAE;;iDAAiB;AAEhB;IAAR,oBAAK,EAAE;;qDAAqB;AAEpB;IAAR,oBAAK,EAAE;;+CAAe;AAEd;IAAR,oBAAK,EAAE;;+CAAe;AAEd;IAAR,oBAAK,EAAE;;+CAAc;AATX,iBAAiB;IAD7B,yBAAU,EAAE;GACA,iBAAiB,CAU7B;AAVY,8CAAiB;AAa9B,IAAa,SAAS,GAAtB,MAAa,SAAS;CA0BrB,CAAA;AAzBU;IAAR,oBAAK,EAAE;;qCAAY;AAEX;IAAR,oBAAK,EAAE;;uCAAc;AAEb;IAAR,oBAAK,EAAE;;8CAAqB;AAG7B;IADC,oBAAK,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;;wCACN;AAEP;IAAR,oBAAK,EAAE;;8CAAsB;AAG9B;IADC,oBAAK,CAAC,GAAG,EAAE,CAAC,iBAAiB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BAC/B,iBAAiB;oDAAC;AAE7B;IAAR,oBAAK,EAAE;;yCAAgB;AAEG;IAA1B,oBAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCAAe;AAEd;IAA1B,oBAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BAAU,IAAI;0CAAC;AAEd;IAA1B,oBAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;8BAAU,IAA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ANjB,mBAAmB;IAD/B,yBAAU,EAAE;GACA,mBAAmB,CAO/B;AAPY,kDAAmB"}
\ No newline at end of file
diff --git a/server/models/Groupchat.ts b/server/models/Groupchat.ts
index 3395499..5c31fe4 100644
--- a/server/models/Groupchat.ts
+++ b/server/models/Groupchat.ts
@@ -21,6 +21,8 @@ export class GroupChat {
@Field() description: string;
+ @Field() createdBy: string;
+
@Field(() => [String])
links: string[];