Gitlab Community Edition Instance

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • j.michal/grady
1 result
Select Git revision
Show changes
Commits on Source (2)
......@@ -163,6 +163,11 @@ class FeedbackSerializer(DynamicFieldsModelSerializer):
for comment in data.get('feedback_lines', {}):
lines_in_submission = len(submission.text.split('\n'))
if comment['text'] == '' and 'labels' not in comment:
raise serializers.ValidationError(
"Cannot create feedback with an empty comment attached to it"
)
if not 0 < comment['of_line'] <= lines_in_submission:
raise serializers.ValidationError(
"Cannot comment line number %d of %d" % (
......
......@@ -12,6 +12,8 @@
"test:unit": "vue-cli-service test:unit --require mock-local-storage"
},
"dependencies": {
"@sentry/browser": "^5.6.3",
"@sentry/integrations": "^5.6.1",
"axios": "^0.18.0",
"file-saver": "^2.0.2",
"highlight.js": "^9.12.0",
......
......@@ -71,6 +71,16 @@ export default class AutoLogout extends Vue {
}
mounted () {
// show notification on unload if logged in
window.onbeforeunload = event => {
if (Authentication.isLoggedIn) {
// return something to trigger the confirmation dialog
// since firefox 44 it is no longer possible to show a custom confirmation message
event.preventDefault()
event.returnValue = ''
}
}
this.timer = setInterval(() => {
const timeDialogAppearsBeforeLogout = Math.min(600 * 1e3,
this.jwtTimeDelta ? this.jwtTimeDelta * 0.3 : Infinity)
......
......@@ -104,11 +104,18 @@ export default class CommentForm extends mixins(commentLabelSelector) {
}
submitFeedback () {
const text = this.currentFeedback
const labels = this.labelsUnchanged.concat(this.labelsAdded)
if (text === "" && labels.length === 0) {
return this.collapseTextField()
}
const payload = {
lineNo: Number(this.lineNo),
comment: {
text: this.currentFeedback,
labels: this.labelsUnchanged.concat(this.labelsAdded),
text: text,
labels: labels,
}
}
......
......@@ -12,7 +12,6 @@
>
{{ lineNo }}
</v-btn>
</v-btn>
</td>
<td class="code-cell-content pl-2">
<span v-html="code" class="code-line"></span>
......
......@@ -8,6 +8,8 @@ import router from './router/index'
import Vuetify from 'vuetify'
import Notifications from 'vue-notification'
import Clipboard from 'v-clipboard'
import * as Sentry from '@sentry/browser'
import * as Integrations from '@sentry/integrations'
import 'vuetify/dist/vuetify.min.css'
......@@ -17,6 +19,19 @@ Vue.use(Vuetify)
Vue.use(Clipboard)
Vue.use(Notifications)
if (process.env.NODE_ENV === 'test') {
Sentry.init({
dsn: 'https://c86a983153da412b8aec8b8df9ce51ba@robin-in.space/2',
integrations: [new Integrations.Vue({Vue, attachProps: true, logErrors: true})],
})
} else if (process.env.NODE_ENV == 'production') {
Sentry.init({
dsn: 'https://874b896335564d8c9c49137391f8e3f1@robin-in.space/3',
integrations: [new Integrations.Vue({Vue, attachProps: true, logErrors: true})],
})
}
Vue.config.productionTip = false
const el = process.env.NODE_ENV === 'test' ? undefined : '#app'
......
......@@ -73,7 +73,7 @@ export default {
this.loading = true
Auth.getJWT(this.credentials).then(() => {
return Promise.all([
Auth.getUser(),
Auth.getUser(),
Auth.getJWTTimeDelta()
])
}).then(() => {
......
......@@ -112,6 +112,67 @@
resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz#2b5a3ab3f918cca48a8c754c08168e3f03eba61b"
integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==
"@sentry/browser@^5.6.3":
version "5.6.3"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.6.3.tgz#5cc37b0443eba55ad13c13d34d6b95ff30dfbfe3"
integrity sha512-bP1LTbcKPOkkmfJOAM6c7WZ0Ov0ZEW6B9keVZ9wH9fw/lBPd9UyDMDCwJ+FAYKz9M9S5pxQeJ4Ebd7WUUrGVAQ==
dependencies:
"@sentry/core" "5.6.2"
"@sentry/types" "5.6.1"
"@sentry/utils" "5.6.1"
tslib "^1.9.3"
"@sentry/core@5.6.2":
version "5.6.2"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.6.2.tgz#8c5477654a83ebe41a72e86a79215deb5025e418"
integrity sha512-grbjvNmyxP5WSPR6UobN2q+Nss7Hvz+BClBT8QTr7VTEG5q89TwNddn6Ej3bGkaUVbct/GpVlI3XflWYDsnU6Q==
dependencies:
"@sentry/hub" "5.6.1"
"@sentry/minimal" "5.6.1"
"@sentry/types" "5.6.1"
"@sentry/utils" "5.6.1"
tslib "^1.9.3"
"@sentry/hub@5.6.1":
version "5.6.1"
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.6.1.tgz#9f355c0abcc92327fbd10b9b939608aa4967bece"
integrity sha512-m+OhkIV5yTAL3R1+XfCwzUQka0UF/xG4py8sEfPXyYIcoOJ2ZTX+1kQJLy8QQJ4RzOBwZA+DzRKP0cgzPJ3+oQ==
dependencies:
"@sentry/types" "5.6.1"
"@sentry/utils" "5.6.1"
tslib "^1.9.3"
"@sentry/integrations@^5.6.1":
version "5.6.1"
resolved "https://registry.yarnpkg.com/@sentry/integrations/-/integrations-5.6.1.tgz#fcee1a6e5535a07fdefd365178662283279ce0d7"
integrity sha512-bPtJbmhLDH9Exy0luIKxjlfqmuyAjUPTHZ2CLIw6YlhA5WgK9aYyyjLHTmWK+E9baZBqSp0ShVPAgue2jfpQmQ==
dependencies:
"@sentry/types" "5.6.1"
"@sentry/utils" "5.6.1"
tslib "^1.9.3"
"@sentry/minimal@5.6.1":
version "5.6.1"
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.6.1.tgz#09d92b26de0b24555cd50c3c33ba4c3e566009a1"
integrity sha512-ercCKuBWHog6aS6SsJRuKhJwNdJ2oRQVWT2UAx1zqvsbHT9mSa8ZRjdPHYOtqY3DoXKk/pLUFW/fkmAnpdMqRw==
dependencies:
"@sentry/hub" "5.6.1"
"@sentry/types" "5.6.1"
tslib "^1.9.3"
"@sentry/types@5.6.1":
version "5.6.1"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.6.1.tgz#5915e1ee4b7a678da3ac260c356b1cb91139a299"
integrity sha512-Kub8TETefHpdhvtnDj3kKfhCj0u/xn3Zi2zIC7PB11NJHvvPXENx97tciz4roJGp7cLRCJsFqCg4tHXniqDSnQ==
"@sentry/utils@5.6.1":
version "5.6.1"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.6.1.tgz#69d9e151e50415bc91f2428e3bcca8beb9bc2815"
integrity sha512-rfgha+UsHW816GqlSRPlniKqAZylOmQWML2JsujoUP03nPu80zdN43DK9Poy/d9OxBxv0gd5K2n+bFdM2kqLQQ==
dependencies:
"@sentry/types" "5.6.1"
tslib "^1.9.3"
"@sinonjs/commons@^1.0.2", "@sinonjs/commons@^1.2.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.3.0.tgz#50a2754016b6f30a994ceda6d9a0a8c36adda849"
......@@ -7412,6 +7473,11 @@ tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==
tslib@^1.9.3:
version "1.10.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==
tslint@^5.12.0:
version "5.12.1"
resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.12.1.tgz#8cec9d454cf8a1de9b0a26d7bdbad6de362e52c1"
......
......@@ -52,9 +52,8 @@ class TestFeedbackUpdate(LiveServerTestCase):
# open a new tab and go to the validation page of the just corrected submission
self.browser.execute_script('window.open()')
self.browser.switch_to.window(self.browser.window_handles[-1])
second_tab = self.browser.current_window_handle
self.browser.execute_script("window.sessionStorage.clear()")
self.browser.get(self.live_server_url)
second_tab = self.browser.current_window_handle
username = 'other_tut'
password = 'p'
fact.UserAccountFactory(
......
......@@ -17,7 +17,9 @@ from django.core.exceptions import ObjectDoesNotExist
def create_browser() -> webdriver.Firefox:
options = Options()
options.headless = bool(os.environ.get('HEADLESS_TESTS', False))
options.set_capability('unhandledPromptBehavior', 'accept')
profile = FirefoxProfile()
profile.set_preference("dom.disable_beforeunload", True)
profile.set_preference("browser.download.folderList", 2)
profile.set_preference("browser.download.dir", os.path.dirname(__file__))
profile.set_preference("browser.download.useDownloadDir", True)
......@@ -39,11 +41,14 @@ def login(browser, live_server_url, username, password='p'):
WebDriverWait(browser, 10).until(ec.url_contains('/home'))
def logout(browser: webdriver.Firefox):
browser.find_element_by_id('logout').click()
def reset_browser_after_test(browser: webdriver.Firefox, live_server_url):
while len(browser.window_handles) > 1:
browser.close()
browser.switch_to.window(browser.window_handles[0])
browser.execute_script("window.sessionStorage.clear()")
browser.switch_to.window(browser.window_handles[-1])
browser.get(live_server_url)
......
......@@ -3,6 +3,14 @@ import string
from .default import REST_FRAMEWORK
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
sentry_sdk.init(
dsn='https://874b896335564d8c9c49137391f8e3f1@robin-in.space/3',
integrations=[DjangoIntegration()]
)
""" A live configuration for enhanced security """
CSRF_COOKIE_SECURE = True
CSRF_COOKIE_HTTPONLY = True
......
from .default import *
from .live import *
sentry_sdk.init(
dsn='https://c86a983153da412b8aec8b8df9ce51ba@robin-in.space/2',
integrations=[DjangoIntegration()]
)
REST_FRAMEWORK['DEFAULT_THROTTLE_RATES']['anon'] = '1000/minute'
......@@ -13,3 +13,4 @@ xlrd~=1.2.0
xkcdpass==1.17.0
django-constance[database]~=2.3.1
semver~=2.8.1
sentry-sdk==0.11.2