Skip to content

Commit

Permalink
fix: Add short tracking url
Browse files Browse the repository at this point in the history
Closes: #1040
  • Loading branch information
kumy committed Jul 28, 2024
1 parent ed38132 commit ca735ee
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 4 deletions.
16 changes: 16 additions & 0 deletions tests-qa/acceptance/230_Moves/190_short_url.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*** Settings ***
Library RequestsLibrary
Resource ../ressources/vars/Urls.robot
Variables ../ressources/vars/geokrety.yml
Suite Setup Suite Setup

*** Test Cases ***

Should Redirect To Form Url
Go To Url url=${GK_URL}/m/${GEOKRETY_1.tc} redirect=${PAGE_MOVES_URL}\\?tracking_code=${GEOKRETY_1.tc}

*** Keywords ***

Suite Setup
Clear Database And Seed ${1} users
Seed ${1} geokrety owned by ${1}
5 changes: 5 additions & 0 deletions website/app-templates/smarty/forms/geokret_label.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@
</form>
</div>
</div>
{if isset($geokret)}
<div class="alert alert-info alert-dismissible" role="alert">
{t url={'move_create_short'|alias:sprintf('@tracking_code=%s', $geokret->tracking_code)}}Short tracking url: %1{/t}
</div>
{/if}
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">{t}Sample GeoKret label preview{/t}</h3>
Expand Down
6 changes: 3 additions & 3 deletions website/app-templates/smarty/help-pages/en/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ <h3>Jigsaw part</h3>
</tr>
<tr>
<td>
<img src="{GK_CDN_IMAGES_URL}/log-icons/0/4.png" alt="hibernate" / />
<img src="{GK_CDN_IMAGES_URL}/log-icons/0/4.png" alt="hibernate" />
</td>
<td>
<strong>Hibernation / archiving</strong><br />
Expand Down Expand Up @@ -559,7 +559,7 @@ <h3>The easiest and recommended way is to use our GeoKrety Toolbox (GKT)</h3>
</p>

<h3>Install (GKT)</h3>
<div class="row">
<div class="row same-height">

<div class="col-sm-6">
<div class="thumbnail">
Expand Down Expand Up @@ -736,7 +736,7 @@ <h5>how to edit and delete your log, upload a photo etc</h5>
Reference Number and Tracking Code
</div>
<div class="panel-body">
<div class="row">
<div class="row same-height">

<div class="col-sm-6">
<div class="thumbnail">
Expand Down
7 changes: 7 additions & 0 deletions website/app/GeoKrety/Controller/Pages/MoveCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ public function get(\Base $f3) {
Smarty::render('pages/geokret_move.tpl');
}

// https://geokrety.org/m/XXXXX
public function get_short(\Base $f3) {
$params = $f3->get('GET');
$params['tracking_code'] = $f3->get('PARAMS.tracking_code');
$f3->reroute(sprintf('@move_create?%s', http_build_query($params)));
}

public function post(\Base $f3) {
$move_data = MovesService::postToArray($f3);

Expand Down
1 change: 1 addition & 0 deletions website/app/authorizations.ini
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ allow @geokrety_legacy_mission = *
allow @photo_gallery = *
allow @photo_gallery_paginate = *
allow @move_create = *
allow @move_create_short = *
allow @validate_tracking_code = *
allow @validate_waypoint = *
allow @validate_waypoint_name = *
Expand Down
2 changes: 1 addition & 1 deletion website/app/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ AUTOLOAD = app/
LOCALES = ./app/dict/

[MULTILANG]
global = /app-version, /cli, /cron, /admin, /assets, /auth, /auth-return, /api, /gkt, help_api, health, metrics, reset_database, /devel, s3_file_uploaded, picture_upload_drop_s3_signature, geokrety_labels_pdf, /statistics
global = /app-version, /cli, /cron, /admin, /assets, /auth, /auth-return, /api, /gkt, help_api, health, metrics, reset_database, /devel, s3_file_uploaded, picture_upload_drop_s3_signature, geokrety_labels_pdf, /statistics, move_create_short

[MULTILANG.languages]
en = en-GB, en-US, en
Expand Down
1 change: 1 addition & 0 deletions website/app/routes.ini
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ POST @geokret_unwatch: /geokrety/@gkid/unwatch = \GeoKrety\Controller\GeokretUn
; Geokret actions
GET @geokrety_move_select_from_inventory: /moves/select-from-inventory = \GeoKrety\Controller\GeokretSelectFromInventory->get
GET @move_create: /moves = \GeoKrety\Controller\MoveCreate->get
GET @move_create_short: /m/@tracking_code = \GeoKrety\Controller\MoveCreate->get_short
POST @move_create: /moves = \GeoKrety\Controller\MoveCreate->post
GET @geokrety_move_edit: /moves/@moveid/edit = \GeoKrety\Controller\MoveCreate->get
POST @geokrety_move_edit: /moves/@moveid/edit = \GeoKrety\Controller\MoveCreate->post
Expand Down

0 comments on commit ca735ee

Please sign in to comment.