Skip to content

Commit

Permalink
Merge pull request #6439 from gitcoinco/feature/hackathon-ts-updates
Browse files Browse the repository at this point in the history
Hackathon Townsquare - General Cleanup and Project Panel Updates
  • Loading branch information
octavioamu authored Apr 22, 2020
2 parents 8bcf4bf + b373347 commit 3a9fda3
Show file tree
Hide file tree
Showing 6 changed files with 383 additions and 388 deletions.
21 changes: 21 additions & 0 deletions app/assets/v2/js/pages/dashboard-hackathon.js
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,12 @@
Vue.component('project-directory', {
delimiters: [ '[[', ']]' ],
methods: {
openChat: function(handle) {
let vm = this;
const url = handle ? `${vm.chatURL}/hackathons/messages/@${handle}` : `${vm.chatURL}/`;

chatWindow = window.open(url, 'Loading', 'top=0,left=0,width=400,height=600,status=no,toolbar=no,location=no,menubar=no,titlebar=no');
},
fetchProjects: function(newPage) {
let vm = this;

Expand All @@ -878,6 +884,12 @@
}
vm.params.page = vm.projectsPage;
vm.params.hackathon = hackathonId;

vm.params.filters = '';
if (vm.params.lfm) {
vm.params.filters = 'lfm';
}

if (vm.searchTerm) {
vm.params.search = vm.searchTerm;
} else {
Expand Down Expand Up @@ -932,6 +944,8 @@
projectsHasNext,
numProjects,
media_url,
chatURL: document.chatURL,
lfm: false,
searchTerm: null,
bottom: false,
params: {},
Expand Down Expand Up @@ -1009,6 +1023,13 @@
let newUrl = `/hackathon/${vm.hackathonObj['slug']}/${newPathName}/${window.location.search}`;

history.pushState({}, `${vm.hackathonObj['slug']} - ${newPathName}`, newUrl);

$(window).on('popstate', function(e) {
e.preventDefault();
// we change the url with the panels to ensure if you refresh or get linked here you're being shown what you want
// this is so that we go back to where we got sent here from, townsquare, etc.
window.location = document.referrer;
});
}
},
data: () => ({
Expand Down
8 changes: 8 additions & 0 deletions app/assets/v2/js/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ let hackathonId = document.hasOwnProperty('hackathon_id') ? document.hackathon_i

Vue.mixin({
methods: {
chatWindow: function(handle) {
let vm = this;
const url = handle ? `${vm.chatURL}/hackathons/messages/@${handle}` : `${vm.chatURL}/`;

chatWindow = window.open(url, 'Loading', 'top=0,left=0,width=400,height=600,status=no,toolbar=no,location=no,menubar=no,titlebar=no');
},
fetchUsers: function(newPage) {
let vm = this;

Expand Down Expand Up @@ -262,6 +268,7 @@ Vue.component('user-directory', {
usersHasNext,
numUsers,
media_url,
chatURL: document.chatURL || 'https://chat.gitcoin.co/',
searchTerm: null,
bottom: false,
params: {},
Expand Down Expand Up @@ -320,6 +327,7 @@ if (document.getElementById('gc-users-directory')) {
usersHasNext,
numUsers,
media_url,
chatURL: document.chatURL || 'https://chat.gitcoin.co/',
searchTerm: null,
bottom: false,
params: {},
Expand Down
2 changes: 1 addition & 1 deletion app/assets/v2/js/vue-filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ Vue.filter('capitalize', function(value) {

value = value.toString();
return value.charAt(0).toUpperCase() + value.slice(1);
});
});
17 changes: 9 additions & 8 deletions app/chat/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,20 +285,21 @@ def add_to_channel(self, channel_details, chat_user_ids: list, retry: bool = Tru
:param retry:
:return:
"""
chat_driver.login()
try:
chat_driver.login()
for chat_user_id in chat_user_ids:
if chat_user_id is '' or chat_user_id is None:
try:
if chat_user_id is '' or chat_user_id is None:
continue
chat_driver.channels.add_user(channel_details['id'], options={
'user_id': chat_user_id
})
except Exception as e:
logger.debug(str(e))
continue
chat_driver.channels.add_user(channel_details['id'], options={
'user_id': chat_user_id
})

except ConnectionError as exc:
logger.debug(str(exc))
self.retry(countdown=30)
except Exception as e:
logger.debug(str(e))


@app.shared_task(bind=True, max_retries=1)
Expand Down
Loading

0 comments on commit 3a9fda3

Please sign in to comment.