Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
955662d6
Commit
955662d6
authored
10 years ago
by
Emmanuel ROHEE
Browse files
Options
Downloads
Patches
Plain Diff
Disabled sending buttons while a message is being sent. Useful on bad Internet connection.
parent
849627b8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
webclient/room/room-controller.js
+15
-3
15 additions, 3 deletions
webclient/room/room-controller.js
webclient/room/room.html
+3
-3
3 additions, 3 deletions
webclient/room/room.html
with
18 additions
and
6 deletions
webclient/room/room-controller.js
+
15
−
3
View file @
955662d6
...
...
@@ -30,7 +30,8 @@ angular.module('RoomController', ['ngSanitize'])
earliest_token
:
"
END
"
,
// stores how far back we've paginated.
can_paginate
:
true
,
// this is toggled off when we run out of items
paginating
:
false
,
// used to avoid concurrent pagination requests pulling in dup contents
stream_failure
:
undefined
// the response when the stream fails
stream_failure
:
undefined
,
// the response when the stream fails
sending
:
false
// true when a message is being sent. It helps to disable the UI when a process is running
};
$scope
.
members
=
{};
$scope
.
autoCompleting
=
false
;
...
...
@@ -232,7 +233,9 @@ angular.module('RoomController', ['ngSanitize'])
if
(
$scope
.
textInput
==
""
)
{
return
;
}
$scope
.
state
.
sending
=
true
;
// Send the text message
var
promise
;
// FIXME: handle other commands too
...
...
@@ -247,10 +250,12 @@ angular.module('RoomController', ['ngSanitize'])
function
()
{
console
.
log
(
"
Sent message
"
);
$scope
.
textInput
=
""
;
$scope
.
state
.
sending
=
false
;
},
function
(
error
)
{
$scope
.
feedback
=
"
Failed to send:
"
+
error
.
data
.
error
;
});
$scope
.
state
.
sending
=
false
;
});
};
$scope
.
onInit
=
function
()
{
...
...
@@ -362,18 +367,24 @@ angular.module('RoomController', ['ngSanitize'])
};
$scope
.
sendImage
=
function
(
url
)
{
$scope
.
state
.
sending
=
true
;
matrixService
.
sendImageMessage
(
$scope
.
room_id
,
url
).
then
(
function
()
{
console
.
log
(
"
Image sent
"
);
},
function
(
error
)
{
$scope
.
feedback
=
"
Failed to send image:
"
+
error
.
data
.
error
;
$scope
.
state
.
sending
=
false
;
});
};
$scope
.
imageFileToSend
;
$scope
.
$watch
(
"
imageFileToSend
"
,
function
(
newValue
,
oldValue
)
{
if
(
$scope
.
imageFileToSend
)
{
$scope
.
state
.
sending
=
true
;
// First download the image to the Internet
console
.
log
(
"
Uploading image...
"
);
mFileUpload
.
uploadFile
(
$scope
.
imageFileToSend
).
then
(
...
...
@@ -383,6 +394,7 @@ angular.module('RoomController', ['ngSanitize'])
},
function
(
error
)
{
$scope
.
feedback
=
"
Can't upload image
"
;
$scope
.
state
.
sending
=
false
;
}
);
}
...
...
This diff is collapsed.
Click to expand it.
webclient/room/room.html
+
3
−
3
View file @
955662d6
...
...
@@ -63,10 +63,10 @@
{{ state.user_id }}
</td>
<td
width=
"*"
style=
"min-width: 100px"
>
<input
id=
"mainInput"
ng-model=
"textInput"
ng-enter=
"send()"
ng-focus=
"true"
auto-complete
/>
<input
id=
"mainInput"
ng-model=
"textInput"
ng-enter=
"send()"
ng-disabled=
"state.sending"
ng-focus=
"true"
auto-complete
/>
</td>
<td
width=
"1"
>
<button
ng-click=
"send()"
>
Send
</button>
<button
ng-click=
"send()"
ng-disabled=
"state.sending"
>
Send
</button>
</td>
<td
width=
"1"
>
...
...
@@ -79,7 +79,7 @@
<input
id=
"mainInput"
ng-model=
"imageURLToSend"
ng-enter=
"sendImage(imageURLToSend)"
placeholder=
"Image URL"
/>
</td>
<td
width=
"100px"
>
<button
ng-click=
"sendImage(imageURLToSend)"
>
Send URL
</button>
<button
ng-click=
"sendImage(imageURLToSend)"
ng-disabled=
"state.sending"
>
Send URL
</button>
</td>
<!-- TODO: To enable once we have an upload server
<td width="100px">
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment