Skip to content
This repository has been archived by the owner on Nov 8, 2018. It is now read-only.

Commit

Permalink
add aliases feature
Browse files Browse the repository at this point in the history
add aliases feature

add aliases feature

mapper entity service and controller for aliases

comments and fixes

minor bug fix

minor changes

aliases js service, database update and some security fixes

minor fixes for saving and loading aliases

send mail from composer using alias

small fixes

fix most test, delete alias work, better ui

set an alias name with alias id

using alias name when sending email works

big fixes

big fixes

reply composer using aliases

bug fixes and aliases collection

minor bug fixes

minor fix

radio for aliases controller and service

fix for when refrshing settings page

fix email length in the database

[tx-robot] updated from transifex

change to secure connection

remove secure http: false

[tx-robot] updated from transifex

Correct return for getFolderById - fixes #1514

account !== folder

fetch UIDs and DATEs of all messages and do the pagination client side

use search strategy only if SORT is not supported

update changelog for 0.5.2

Update composerlock to https

remove more message button is obsolete with infinite scroll

[tx-robot] updated from transifex

[tx-robot] updated from transifex

[tx-robot] updated from transifex

refactor message 'load' event parameters

messagecontent -> foldercontent

pass account/folder via constructor

also use the new collection when refreshing

inject messages collection

Fix jscs errors

sync karma require config with runtime require config

open first mailbox when clicking the account's email address

fix jscs error

update grunt

0.5.3 version bump

update/unify license headers

use underscore to debounce search filters; do not re-search the same term

remove obsolete folder reset event + event handler

smoother transition when adding another account

remove user id from alias table and js bug fix and optimization

add new keyboard channel and port existing key listener

allow navigation with j, k

allow left/right arrow to switch messages

use 'mail' instead of 'Mail' for bower to prevent warning

merge conflict resolve

squash and rebase commits

fix AccountsControllerTest::testIndex

travis js fix

alias collection update

adding aliases collection and bug fixes

big fixes

show you when mail is sent to an alias or email

select current account as default in composer

fix for selecting default account on composer

fix grunt issues
  • Loading branch information
tahaalibra committed Jul 29, 2016
1 parent d4cdfde commit 173aeb8
Show file tree
Hide file tree
Showing 31 changed files with 967 additions and 39 deletions.
33 changes: 33 additions & 0 deletions appinfo/database.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,37 @@
</index>
</declaration>
</table>
<table>
<name>*dbprefix*mail_aliases</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<autoincrement>1</autoincrement>
<default>0</default>
<notnull>true</notnull>
<length>4</length>
</field>
<field>
<name>account_id</name>
<type>integer</type>
<default></default>
<notnull>true</notnull>
<length>4</length>
</field>
<field>
<name>name</name>
<type>text</type>
<default></default>
<notnull>false</notnull>
<length>64</length>
</field>
<field>
<name>alias</name>
<type>text</type>
<notnull>true</notnull>
<length>255</length>
</field>
</declaration>
</table>
</database>
1 change: 1 addition & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,6 @@
'accounts' => ['url' => '/accounts'],
'folders' => ['url' => '/accounts/{accountId}/folders'],
'messages' => ['url' => '/accounts/{accountId}/folders/{folderId}/messages'],
'aliases' => ['url' => '/accounts/{accountId}/aliases'],
]
]);
2 changes: 2 additions & 0 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ define(function(require) {
// Load controllers/services
require('controller/foldercontroller');
require('controller/messagecontroller');
require('controller/aliasescontroller');
require('service/accountservice');
require('service/attachmentservice');
require('service/davservice');
require('service/folderservice');
require('service/messageservice');
require('service/aliasesservice');
require('notification');

// Set marionette defaults
Expand Down
75 changes: 75 additions & 0 deletions js/controller/aliasescontroller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
* @author Tahaa Karim <tahaalibra@gmail.com>
*
* ownCloud - Mail
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/

define(function(require) {
'use strict';

var $ = require('jquery');
var _ = require('underscore');
var Radio = require('radio');

Radio.aliases.reply('load:alias', loadAliases);
Radio.aliases.reply('save:alias', saveAlias);
Radio.aliases.reply('delete:alias', deleteAlias);

/**
* @param {Account} account
* @returns {undefined}
*/
function loadAliases(account) {
var fetchingAliases = Radio.aliases.request('entities');

$.when(fetchingAliases).fail(function() {
Radio.ui.trigger('error:show', t('mail', 'Fetching Aliases Failed.'));
});

return fetchingAliases;
}

/**
* @param {Account} account
* @param alias
* @returns {undefined}
*/
function saveAlias(account, alias) {
var savingAliases = Radio.aliases.request('save', account, alias);

$.when(savingAliases).fail(function() {
Radio.ui.trigger('error:show', t('mail', 'Saving Aliases Failed.'));
});

return savingAliases;
}

/**
* @param {Account} account
* @param aliasId
* @returns {undefined}
*/
function deleteAlias(account, aliasId) {
var deletingAliases = Radio.aliases.request('delete', account, aliasId);

$.when(deletingAliases).fail(function() {
Radio.ui.trigger('error:show', t('mail', 'Deleting Aliases Failed.'));
});

return deletingAliases;
}

});
8 changes: 7 additions & 1 deletion js/models/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,22 @@ define(function(require) {

var Backbone = require('backbone');
var FolderCollection = require('models/foldercollection');
var AliasesCollection = require('models/aliasescollection');
var OC = require('OC');

/**
* @class Account
*/
var Account = Backbone.Model.extend({
defaults: {
folders: []
folders: [],
aliases: []
},
idAttribute: 'accountId',
url: OC.generateUrl('apps/mail/accounts'),
initialize: function() {
this.set('folders', new FolderCollection(this.get('folders')));
this.set('aliases', new AliasesCollection(this.get('aliases')));
},
_getFolderByIdRecursively: function(folder, folderId) {
if (!folder) {
Expand Down Expand Up @@ -67,6 +70,9 @@ define(function(require) {
if (data.folders && data.folders.toJSON) {
data.folders = data.folders.toJSON();
}
if (data.aliases && data.aliases.toJSON) {
data.aliases = data.aliases.toJSON();
}
if (!data.id) {
data.id = this.cid;
}
Expand Down
38 changes: 38 additions & 0 deletions js/models/alias.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* ownCloud - Mail
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Tahaa Karim <tahaalibra@gmail.com>
* @copyright Tahaa Karim 2016
*/

define(function(require) {
'use strict';

var Backbone = require('backbone');

/**
* @class Alias
*/
var Alias = Backbone.Model.extend({
defaults: {
},
initialize: function() {

},
toJSON: function() {
var data = Backbone.Model.prototype.toJSON.call(this);
if (data.alias && data.alias.toJSON) {
data.alias = data.alias.toJSON();
}
if (!data.id) {
data.id = this.cid;
}
return data;
}
});

return Alias;
});
25 changes: 25 additions & 0 deletions js/models/aliasescollection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* ownCloud - Mail
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Tahaa Karim <tahaalibra@gmail.com>
* @copyright Tahaa Karim 2016
*/

define(function(require) {
'use strict';

var Backbone = require('backbone');
var Alias = require('models/alias');

/**
* @class AliasesCollection
*/
var AliasesCollection = Backbone.Collection.extend({
model: Alias
});

return AliasesCollection;
});
3 changes: 2 additions & 1 deletion js/radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ define(function(require) {
'notification',
'state',
'ui',
'keyboard'
'keyboard',
'aliases'
];

var channels = {};
Expand Down
14 changes: 14 additions & 0 deletions js/routecontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ define(function(require) {

Radio.navigation.on('folder', _.bind(this.showFolder, this));
Radio.navigation.on('setup', _.bind(this.showSetup, this));
Radio.navigation.on('accountsettings', _.bind(this.showAccountSettings, this));
},
_navigate: function(route, options) {
options = options || {};
Expand Down Expand Up @@ -123,6 +124,19 @@ define(function(require) {
Radio.ui.trigger('composer:leave');
Radio.ui.trigger('navigation:hide');
Radio.ui.trigger('setup:show');
},
showAccountSettings: function(accountId) {
this._navigate('accounts/' + accountId + '/settings');
var account = this.accounts.get(accountId);
if (_.isUndefined(account)) {
// Unknown account id -> redirect
Radio.ui.trigger('error:show', t('mail', 'Invalid account'));
this.default();
return;
}
Radio.ui.trigger('composer:leave');
Radio.ui.trigger('navigation:hide');
Radio.ui.trigger('accountsettings:show', account);
}
};

Expand Down
3 changes: 2 additions & 1 deletion js/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ define(function(require) {
'': 'default',
'accounts/:accountId/folders/:folderId': 'showFolder',
'mailto(?:params)': 'mailTo',
'setup': 'showSetup'
'setup': 'showSetup',
'accounts/:accountId/settings': 'showAccountSettings'
}
});

Expand Down
Loading

0 comments on commit 173aeb8

Please sign in to comment.