From 48d00f28298e72994d3f0c89c37b658a43a708a4 Mon Sep 17 00:00:00 2001 From: Alexander Davis Date: Tue, 4 Aug 2020 14:55:10 +0100 Subject: [PATCH 01/14] Creation of pull and issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 38 +++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++ .../pull_request_template.md | 18 +++++++++ 3 files changed, 76 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..87f84b7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: AlexanderEDavis + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..a05ccfd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement, question +assignees: AlexanderEDavis + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 0000000..1617cfc --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,18 @@ +## Description + +Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. + +Fixes # (issue) + +## Type of change + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) + +## Checklist: + +- [ ] I read & comply with the [contributing guidelines](https://github.com/bastienwirtz/homer/blob/master/CONTRIBUTING.md) +- [ ] I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers. +- [ ] I have made corresponding changes the documentation (README.md). +- [ ] I've check my modifications for any breaking change, especially in the `config.yml` file -- 2.49.1 From 38497a7f3681c117b9d523b397391cc7f46cf3c5 Mon Sep 17 00:00:00 2001 From: Alexander Davis Date: Tue, 4 Aug 2020 14:58:14 +0100 Subject: [PATCH 02/14] Quick update to assignees --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 87f84b7..c1e60d4 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -3,7 +3,7 @@ name: Bug report about: Create a report to help us improve title: '' labels: bug -assignees: AlexanderEDavis +assignees: --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index a05ccfd..5377b11 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -3,7 +3,7 @@ name: Feature request about: Suggest an idea for this project title: '' labels: enhancement, question -assignees: AlexanderEDavis +assignees: --- -- 2.49.1 From 691b119d1dfe105bcf130947bc35aa56474eb859 Mon Sep 17 00:00:00 2001 From: Alexander Davis Date: Tue, 4 Aug 2020 15:03:19 +0100 Subject: [PATCH 03/14] docs and links --- .github/CONTRIBUTING.md | 43 +++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .../pull_request_template.md | 2 +- 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 .github/CONTRIBUTING.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..c0677df --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,43 @@ +# Introduction + +### Welcome! + +First off, thank you for considering contributing to FHeD! + +### Project philosophy + +Project philosophy goes here + +### Roadmap + +If you want to know more about the project direction or looking for something to work on, checkout the [roadmap](https://github.com/luketainton/FHeD#Roadmap)! +Feel free to open an issue if you have any questions. + +# Ground Rules + +### Code of conduct and guidelines + +First of all, we expect everyone (contributors and maintainers alike) to respect the [Code of conduct](https://github.com/luketainton/FHeD/blob/master/.github/CODE_OF_CONDUCT.md). It is not a recommendation, it is mandatory. + +For all contributions, please respect the following guidelines: + +* Each pull request should implement ONE feature or bugfix. If you want to add or fix more than one thing, submit more than one pull request. +* Do not commit changes to files that are irrelevant to your feature or bugfix (eg: `.gitignore`). +* Do not add unnecessary dependencies. +* Be aware that the pull request review process is not immediate, and is generally proportional to the size of the pull request. + +# Getting started + +### Discuss about ideas + +If you want to add a feature, it's often best to talk about it before starting working on it and submitting a pull request. It's not mandatory at all, but +feel free to open an issue to present your idea. + +### How to submit a contribution + +The general process to submit a contribution is as follow: +1. Create your own fork of the code +2. Do the changes in your fork +3. Make sure to fill the [pull request description](https://github.com/luketainton/FHeD/blob/master/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md) properly. + +### Happy coding :metal: diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 5377b11..a89519f 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -3,7 +3,7 @@ name: Feature request about: Suggest an idea for this project title: '' labels: enhancement, question -assignees: +assignees: --- diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md index 1617cfc..b586407 100644 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -12,7 +12,7 @@ Fixes # (issue) ## Checklist: -- [ ] I read & comply with the [contributing guidelines](https://github.com/bastienwirtz/homer/blob/master/CONTRIBUTING.md) +- [ ] I read & comply with the [contributing guidelines](https://github.com/luketainton/FHeD/blob/master/CONTRIBUTING.md) - [ ] I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers. - [ ] I have made corresponding changes the documentation (README.md). - [ ] I've check my modifications for any breaking change, especially in the `config.yml` file -- 2.49.1 From 3389931667fb0c703693663339b1b2bc822e2b59 Mon Sep 17 00:00:00 2001 From: Alexander Davis Date: Tue, 4 Aug 2020 15:05:54 +0100 Subject: [PATCH 04/14] Update pull_request_template.md --- .github/PULL_REQUEST_TEMPLATE/pull_request_template.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md index b586407..ec8e221 100644 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -15,4 +15,3 @@ Fixes # (issue) - [ ] I read & comply with the [contributing guidelines](https://github.com/luketainton/FHeD/blob/master/CONTRIBUTING.md) - [ ] I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers. - [ ] I have made corresponding changes the documentation (README.md). -- [ ] I've check my modifications for any breaking change, especially in the `config.yml` file -- 2.49.1 From 65f987baa8ae03a01efd1b07a40a28e51a38451c Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Tue, 4 Aug 2020 15:15:59 +0100 Subject: [PATCH 05/14] Update CONTRIBUTING.md --- .github/CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c0677df..4fced40 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -6,7 +6,7 @@ First off, thank you for considering contributing to FHeD! ### Project philosophy -Project philosophy goes here +We wanted to create a simple, easy to use, free helpdesk system without all of the extra bells and whistles that some individuals and small companies may not require. ### Roadmap @@ -37,7 +37,7 @@ feel free to open an issue to present your idea. The general process to submit a contribution is as follow: 1. Create your own fork of the code -2. Do the changes in your fork -3. Make sure to fill the [pull request description](https://github.com/luketainton/FHeD/blob/master/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md) properly. +2. Make you changes in a new branch in your fork (not main) +3. Make sure to fill the [pull request](https://github.com/luketainton/FHeD/blob/master/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md) properly. ### Happy coding :metal: -- 2.49.1 From 231866fbdd53f0ec1c64d053ee87a5db477fd25e Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Tue, 4 Aug 2020 15:03:36 +0100 Subject: [PATCH 06/14] :sparkles: Now working: subscriptions, request viewing permissions Signed-off-by: Luke Tainton --- app/public/index.php | 40 ++++++++++++++++++++++++++++++---- app/public/view.php | 52 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 78 insertions(+), 14 deletions(-) diff --git a/app/public/index.php b/app/public/index.php index 461defe..89b1008 100644 --- a/app/public/index.php +++ b/app/public/index.php @@ -30,6 +30,36 @@ $user_tickets_sub = 0; // Force 'no subbed tickets' msg until the code works } + + function get_sub_ticket($db, $ticket_uuid) { + try { + $stmt = "SELECT * FROM tickets WHERE uuid=:uuid"; + $sql = $db->prepare($stmt); + $sql->bindParam(':uuid', $ticket_uuid); + $sql->execute(); + $sql->setFetchMode(PDO::FETCH_ASSOC); + $result = $sql->fetchAll(); + $tkt = $result[0]; + } catch (PDOException $e) { + echo("Error: " . $e->getMessage()); + } + return $tkt; + } + + function get_user_name($db, $user_uuid) { + try { + $stmt = "SELECT given_name, family_name FROM users WHERE uuid=:uuid"; + $sql = $db->prepare($stmt); + $sql->bindParam(':uuid', $user_uuid); + $sql->execute(); + $sql->setFetchMode(PDO::FETCH_ASSOC); + $result = $sql->fetchAll(); + $usr = $result[0]['given_name'] . " " . $result[0]['family_name']; + } catch (PDOException $e) { + echo("Error: " . $e->getMessage()); + } + return $usr; + } ?> @@ -99,17 +129,19 @@
    No subscribed tickets"); } else { - foreach($sub_tickets_result as $tkt) { + foreach($sub_tickets_result as $sub) { + $tkt = get_sub_ticket($db, $sub['ticket_uuid']); + $tkt_creator = get_user_name($db, $tkt['created_by']); ?>
  • - # + #

    diff --git a/app/public/view.php b/app/public/view.php index 8417315..2300383 100644 --- a/app/public/view.php +++ b/app/public/view.php @@ -1,20 +1,44 @@ prepare($user_tickets_stmt); - $user_tickets_sql->bindParam(':uuid', $_GET['rid']); - $user_tickets_sql->execute(); - $user_tickets_sql->setFetchMode(PDO::FETCH_ASSOC); - $user_tickets_result = $user_tickets_sql->fetchAll(); - $request = $user_tickets_result[0]; + $ticket_stmt = "SELECT * FROM tickets WHERE uuid=:uuid"; + $ticket_sql = $db->prepare($ticket_stmt); + $ticket_sql->bindParam(':uuid', $_GET['rid']); + $ticket_sql->execute(); + $ticket_sql->setFetchMode(PDO::FETCH_ASSOC); + $ticket_result = $ticket_sql->fetchAll(); + $request = $ticket_result[0]; } catch (PDOException $e) { echo("Error: " . $e->getMessage()); } + + // Get authorised subscribers + try { + $users_stmt = "SELECT user_uuid FROM ticket_subscribers WHERE ticket_uuid=:uuid"; + $users_sql = $db->prepare($users_stmt); + $users_sql->bindParam(':uuid', $_GET['rid']); + $users_sql->execute(); + $users_sql->setFetchMode(PDO::FETCH_ASSOC); + $users_result = $users_sql->fetchAll(); + } catch (PDOException $e) { + echo("Error: " . $e->getMessage()); + } + + $authorised_users = array(); + foreach($users_result as $user) { + array_push($authorised_users, $user['user_uuid']); + } + + if (in_array($_SESSION['uuid'], $authorised_users)) { + $is_authorised = true; + } else { + $is_authorised = false; + } } ?> @@ -24,7 +48,7 @@
    - +

    @@ -35,10 +59,18 @@

    +

    + +

    +
    +
    + +
    +
    +

    You are not authorised to see this page.

    -

    You need to be logged in to see this page.

    -- 2.49.1 From e175664edd359dabccc64c8d30f9c4a6cfd0a45c Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Tue, 4 Aug 2020 15:09:33 +0100 Subject: [PATCH 07/14] :lipstick: Add link to home in navbar Signed-off-by: Luke Tainton --- app/includes/header.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/includes/header.php b/app/includes/header.php index effddee..f3795c4 100644 --- a/app/includes/header.php +++ b/app/includes/header.php @@ -26,6 +26,9 @@
    -

    This page is currently under construction.

    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    -- 2.49.1 From a9fdce1c0e640dad77d48505c2804f797940b5f5 Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Tue, 4 Aug 2020 15:34:22 +0100 Subject: [PATCH 12/14] Create stale.yml --- .github/workflows/stale.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..6667465 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,19 @@ +name: Stale issues and PRs + +on: + schedule: + - cron: "0 0 * * *" + +jobs: + stale: + + runs-on: ubuntu-latest + + steps: + - uses: actions/stale@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'This issue has been marked as stale due to inactivity. If this issue is still ongoing, please leave a comment.' + stale-pr-message: 'This pull request has been marked as stale due to inactivity. If this issue is still ongoing, please leave a comment.' + stale-issue-label: 'status/stale' + stale-pr-label: 'status/stale' -- 2.49.1 From ba254896837c0c45980763d760137cfb8c63e4b3 Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Tue, 4 Aug 2020 15:36:19 +0100 Subject: [PATCH 13/14] Update bug_report.md --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index c1e60d4..c58e24d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,7 +2,7 @@ name: Bug report about: Create a report to help us improve title: '' -labels: bug +labels: type/bug assignees: --- -- 2.49.1 From 795a9c3e3204bfacc9f97f17b13d8e00b03b2506 Mon Sep 17 00:00:00 2001 From: Luke Tainton Date: Tue, 4 Aug 2020 15:36:41 +0100 Subject: [PATCH 14/14] Update feature_request.md --- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 5377b11..551ba12 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,7 +2,7 @@ name: Feature request about: Suggest an idea for this project title: '' -labels: enhancement, question +labels: type/feature, type/question assignees: --- -- 2.49.1