From 64783793ee308e4f87fd982005ede853026056f5 Mon Sep 17 00:00:00 2001
From: emil farisan <emil.farisan@gmail.com>
Date: Sun, 17 Nov 2019 19:12:56 +0700
Subject: [PATCH 1/3] remove 5 out of 6 of the code smells currently present

---
 assets/js/EditProfile.jsx                  | 2 +-
 assets/js/VacancyPage.jsx                  | 1 -
 assets/js/components/InfoLowonganModal.jsx | 2 +-
 core/models/__init__.py                    | 9 ---------
 core/models/vacancies.py                   | 1 -
 core/views/vacancies.py                    | 6 +++---
 6 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/assets/js/EditProfile.jsx b/assets/js/EditProfile.jsx
index 198955f5..795b7837 100644
--- a/assets/js/EditProfile.jsx
+++ b/assets/js/EditProfile.jsx
@@ -14,7 +14,7 @@ import Storage from './lib/Storage';
 import ModalAlert from './components/ModalAlert';
 import Dumper from './lib/Dumper';
 
-export default class ProfilePage extends React.Component {
+export default class EditProfile extends React.Component {
   static propTypes = {
     route: PropTypes.object.isRequired,
     params: PropTypes.object.isRequired,
diff --git a/assets/js/VacancyPage.jsx b/assets/js/VacancyPage.jsx
index 9a412a55..96fee2dc 100755
--- a/assets/js/VacancyPage.jsx
+++ b/assets/js/VacancyPage.jsx
@@ -7,7 +7,6 @@ import Pane from './components/Pane';
 import VacancyList from './components/VacancyList';
 import Pagination from './components/Pagination';
 import Storage from './lib/Storage';
-import InfoLowonganModal from './components/InfoLowonganModal';
 
 export default class VacancyPage extends React.Component {
   static propTypes = {
diff --git a/assets/js/components/InfoLowonganModal.jsx b/assets/js/components/InfoLowonganModal.jsx
index 97d92105..cd568a1d 100644
--- a/assets/js/components/InfoLowonganModal.jsx
+++ b/assets/js/components/InfoLowonganModal.jsx
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
 import { Modal, Button } from 'semantic-ui-react';
 import ModalAlert from './../components/ModalAlert';
 
-export default class InfoModal extends React.Component {
+export default class InfoLowonganModal extends React.Component {
   static propTypes = {
     data: PropTypes.object.isRequired,
     active: PropTypes.bool.isRequired,
diff --git a/core/models/__init__.py b/core/models/__init__.py
index 66259a6b..e69de29b 100755
--- a/core/models/__init__.py
+++ b/core/models/__init__.py
@@ -1,9 +0,0 @@
-# __init__.py
-from core.models.accounts import Company
-from core.models.accounts import Student
-from core.models.accounts import Supervisor
-from core.models.vacancies import Vacancy
-from core.models.vacancies import Application
-from core.models.vacancies import VacancyMilestone
-from core.models.recommendations import Recommendation
-# from core.models.feedbacks import Feedback
diff --git a/core/models/vacancies.py b/core/models/vacancies.py
index 6a9ce692..6c28602f 100755
--- a/core/models/vacancies.py
+++ b/core/models/vacancies.py
@@ -1,7 +1,6 @@
 from django.db import models
 from django.core.exceptions import ValidationError
 from core.models.accounts import Company, Student
-import datetime
 from django.utils import timezone
 
 
diff --git a/core/views/vacancies.py b/core/views/vacancies.py
index 511352d5..6c967d6e 100755
--- a/core/views/vacancies.py
+++ b/core/views/vacancies.py
@@ -338,9 +338,9 @@ class StudentApplicationViewSet(viewsets.GenericViewSet):
         vacancy = get_object_or_404(Vacancy.objects.all(), pk=pk)
         student = get_object_or_404(Student.objects.all(), pk=student_id)
         application = get_object_or_404(Application.objects.all(), student=student, vacancy=vacancy)
-        reasonRejected = get_object_or_404(ReasonRejected.objects.all(), application=application)
-        print(reasonRejected.reason)
-        return Response({"reason": reasonRejected.reason}, status=status.HTTP_200_OK)
+        reason_rejected = get_object_or_404(ReasonRejected.objects.all(), application=application)
+        print(reason_rejected.reason)
+        return Response({"reason": reason_rejected.reason}, status=status.HTTP_200_OK)
 
 
 class StatusError(Exception):
-- 
GitLab


From cb7f3a5b191ca89786ff72f907cc0ad782e184c5 Mon Sep 17 00:00:00 2001
From: emil farisan <emil.farisan@gmail.com>
Date: Sun, 17 Nov 2019 19:23:38 +0700
Subject: [PATCH 2/3] re-added import lines at __init__.py

---
 core/models/__init__.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/core/models/__init__.py b/core/models/__init__.py
index e69de29b..971218a9 100755
--- a/core/models/__init__.py
+++ b/core/models/__init__.py
@@ -0,0 +1,8 @@
+# __init__.py
+from core.models.accounts import Company
+from core.models.accounts import Student
+from core.models.accounts import Supervisor
+from core.models.vacancies import Vacancy
+from core.models.vacancies import Application
+from core.models.vacancies import VacancyMilestone
+from core.models.recommendations import Recommendation
-- 
GitLab


From dbff464172ffb52b3eed7829c200ccf519478f4e Mon Sep 17 00:00:00 2001
From: emil farisan <emil.farisan@gmail.com>
Date: Sun, 17 Nov 2019 21:06:04 +0700
Subject: [PATCH 3/3] solving security issue

---
 assets/js/ProfilePage.jsx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/assets/js/ProfilePage.jsx b/assets/js/ProfilePage.jsx
index 20eb9d5e..c976e353 100755
--- a/assets/js/ProfilePage.jsx
+++ b/assets/js/ProfilePage.jsx
@@ -245,7 +245,9 @@ export default class ProfilePage extends React.Component {
         'Pastikan link github yang anda tulis benar.(Berpola : https://github.com/<username>',
       );
     } else if (!this.gitlabURL_is_valid()) {
-      alert("Link gitlab tidak sesuai. Contoh : https://gitlab.com/<your-username>");
+      this.modalAlert.open(
+        "Link gitlab tidak sesuai. Contoh : https://gitlab.com/<your-username>",
+      );
       return;
     }
     {
-- 
GitLab