diff --git a/rhodecode/lib/celerylib/tasks.py b/rhodecode/lib/celerylib/tasks.py --- a/rhodecode/lib/celerylib/tasks.py +++ b/rhodecode/lib/celerylib/tasks.py @@ -384,6 +384,9 @@ def create_repo_fork(form_data, cur_user update_after_clone=update_after_clone) action_logger(cur_user, 'user_forked_repo:%s' % fork_name, org_repo_name, '', Session) + + action_logger(cur_user, 'user_created_fork:%s' % fork_name, + fork_name, '', Session) # finally commit at latest possible stage Session.commit() diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -389,6 +389,7 @@ def action_parser(user_log, feed=False): action_map = {'user_deleted_repo':(_('[deleted] repository'), None), 'user_created_repo':(_('[created] repository'), None), + 'user_created_fork':(_('[created] repository as fork'), None), 'user_forked_repo':(_('[forked] repository'), get_fork_name), 'user_updated_repo':(_('[updated] repository'), None), 'admin_deleted_repo':(_('[delete] repository'), None), @@ -428,6 +429,7 @@ def action_parser_icon(user_log): tmpl = """%s""" map = {'user_deleted_repo':'database_delete.png', 'user_created_repo':'database_add.png', + 'user_created_fork':'arrow_divide.png', 'user_forked_repo':'arrow_divide.png', 'user_updated_repo':'database_edit.png', 'admin_deleted_repo':'database_delete.png', diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -347,7 +347,7 @@ class UserLog(Base, BaseModel): __table_args__ = {'extend_existing':True} user_log_id = Column("user_log_id", Integer(), nullable=False, unique=True, default=None, primary_key=True) user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None, default=None) - repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=False, unique=None, default=None) + repository_id = Column("repository_id", Integer(), ForeignKey('repositories.repo_id'), nullable=True) repository_name = Column("repository_name", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) user_ip = Column("user_ip", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) action = Column("action", UnicodeText(length=1200000, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) @@ -358,7 +358,7 @@ class UserLog(Base, BaseModel): return datetime.date(*self.action_date.timetuple()[:3]) user = relationship('User') - repository = relationship('Repository') + repository = relationship('Repository',cascade='') class UsersGroup(Base, BaseModel): @@ -509,7 +509,7 @@ class Repository(Base, BaseModel): followers = relationship('UserFollowing', primaryjoin='UserFollowing.follows_repo_id==Repository.repo_id', cascade='all') - logs = relationship('UserLog', cascade='all') + logs = relationship('UserLog') def __repr__(self): return "<%s('%s:%s')>" % (self.__class__.__name__,