From a285e96aad715a8a1bd81fb0eda7fa3f94ac8156 Mon Sep 17 00:00:00 2001
From: Michael Foiani <sotech117@michaels-mbp-5.devices.brown.edu>
Date: Wed, 24 Aug 2022 23:47:17 -0400
Subject: fix upload bug with not upading fields

---
 src/client/util/ReportManager.tsx | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'src/client/util/ReportManager.tsx')

diff --git a/src/client/util/ReportManager.tsx b/src/client/util/ReportManager.tsx
index 55c5ca87f..b36e7e063 100644
--- a/src/client/util/ReportManager.tsx
+++ b/src/client/util/ReportManager.tsx
@@ -140,7 +140,7 @@ export class ReportManager extends React.Component<{}> {
         // if we're down here, then we're good to go. reset the fields.
         this.setBugTitle('');
         this.setBugDescription('');
-        this.toGithub = false;
+        // this.toGithub = false;
         this.setFileLinks([]);
         this.setBugType('');
         this.setBugPriority('');
@@ -176,10 +176,10 @@ export class ReportManager extends React.Component<{}> {
             (<div className="settings-content">
                 <h3 style={{ 'textDecoration': 'underline'}}>Report an Issue</h3>
                 <label>Please leave a title for the bug.</label><br />
-                <input type="text" placeholder='title' onChange={(e) => this.bugTitle = e.target.value} required/>
+                <input type="text" placeholder='title' onChange={(e) => this.setBugTitle(e.target.value)} required/>
                 <br />
                 <label>Please leave a description for the bug and how it can be recreated.</label>
-                <textarea placeholder='description' onChange={(e) => this.bugDescription = e.target.value} required/>
+                <textarea placeholder='description' onChange={(e) => this.setBugDescription(e.target.value)} required/>
                 <br />
                 {/* {<label>Send to github issues? </label>
                 <input type="checkbox" onChange={(e) => this.toGithub = e.target.checked} />
@@ -187,14 +187,14 @@ export class ReportManager extends React.Component<{}> {
 
                 <label>Please label the issue</label>
                 <div className='flex-select'>
-                    <select name="bugType">
+                    <select name="bugType" onChange={e => this.bugType = e.target.value}>
                     <option value="" disabled selected>Type</option>
                     <option value="bug">Bug</option>
                     <option value="cosmetic">Poor Design or Cosmetic</option>
                     <option value="documentation">Poor Documentation</option>
                     </select>
 
-                    <select name="bigPriority">
+                    <select name="bigPriority" onChange={e => this.bugPriority = e.target.value}>
                         <option value="" disabled selected>Priority</option>
                         <option value="priority-low">Low</option>
                         <option value="priority-medium">Medium</option>
@@ -205,7 +205,7 @@ export class ReportManager extends React.Component<{}> {
 
                 <div>
                     <label>Upload media that shows the bug (optional)</label>
-                    <input type="file" name="file" multiple accept='audio/*, video/*' onChange={e => this.uploadFiles(e.target)}/>
+                    <input type="file" name="file" multiple accept='audio/*, video/*, image/*' onChange={e => this.uploadFiles(e.target)}/>
                 </div>
                 <br />
 
-- 
cgit v1.2.3-70-g09d2


From e1efc192ec6105c97c59f313e6efcbc617ff65d5 Mon Sep 17 00:00:00 2001
From: Michael Foiani <sotech117@michaels-mbp-5.devices.brown.edu>
Date: Thu, 25 Aug 2022 00:14:32 -0400
Subject: update the way to show the links

---
 src/client/util/ReportManager.tsx | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

(limited to 'src/client/util/ReportManager.tsx')

diff --git a/src/client/util/ReportManager.tsx b/src/client/util/ReportManager.tsx
index b36e7e063..d680b47ac 100644
--- a/src/client/util/ReportManager.tsx
+++ b/src/client/util/ReportManager.tsx
@@ -104,6 +104,20 @@ export class ReportManager extends React.Component<{}> {
         }
     }
 
+    // turns an upload link into a servable link
+    // ex: 
+    // C: /Users/dash/Documents/GitHub/Dash-Web/src/server/public/files/images/upload_8008dbc4b6424fbff14da7345bb32eb2_l.png
+    // -> http://localhost:1050/files/images/upload_8008dbc4b6424fbff14da7345bb32eb2_l.png
+    private fileLinktoServerLink = (fileLink: string) => {
+        const serverUrl = 'https://browndash.com/';
+
+        const regex = 'public'
+        const publicIndex = fileLink.indexOf(regex) + regex.length;
+
+        const finalUrl = `${serverUrl}${fileLink.substring(publicIndex + 1)}`;
+        return finalUrl;
+    }
+
     public async reportIssue() {
         if (this.bugTitle === '' || this.bugDescription === ''
             || this.bugType === '' || this.bugPriority === '') {
@@ -111,14 +125,15 @@ export class ReportManager extends React.Component<{}> {
             return;
         }
 
-
         if (this.toGithub) {
 
+            const formattedLinks = (this.fileLinks ?? []).map(this.fileLinktoServerLink)
+            
             const req = await this.octokit.request('POST /repos/{owner}/{repo}/issues', {
                 owner: 'brown-dash',
                 repo: 'Dash-Web',
                 title: this.formatTitle(this.bugTitle, Doc.CurrentUserEmail),
-                body: `${this.bugDescription} \n\nfiles:\n${(this.fileLinks ?? []).join('\n')}`,
+                body: `${this.bugDescription} \n\nfiles:\n${formattedLinks.join('\n')}`,
                 labels: [
                     'from-dash-app',
                     this.bugType,
-- 
cgit v1.2.3-70-g09d2


From 9c32686d81ab993c71676a55c1c34df5cf9ec00d Mon Sep 17 00:00:00 2001
From: Michael Foiani <sotech117@michaels-mbp-5.devices.brown.edu>
Date: Thu, 25 Aug 2022 00:18:45 -0400
Subject: fix showing image bug

---
 src/client/util/ReportManager.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/client/util/ReportManager.tsx')

diff --git a/src/client/util/ReportManager.tsx b/src/client/util/ReportManager.tsx
index d680b47ac..180d8294f 100644
--- a/src/client/util/ReportManager.tsx
+++ b/src/client/util/ReportManager.tsx
@@ -106,7 +106,7 @@ export class ReportManager extends React.Component<{}> {
 
     // turns an upload link into a servable link
     // ex: 
-    // C: /Users/dash/Documents/GitHub/Dash-Web/src/server/public/files/images/upload_8008dbc4b6424fbff14da7345bb32eb2_l.png
+    // C: /Users/dash/Documents/GitHub/Dash-Web/src/server/public/files/images/upload_8008dbc4b6424fbff14da7345bb32eb2.png
     // -> http://localhost:1050/files/images/upload_8008dbc4b6424fbff14da7345bb32eb2_l.png
     private fileLinktoServerLink = (fileLink: string) => {
         const serverUrl = 'https://browndash.com/';
@@ -114,7 +114,7 @@ export class ReportManager extends React.Component<{}> {
         const regex = 'public'
         const publicIndex = fileLink.indexOf(regex) + regex.length;
 
-        const finalUrl = `${serverUrl}${fileLink.substring(publicIndex + 1)}`;
+        const finalUrl = `${serverUrl}${fileLink.substring(publicIndex + 1).replace('.', '_l.')}`;
         return finalUrl;
     }
 
-- 
cgit v1.2.3-70-g09d2


From 08defc6e0c9a0517125ca72c8caf285c3414ef48 Mon Sep 17 00:00:00 2001
From: geireann <geireann.lindfield@gmail.com>
Date: Thu, 15 Sep 2022 14:57:04 -0400
Subject: Update ReportManager.tsx

---
 src/client/util/ReportManager.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/client/util/ReportManager.tsx')

diff --git a/src/client/util/ReportManager.tsx b/src/client/util/ReportManager.tsx
index 180d8294f..c00fe6bfe 100644
--- a/src/client/util/ReportManager.tsx
+++ b/src/client/util/ReportManager.tsx
@@ -57,7 +57,7 @@ export class ReportManager extends React.Component<{}> {
         ReportManager.Instance = this;
 
         this.octokit = new Octokit({
-            auth: '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'
+            auth: process.env.GH_TOKEN
         });
     }
 
-- 
cgit v1.2.3-70-g09d2


From 6b37d4e5d7595062fa8979d3940b0c640459b1ee Mon Sep 17 00:00:00 2001
From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com>
Date: Wed, 21 Sep 2022 01:47:31 -0400
Subject: added git reporting

---
 src/client/util/ReportManager.tsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/client/util/ReportManager.tsx')

diff --git a/src/client/util/ReportManager.tsx b/src/client/util/ReportManager.tsx
index c00fe6bfe..51742d455 100644
--- a/src/client/util/ReportManager.tsx
+++ b/src/client/util/ReportManager.tsx
@@ -57,7 +57,7 @@ export class ReportManager extends React.Component<{}> {
         ReportManager.Instance = this;
 
         this.octokit = new Octokit({
-            auth: process.env.GH_TOKEN
+            auth: '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'
         });
     }
 
-- 
cgit v1.2.3-70-g09d2

