Skip to content

Commit

Permalink
Merge pull request #1158 from nextcloud/bugfix/noid/use-search-term-a…
Browse files Browse the repository at this point in the history
…s-room-name-again

Use the search term as conversation name again
  • Loading branch information
nickvergessen authored Aug 26, 2018
2 parents 7fa07ac + efb30e2 commit d3f4beb
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 18 deletions.
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ And in the works for the [coming versions](https://github.com/nextcloud/spreed/m
]]></description>

<version>3.99.11</version>
<version>3.99.12</version>
<licence>agpl</licence>

<author>Daniel Calviño Sánchez</author>
Expand Down
12 changes: 6 additions & 6 deletions css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@
margin: 0 !important;
}

.select2-result .icon-contacts-dark.avatar,
.select2-result .icon-add.avatar,
#app-navigation .icon-contacts-dark,
#app-navigation .app-navigation-entry-link .icon-public,
#app-navigation .icon-add {
border-radius: 0;
.select2-result .icon-contacts.avatar,
.select2-result .icon-public-white.avatar,
#app-navigation .icon-contacts,
#app-navigation .app-navigation-entry-link .icon-public-white {
border-radius: 50%;
width: 32px;
height: 32px;
background-color: var(--color-background-darker);
}

#app-navigation .favorite-mark {
Expand Down
39 changes: 30 additions & 9 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
itemId: 'new',
shareTypes: [OC.Share.SHARE_TYPE_USER, OC.Share.SHARE_TYPE_GROUP]
};
},
}.bind(this),
results: function (response) {
// TODO improve error case
if (response.ocs.data === undefined) {
Expand All @@ -106,11 +106,32 @@

//Add custom entry to create a new empty group or public room
if (OCA.SpreedMe.app._searchTerm === '') {
results.unshift({ id: "create-public-room", displayName: t('spreed', 'New public conversation'), type: "createPublicRoom"});
results.unshift({ id: "create-group-room", displayName: t('spreed', 'New group conversation'), type: "createGroupRoom"});
results.unshift({
id: "create-public-room",
displayName: t('spreed', 'New public conversation'),
type: "createPublicRoom"
});
results.unshift({
id: "create-group-room",
displayName: t('spreed', 'New group conversation'),
type: "createGroupRoom"
});
} else {
results.push({ id: "create-group-room", displayName: t('spreed', 'New group conversation'), type: "createGroupRoom"});
results.push({ id: "create-public-room", displayName: t('spreed', 'New public conversation'), type: "createPublicRoom"});
var shortenedName = OCA.SpreedMe.app._searchTerm;
if (OCA.SpreedMe.app._searchTerm.length > 25) {
shortenedName = shortenedName.substring(0, 25) + '…';
}

results.push({
id: "create-group-room",
displayName: shortenedName,
type: "createGroupRoom"
});
results.push({
id: "create-public-room",
displayName: t('spreed', '{name} (public)', { name: shortenedName }),
type: "createPublicRoom"
});
}

return {
Expand All @@ -123,12 +144,12 @@
callback({id: element.val()});
},
formatResult: function (element) {
if ((element.type === "createGroupRoom") || (element.type === "createPublicRoom")) {
return '<span><div class="avatar icon-add"></div>' + escapeHTML(element.displayName) + '</span>';
if (element.type === "createPublicRoom") {
return '<span><div class="avatar icon-public-white"></div>' + escapeHTML(element.displayName) + '</span>';
}

if (element.type === 'group') {
return '<span><div class="avatar icon-contacts-dark"></div>' + escapeHTML(element.displayName) + '</span>';
if (element.type === "createGroupRoom" || element.type === 'group') {
return '<span><div class="avatar icon-contacts"></div>' + escapeHTML(element.displayName) + '</span>';
}

return '<span><div class="avatar" data-user="' + escapeHTML(element.id) + '" data-user-display-name="' + escapeHTML(element.displayName) + '"></div>' + escapeHTML(element.displayName) + '</span>';
Expand Down
4 changes: 2 additions & 2 deletions js/views/roomlistview.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,13 @@
this.$el.find('.public-room').removeClass('public-room').addClass('private-room');

_.each(this.$el.find('.avatar'), function(a) {
$(a).removeClass('icon-public').addClass('icon-contacts-dark');
$(a).removeClass('icon-public-white').addClass('icon-contacts');
});
} else if (this.model.get('type') === ROOM_TYPE_PUBLIC_CALL) { // Public room
this.$el.find('.private-room').removeClass('private-room').addClass('public-room');

_.each(this.$el.find('.avatar'), function(a) {
$(a).removeClass('icon-contacts-dark').addClass('icon-public');
$(a).removeClass('icon-contacts').addClass('icon-public-white');
});
}
},
Expand Down

0 comments on commit d3f4beb

Please sign in to comment.